Skip to content

Commit

Permalink
Merge pull request rhinstaller#5660 from KKoukiou/rhel-9-po-downloaded
Browse files Browse the repository at this point in the history
Sync po/Makefile.am with master and install git in the rpm container
  • Loading branch information
KKoukiou authored May 22, 2024
2 parents c10b8be + fef9878 commit 772f67c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 38 deletions.
18 changes: 1 addition & 17 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ ARCHIVE_TAG = $(PACKAGE_NAME)-$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)
# Set this to "true" if you want to have SRPM archive with test version
TEST_BUILD ?= "false"

# LOCALIZATION SETTINGS
L10N_REPOSITORY ?= https://github.com/rhinstaller/anaconda-l10n.git
# Branch used in anaconda-l10n repository. This should be master all the time.
GIT_L10N_BRANCH ?= master

RC_RELEASE ?= $(shell date -u +0.1.%Y%m%d%H%M%S)

PYTHON ?= python3
Expand Down Expand Up @@ -118,12 +113,6 @@ tag:
@git tag -s -a -m "Tag as $(ARCHIVE_TAG)" $(ARCHIVE_TAG)
@echo "Tagged as $(ARCHIVE_TAG)"

po-pull:
TEMP_DIR=$$(mktemp --tmpdir -d anaconda-localization-XXXXXXXXXX) && \
git clone --depth 1 -b $(GIT_L10N_BRANCH) -- $(L10N_REPOSITORY) $$TEMP_DIR && \
cp $$TEMP_DIR/$(L10N_DIR)/*.po $(srcdir)/po/ && \
rm -rf $$TEMP_DIR

pot:
$(MAKE) -C po $(PACKAGE_NAME).pot-update
rm $(srcdir)/po/{main,extra}.pot
Expand All @@ -148,10 +137,6 @@ pot-update-check: pot
echo "Pot file needs update! Please update the pot file ./po/anaconda.pot in $(L10N_REPOSITORY)"; \
fi ;

# Try to fetch translations, but if that fails just keep going
po-fallback:
-$(MAKE) po-pull

scratch:
if [ "$(TEST_BUILD)" == "true" ]; then \
sed -ri '/AC_INIT/ s/\[[0-9.]+\]/[999999999]/' $(srcdir)/configure.ac; \
Expand All @@ -173,7 +158,6 @@ scratch-bumpver:
$(MAKE) -C po $(PACKAGE_NAME).pot-update

release:
$(MAKE) po-pull
$(MAKE) dist

container-release:
Expand Down Expand Up @@ -235,7 +219,7 @@ anaconda-rpm-push:
$(CONTAINER_ADD_ARGS) \
$(RPM_NAME):$(CI_TAG)

bumpver: po-pull
bumpver:
@opts="-n $(PACKAGE_NAME) -v $(PACKAGE_VERSION) -r $(PACKAGE_RELEASE) -b $(PACKAGE_BUGREPORT)" ; \
if [ ! -z "$(IGNORE)" ]; then \
opts="$${opts} -i $(IGNORE)" ; \
Expand Down
1 change: 1 addition & 0 deletions dockerfile/anaconda-rpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN set -e; \
dnf update -y; \
dnf install -y \
curl-minimal \
git \
python3-pip \
/usr/bin/xargs \
rpm-build; \
Expand Down
1 change: 1 addition & 0 deletions po/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.mo
*.po.new
.po_downloaded
34 changes: 13 additions & 21 deletions po/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,15 @@

# Variables used in xgettext arguments
COPYRIGHT_HOLDER = Red Hat, Inc.
MSGID_BUGS_ADDRESS = anaconda-devel[email protected]
MSGID_BUGS_ADDRESS = anaconda-devel@lists.fedoraproject.org

include $(top_srcdir)/branch-config.mk
include ./l10n-config.mk

PO_DOWNLOADED_FLAG = $(srcdir)/.po_downloaded

# What kind of files are we looking for?
POTFILE_SUFFIXES = py c glade desktop js

# Extra files to scan for strings
# This is the config file used by userhelper. The startup notification can be
# translated. Just pull the string out and stick in a C-style header.
POTFILE_EXTRA = $(top_builddir)/data/liveinst/console.apps/liveinst.h

$(top_builddir)/data/liveinst/console.apps/liveinst.h: $(top_srcdir)/data/liveinst/console.apps/liveinst
$(AM_V_GEN)sed -n 's/^STARTUP_NOTIFICATION_NAME=\(.*\)/char *s = N_(\1)/p' < $< > $@
POTFILE_SUFFIXES = py c glade desktop

# Below this line is the part that shouldn't need to be changed for other
# projects
Expand All @@ -100,7 +92,7 @@ POTFILE = $(PACKAGE).pot
# The translation files, provided by translators, pulled down from translation repository.
# Use whatever we got from this repository, or nothing at all if no translations were
# pulled.
POFILES = $(wildcard $(srcdir)/*.po)
POFILES = $(shell find $(srcdir) -type f -name '*.po')

# The translations files after they have been merged with the latest copy of
# the .pot file. These are written to $(builddir) as <lang>.mpo.
Expand All @@ -122,8 +114,9 @@ [email protected]: $(srcdir)/sr.po
# translatable
XGETTEXT = $(top_srcdir)/translation-canary/xgettext_werror.sh
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2 \
--keyword=C_:1c,2 --keyword=CN_:1c,2 --keyword=CP_:1c,2,3 \
--keyword=C_:1c,2 --keyword=CN_:1c,2 --keyword=CP_:1c,2,3 \
--add-comments=TRANSLATORS: \
--sort-output \
--from-code=UTF-8 --package-name=$(PACKAGE) \
--package-version=$(PACKAGE_VERSION) \
--copyright-holder="$(COPYRIGHT_HOLDER)" \
Expand Down Expand Up @@ -175,7 +168,9 @@ MSGMERGE_V_OPTIONS_1 = $(MSGMERGE_OPTIONS) --verbose

# Actually do stuff:
# .po files get distributed but not installed
dist_noinst_DATA = $(POFILES)
# Let's also store a flag downloaded file which tells us that the translations are
# already downloaded.
dist_noinst_DATA = $(POFILES) $(PO_DOWNLOADED_FLAG)

# Build the .mo files but don't actually do anything with them. The real
# install part is in the install-data-local target below. Build the .pot file
Expand All @@ -187,16 +182,12 @@ nodist_noinst_DATA = $(MOFILES) $(POTFILE)
# Build in two parts so that the bulk of the files are saved as relative to
# top_srcdir (via --directory). Leave $POTFILES_EXTRAS as-is so the extra
# targets don't need to worry about paths changing out from under them.

main.pot: $(POTFILE_INPUT)
$(GETTEXT_V_EXTRACT)$(XGETTEXT) $(XGETTEXT_OPTIONS) --directory=$(top_srcdir) -o $@ \
$(patsubst $(top_srcdir)/%,%,$(POTFILE_INPUT))

extra.pot: $(POTFILE_EXTRA)
$(GETTEXT_V_EXTRACT)$(XGETTEXT) $(XGETTEXT_OPTIONS) -o $@ $(POTFILE_EXTRA)

$(POTFILE): main.pot extra.pot
$(AM_V_GEN)$(MSGCAT) -o $@ --use-first main.pot extra.pot
$(POTFILE): main.pot
$(AM_V_GEN)$(MSGCAT) -o $@ main.pot

# Request po files download before collecting them in the POFILES variable.
$(POFILES): $(PO_DOWNLOADED_FLAG)
Expand Down Expand Up @@ -227,8 +218,9 @@ $(PACKAGE).pot-update:
# How to build the merged .mpo files from the .po files
$(MERGED_POFILES): $(POFILES) $(POTFILE)

# OMP_NUM_THREADS=1; This helps to avoid 'libgomp: Thread creation failed: Resource temporarily unavailable' on Cockpit's CI
.po.mpo:
$(GETTEXT_V_MERGE)$(MSGMERGE) $(MSGMERGE_V_OPTIONS) -o $@ $< $(POTFILE)
$(GETTEXT_V_MERGE) OMP_NUM_THREADS=1 $(MSGMERGE) $(MSGMERGE_V_OPTIONS) -o $@ $< $(POTFILE)

# How to build the .mo files from the .mpo files
$(MOFILES): $(MERGED_POFILES)
Expand All @@ -254,4 +246,4 @@ uninstall-local:
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo ; \
done

CLEANFILES = $(MERGED_POFILES) $(MOFILES) $(POTFILE) main.pot extra.pot
CLEANFILES = $(MERGED_POFILES) $(MOFILES) $(POTFILE) main.pot $(PO_DOWNLOADED_FLAG)

0 comments on commit 772f67c

Please sign in to comment.