From: "Brian C. Lane" bcl@redhat.com
This commit adjusts the Makefile targets to use zanata, and makebumpver to check the zanata.xml for the correct branch. --- .tx/config | 8 ---- Makefile.am | 10 ++--- scripts/makebumpver | 60 ++++++++++++++--------------- zanata.xml | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 45 deletions(-) delete mode 100644 .tx/config create mode 100644 zanata.xml
diff --git a/.tx/config b/.tx/config deleted file mode 100644 index 9bb64b7..0000000 --- a/.tx/config +++ /dev/null @@ -1,8 +0,0 @@ -[anaconda.master] -file_filter = po/<lang>.po -source_file = po/anaconda.pot -source_lang = en - -[main] -host = https://www.transifex.com - diff --git a/Makefile.am b/Makefile.am index 5945109..8714fba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,16 +44,16 @@ dist_sbin_SCRIPTS = anaconda
ARCHIVE_TAG = $(PACKAGE_NAME)-$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)
-TX_PULL_ARGS = -a -f -TX_PUSH_ARGS = -s +ZANATA_PULL_ARGS = --transdir $(srcdir)/po/ +ZANATA_PUSH_ARGS = --srcdir $(srcdir)/po/ --push-type source --force
tag: @git tag -s -a -m "Tag as $(ARCHIVE_TAG)" $(ARCHIVE_TAG) @echo "Tagged as $(ARCHIVE_TAG)"
po-pull: - rpm -q transifex-client &>/dev/null || ( echo "need to run: yum install transifex-client"; exit 1 ) - tx pull $(TX_PULL_ARGS) + rpm -q zanata-python-client &>/dev/null || ( echo "need to run: yum install zanata-python-client"; exit 1 ) + zanata pull $(ZANATA_PULL_ARGS)
po-empty: for lingua in $$(grep -v '^#' $(srcdir)/po/LINGUAS) ; do \ @@ -99,7 +99,7 @@ bumpver: po-pull fi ; \ ( cd $(srcdir) && scripts/makebumpver $${opts} ) || exit 1 ; \ $(MAKE) -C po $(PACKAGE_NAME).pot-update && \ - tx push $(TX_PUSH_ARGS) + zanata push $(ZANATA_PUSH_ARGS)
# Install all packages specified as BuildRequires in the Anaconda specfile # -> installs packages needed to build Anaconda diff --git a/scripts/makebumpver b/scripts/makebumpver index bb200ff..287fcee 100755 --- a/scripts/makebumpver +++ b/scripts/makebumpver @@ -37,7 +37,6 @@ import subprocess import sys import textwrap import urllib -from ConfigParser import ConfigParser
class MakeBumpVer: def __init__(self, *args, **kwargs): @@ -89,14 +88,14 @@ class MakeBumpVer: self.spec = kwargs.get('spec') self.skip_acks = kwargs.get('skip_acks', False) self.skip_all = kwargs.get('skip_all', False) - self.tx_config = kwargs.get('tx_config') - self.skip_tx = kwargs.get("skip_tx", False) + self.zanata_config = kwargs.get('zanata_config') + self.skip_zanata = kwargs.get("skip_zanata", False) self.skip_jenkins = kwargs.get("skip_jenkins", False)
if self.skip_all: self.skip_acks = True self.skip_jenkins = True - self.skip_tx = True + self.skip_zanata = True
self.git_branch = None
@@ -494,38 +493,35 @@ class MakeBumpVer:
return ret
- def check_transifex(self): + def check_zanata(self): """ - Make sure that the transifex branch matches the current git branch + Make sure that the zanata project-version matches the current git branch
This is to prevent accidentally pushing translations to the wrong branch, - eg. when branching for a new release and .tx/config hasn't been updated + eg. when branching for a new release and zanata.xml hasn't been updated """ if not self.git_branch: - log.error("No git branch, cannot check transifex config") + log.error("No git branch, cannot check zanata config") return False
- ret = True - section_name = "anaconda."+self.git_branch - - config = ConfigParser() - config.read(self.tx_config) - - if section_name not in config.sections(): - log.error(".tx/config is missing the section for this branch: %s", section_name) - ret = False - - # There should only be anaconda.<branch_name> and main sections - valid_sections = (section_name, "main") - for section in config.sections(): - if section not in valid_sections: - log.error(".tx/config has an invalid section: %s", section) - ret = False + version_re = re.compile("<project-version>(.*)</project-version>") + ret = False + with open(self.zanata_config, "r") as f: + for line in f: + m = version_re.match(line.strip()) + if m and m.group(1) == self.git_branch: + ret = True + break + elif m: + log.error("zanata.xml branch (%s) does not match current branch: %s", m.group(1), self.git_branch) + break + else: + log.error("zanata.xml does not have a project-version")
return ret
def run(self): - if not self.skip_tx and not self.check_transifex(): + if not self.skip_zanata and not self.check_zanata(): sys.exit(1)
# For now, jenkins is in an advisory role so do not require it to pass. @@ -551,7 +547,7 @@ def usage(cmd): sys.stdout.write(" -s, --skip-acks Skip checking for rhel-X.X.X ack flag\n") sys.stdout.write(" -S, --skip-all Skip all checks\n") sys.stdout.write(" -d, --debug Turn on debug logging to stdout\n") - sys.stdout.write(" --skip-tx Skip checking Transifex config for branch name\n") + sys.stdout.write(" --skip-zanata Skip checking Zanata config for branch name\n") sys.stdout.write(" --skip-jenkins Skip checking Jenkins for test results\n") sys.stdout.write("\nThe -i switch is intended for use with utility commits that we do not need to\n") sys.stdout.write("reference in the spec file changelog. The -m switch is used to map a Fedora\n") @@ -564,17 +560,17 @@ def main(argv): cwd = os.getcwd() configure = os.path.realpath(cwd + '/configure.ac') spec = os.path.realpath(cwd + '/anaconda.spec.in') - tx_config = os.path.realpath(cwd + '/.tx/config') + zanata_config = os.path.realpath(cwd + '/zanata.xml') name, version, release, bugreport = None, None, None, None ignore, bugmap = None, None - show_help, unknown, skip_acks, skip_all, skip_tx, skip_jenkins = False, False, False, False, False, False + show_help, unknown, skip_acks, skip_all, skip_zanata, skip_jenkins = False, False, False, False, False, False opts = []
try: opts, _args = getopt.getopt(sys.argv[1:], 'n:v:r:b:i:m:sSd?', ['name=', 'version=', 'release=', 'bugreport=', 'ignore=', 'map=', - 'debug', 'help', 'skip-tx', 'skip-jenkins']) + 'debug', 'help', 'skip-zanata', 'skip-jenkins']) except getopt.GetoptError: show_help = True
@@ -597,8 +593,8 @@ def main(argv): skip_all = True elif o in ('-d', '--debug'): log.setLevel(logging.DEBUG) - elif o in ('--skip-tx'): - skip_tx = True + elif o in ('--skip-zanata'): + skip_zanata = True elif o in ('--skip-jenkins'): skip_jenkins = True elif o in ('-?', '--help'): @@ -637,7 +633,7 @@ def main(argv): mbv = MakeBumpVer(name=name, version=version, release=release, bugreport=bugreport, ignore=ignore, bugmap=bugmap, configure=configure, spec=spec, skip_acks=skip_acks, - skip_all=skip_all, tx_config=tx_config, skip_tx=skip_tx, + skip_all=skip_all, zanata_config=zanata_config, skip_zanata=skip_zanata, skip_jenkins=skip_jenkins) mbv.run()
diff --git a/zanata.xml b/zanata.xml new file mode 100644 index 0000000..7dfce2c --- /dev/null +++ b/zanata.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<config xmlns="http://zanata.org/namespace/config/"> + <url>https://fedora.zanata.org/</url> + <project>anaconda</project> + <project-version>master</project-version> + <project-type>gettext</project-type> + + <locales> + <locale>sq</locale> + <locale>ar</locale> + <locale>as</locale> + <locale>ast</locale> + <locale>bal</locale> + <locale>eu</locale> + <locale>bn</locale> + <locale>bn-IN</locale> + <locale>brx</locale> + <locale>bs</locale> + <locale>br</locale> + <locale>bg</locale> + <locale>ca</locale> + <locale>zh-CN</locale> + <locale>zh-HK</locale> + <locale>zh-TW</locale> + <locale>kw</locale> + <locale>kw-GB</locale> + <locale>cs</locale> + <locale>da</locale> + <locale>nl</locale> + <locale>en-GB</locale> + <locale>eo</locale> + <locale>et</locale> + <locale>fi</locale> + <locale>fr</locale> + <locale>gl</locale> + <locale>ka</locale> + <locale>de</locale> + <locale>el</locale> + <locale>gu</locale> + <locale>he</locale> + <locale>hi</locale> + <locale>hu</locale> + <locale>is</locale> + <locale>id</locale> + <locale>ia</locale> + <locale>it</locale> + <locale>ja</locale> + <locale>kn</locale> + <locale>kk</locale> + <locale>km</locale> + <locale>ky</locale> + <locale>ko</locale> + <locale>lt</locale> + <locale>nds</locale> + <locale>mk</locale> + <locale>mai</locale> + <locale>ms</locale> + <locale>ml</locale> + <locale>mr</locale> + <locale>mn</locale> + <locale>ne</locale> + <locale>nb</locale> + <locale>nn</locale> + <locale>or</locale> + <locale>pa</locale> + <locale>fa</locale> + <locale>pl</locale> + <locale>pt</locale> + <locale>pt-BR</locale> + <locale>ro</locale> + <locale>ru</locale> + <locale>sr</locale> + <locale>sr@latin</locale> + <locale>si</locale> + <locale>sk</locale> + <locale>sl</locale> + <locale>es</locale> + <locale>sv</locale> + <locale>tg</locale> + <locale>ta</locale> + <locale>te</locale> + <locale>bo</locale> + <locale>tr</locale> + <locale>uk</locale> + <locale>ur</locale> + <locale>wba</locale> + <locale>cy</locale> + <locale>lv</locale> + <locale>kw@uccor</locale> + <locale>kw@kkcor</locale> + <locale>af</locale> + <locale>am</locale> + <locale>be</locale> + <locale>hr</locale> + <locale>de-CH</locale> + <locale>th</locale> + <locale>vi</locale> + <locale>zu</locale> + <locale>ilo</locale> + <locale>nso</locale> + <locale>tw</locale> + <locale>yo</locale> + <locale>anp</locale> + </locales> + +</config>
From: "Brian C. Lane" bcl@redhat.com
--- docs/transifex.txt | 129 -------------------------------------------------- docs/translations.txt | 116 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 129 deletions(-) delete mode 100644 docs/transifex.txt create mode 100644 docs/translations.txt
diff --git a/docs/transifex.txt b/docs/transifex.txt deleted file mode 100644 index afbc9ce..0000000 --- a/docs/transifex.txt +++ /dev/null @@ -1,129 +0,0 @@ -Transifex and anaconda Development -09-Mar-2011 -by: David Cantrell dcantrell@redhat.com ------------------------------------------------------------------------------ - -Setting up the new transifex-client on your system for anaconda builds. - -1) Install the transifex-client package: - yum install transifex-client - -or- - yum --enablerepo=updates-testing install transifex-client - -or- - yum --enablerepo=epel-testing install transifex-client - -2) Create a Transifex.net account at https://fedora.transifex.net/ - NOTE: This system is not linked to FAS, it's hosted by another company, - so it requires another account at this time. I'm sure this will change - in the future, but this is how it is for now. - -3) Configure 'tx' on your system: - tx init - Accept default host, fill in your username and password generated in #2. - -Now tx is set up on your system. The translation files will only be pulled -when a 'make release' is done. The 'make dist' step will just create a tar -file of the what we have in our repo. The 'make bumpver' step will also -push a new anaconda.pot file to Transifex, so any string changes are pushed -to them on a regular basis. - -NOTE: tx pull is slow. This is why I only added it to the 'make bumpver' -step. - -There are some other procedures related to tx that will have to be done -when we create new branches or when there are translation errors. - - -MAKING A RELEASE ----------------- - -git clean -d -x -f -./autogen.sh && ./configure --disable-static \ ---enable-introspection --enable-gtk-doc -make bumpver # tx pull by dependent po-pull target -git commit -a -m "New version." # DO NOT run 'git clean -d -x -f' after -make && make release # signed tag happens after dist now - -The process here is mostly the same. I do not recommend that you run -git clean between 'make bumpver' and 'make release'. The reason is you -will have to run 'tx pull' again and that's slow, plus translations may -have changed between the two steps. - -The 'make tag' step now runs after 'make dist' in case dist generation -fails. That way you don't end up with a partially created dist AND a -bad tag you have to delete. - -The 'make scratch' target will also run po-pull to get translations. If -we need translation files in other targets, we can add po-pull as a -dependent target. - - -DEALING WITH ERRORS IN *.po FILES ---------------------------------- - -Translators sometimes introduce errors in the .po files. What we generally -do is try to fix it if it's an obvious typo, or just revert the change and -go back to the old po file. Reverting is harder now since we are not -storing po files in our repo, but in severe cases we can go and fetch the -last build and pull the affected po file from there and use it to revert the -changes. - -Here's an example of a po file error that will halt a 'make release': - - rm -f af.gmo && /usr/bin/msgfmt -c --statistics -o af.gmo af.po - af.po:7: field `Language-Team' still has initial default value - af.po:1614: number of format specifications in 'msgid' and 'msgstr[1]' does not match - /usr/bin/msgfmt: found 1 fatal error - -In this case, I am going to the last known good af.po. To update Transifex, -I do: - - cp /path/to/last/known/good/af.po po/af.po - touch po/af.po - tx push -t -l af - -The touch is necessary because transifex.net uses timestamps to determine -if it should update its translation data with the po file you are asking -it to use. - - -CREATING A NEW ANACONDA BRANCH ------------------------------- - -When we make a new branch, we need to branch the translation files. - -First you need to populate the project with the initial po files. I suggest -using the ones from the master branch, e.g.: - - git checkout master - git clean -xdf - tx pull -a - # leave the *.po files in the po/ subdirectory - git checkout BRANCH_NAME - -Next you need to update the transifex config with the new branch: - - tx set --execute --auto-local -r anaconda.BRANCH_NAME -s en -t PO \ - -f po/anaconda.pot "po/<lang>.po" - -The last argument is correct as-is, it's not a place where you substitute -something for <lang>. The BRANCH_NAME will be something other than 'master'. -For example, when we branch for F-20: - - tx set --execute --auto-local -r anaconda.f20-branch -s en -t PO \ - -f po/anaconda.pot "po/<lang>.po" - -Check the .tx/config file on the branch to ensure it references the correct -anaconda.BRANCH_NAME in Transifex and remove the [anaconda.master] block so -that it doesn't try to push to master and the new branch. - -Now you can run: - - tx push -s -t - -This will push the po files and anaconda.pot from master to the BRANCH_NAME -resource for anaconda in Transifex. This is just an initial seed that the -translation team can work with. And since we branch from master, the code -should be more or less in sync with the po files at branch time. - -Don't forget to commit the new .tx/config file to the branch. diff --git a/docs/translations.txt b/docs/translations.txt new file mode 100644 index 0000000..50a529d --- /dev/null +++ b/docs/translations.txt @@ -0,0 +1,116 @@ +Translations and anaconda Development +24-Feb-2015 +by: David Cantrell dcantrell@redhat.com + Brian C. Lane bcl@redhat.com +----------------------------------------------------------------------------- + +Anaconda, as of version 23.1, is using https://fedora.zanata.com for +translations. You will need an account in order to pull translations until bug +https://bugzilla.redhat.com/show_bug.cgi?id=1172618 (anonymous pull requests) +has been resolved. + +The zanata-python-client is used by the build scripts, not the full zanata +package. + + +CLIENT SETUP +------------ +Setting up the zanata-python-client on your system for anaconda builds. + +1) Install the zanata-python-client package: + yum install zanata-python-client + +2) Create a Zanata account at https://fedora.zanata.org + NOTE: This system is linked to FAS, but the 'remember my login' option + only appears to work for about an hour, not 7 days as it claims. + +3) Navigate to Dashboard->Settings->Client and click 'Generate New API Key' + +4) Copy the contents of the Configuration text box to ~/.config/zanata.ini + and make sure permissions are 0600. + +Now zanata is set up on your system. The translation files will only be pulled +when a 'make release' is done. The 'make dist' step will just create a tar +file of the what we have in our repo. The 'make bumpver' step will also push a +new anaconda.pot file to Zanata, so any string changes are pushed to them on a +regular basis. + +NOTE: zanata pull is slow. This is why I only added it to the 'make bumpver' +step. + +There are some other procedures related to zanata that will have to be done +when we create new branches or when there are translation errors. + + +MAKING A RELEASE +---------------- + +git clean -d -x -f +./autogen.sh && ./configure --disable-static \ +--enable-introspection --enable-gtk-doc +make bumpver # zanata pull by dependent po-pull target +git commit -a -m "New version." # DO NOT run 'git clean -d -x -f' after +make && make release # signed tag happens after dist now + +The process here is mostly the same. I do not recommend that you run +git clean between 'make bumpver' and 'make release'. The reason is you +will have to run 'zanata pull' again and that's slow, plus translations may +have changed between the two steps. + +The 'make tag' step now runs after 'make dist' in case dist generation +fails. That way you don't end up with a partially created dist AND a +bad tag you have to delete. + +The 'make scratch' and 'make po-empty' targets will now create empty +translation files so that local test builds can be created without needing a +zanata account. + + +DEALING WITH ERRORS IN *.po FILES +--------------------------------- + +Translators sometimes introduce errors in the .po files. What we generally +do is try to fix it if it's an obvious typo, or just revert the change and +go back to the old po file. Reverting is harder now since we are not +storing po files in our repo, but in severe cases we can go and fetch the +last build and pull the affected po file from there and use it to revert the +changes. + +Here's an example of a po file error that will halt a 'make release': + + rm -f af.gmo && /usr/bin/msgfmt -c --statistics -o af.gmo af.po + af.po:7: field `Language-Team' still has initial default value + af.po:1614: number of format specifications in 'msgid' and 'msgstr[1]' does not match + /usr/bin/msgfmt: found 1 fatal error + +In this case, I am going to the last known good af.po. To update Zanata, +I do: + + cp /path/to/last/known/good/af.po po/af.po + zanata push --push-type target --lang af + + +CREATING A NEW ANACONDA BRANCH +------------------------------ + +When we make a new branch, we need to branch the translation files. + +On https://fedora.zanata.com go to the project and version to use as a base. +Select 'New Version+' from the hidden drop down menu on the right. Give it a +name that matches the git branch. eg. f23-branch and select the version to copy +from (usually master). Wait for it to finish processing documents. + +Create a new git branch: + + git checkout master + git clean -xdf + git checkout BRANCH_NAME + +At https://fedora.zanata.com select the new version and then select the +'Download Config file' from the hidden dropdown menu next to 'Settings'. This +will download a new zanata.xml file. Replace the zanata.xml file in the root +directory of anaconda project with this new one. + + git add -u + git commit -m "New Zanata config file" + git push --set-upstream origin BRANCH_NAME
anaconda-patches@lists.fedorahosted.org