diff --git a/make_rc_tag.sh b/make_rc_tag.sh index 3b4284f..920c2d3 100755 --- a/make_rc_tag.sh +++ b/make_rc_tag.sh @@ -1,158 +1,158 @@ #!/bin/bash logfile=logs/$0.log exec > >(tee -a $logfile) exec 2> >(tee -a $logfile >&2) . utils.sh repo_to_pack=$1 if [ "$release_l10n_separately" = "1" ]; then echo "Only makes sense with bundled translations" exit fi if ! command -v msgattrib >/dev/null ; then echo "msgattrib not found, install the gettext package" exit 1 fi # Usage: grabTranslations $repoid $branch $l10n # Copy .po files from $l10n (full path) into $repoid (branch $branch) and git add them into local_release function grabTranslations() { local repoid=$1 local branch=$2 local l10n=$3 mkdir -p po # Copy po files and translated docbooks has_po=0 local subdir for subdir in $l10n/*; do local lang=`basename $subdir` if [ "$lang" = "x-test" ]; then continue fi local destdir=$checkout/po/$lang $cmd rm -rf $destdir/docs local podir=$subdir/messages/$repoid if test -d $podir; then local hasdestdir=0; test -d $destdir && hasdestdir=1 || mkdir -p $destdir cp -r ${podir}/* $destdir find -regextype egrep -regex '.*\.(_desktop_|_json_|appdata|metainfo)\.po' -delete if [ $(find $destdir -name "*.po" | wc -l) -gt 0 ]; then has_po=1 fi if [ "$has_po" -eq 1 ]; then # Copy kf5_entry.desktop into kconfigwidgets if [ ${repoid} = "kconfigwidgets" ]; then local entryfile=$podir/kf5_entry.desktop if [ -f $entryfile ]; then $cmd cp -f $entryfile $destdir fi fi # Copy the scripts subdir local scriptdir=$subdir/scripts/$repoid $cmd rm -rf $destdir/scripts - if test -d $scriptdir/$repoid; then + if test -d $scriptdir; then $cmd test -d $destdir/scripts || $cmd mkdir $destdir/scripts - $cmd cp -rf $scriptdir/$repoid/* $destdir/scripts/ 2>/dev/null + $cmd cp -rf $scriptdir/* $destdir/scripts/ 2>/dev/null fi elif [ $hasdestdir -eq 0 ]; then $cmd rm -r $destdir fi fi # We look at the sources to copy the translated docbooks if available local destsubdir="$destdir/docs" local docdir=$subdir/docs/$repoid if [ -d "$docdir" ]; then $cmd mkdir -p $destsubdir $cmd cp -a $docdir/* $destsubdir if [ $(find $destsubdir -name "*.docbook" | wc -l) -gt 0 ]; then has_po=1 fi fi done if [ $has_po -eq 1 ]; then # Strip unused strings, to keep things small cd po for f in */*.po ; do msgattrib --output-file=$f --no-obsolete $f ; done cd .. $cmd git add po $cmd git commit po -m "GIT_SILENT Commit translations from `basename $repoid`" fi if [ `ls po | wc -l` -eq 0 ]; then $cmd rm -r po ; fi } cat modules.git | while read repoid branch; do if [ -z "$repo_to_pack" -o "$repo_to_pack" = "$repoid" ]; then echo $repoid . version basename=$repoid-$version oldpwd=$PWD # Go to the local checkout, ensure clean, update checkout=$(findCheckout $repoid) test -d $checkout || exit 1 cd $checkout status=`git status --porcelain --untracked-files=no` if [ -n "$status" ]; then echo "$checkout doesn't seem clean:" echo "$status" exit 2 fi basetag="v$version-rc" # This check so that running make_rc_tag.sh twice (because of flaky wifi) doesn't create a rc2 everywhere # Passing an explicit repo name forces a retag if [ -n "`git tag -l ${basetag}1`" -a -z "$repo_to_pack" ]; then # make sure the tag was pushed git push origin tag ${basetag}1 cd $oldpwd continue; fi git checkout $branch || exit 2 git pull || exit 3 # Always make a local_release branch, even if we have no translations to commit. # It's also useful for updating tarballs with a cherry-pick. $cmd git branch -D local_release 2>/dev/null $cmd git checkout -b local_release grabTranslations "$repoid" "$branch" "$oldpwd/l10n" tagModule "$repoid" "$basetag" $cmd git checkout $branch cd $oldpwd fi done if [ -z "$repo_to_pack" ]; then if [ `wc -l modules.git | cut -f1 -d' '` -ne `wc -l tags.git | cut -f1 -d' '` ]; then echo "ERROR: only `wc -l tags.git` entries in tags.git, while modules.git has `wc -l modules.git`" gawk '{print $1}' tags.git > /tmp/t gawk '{print $1}' modules.git > /tmp/m diff /tmp/t /tmp/m fi fi