diff --git a/create_sources_inc b/create_sources_inc index 56e3142..45948e3 100755 --- a/create_sources_inc +++ b/create_sources_inc @@ -1,43 +1,42 @@ #!/bin/bash . version process_folder() { for i in $1/*.tar.xz; do filename=`basename $i` echo '' l=`echo $filename | sed -e "s#.tar.xz##"` - echo ' '$l'' + echo ' '$l'' size=`stat -c "%s" $i` size=`echo "$size / 1024" | bc` if test "$size" -lt 1024; then size="$size"kB else size=`echo "($size * 10) / 1024" | bc` if test "$size" -lt 100; then size=`echo "$size"MB | sed -e "s#\(.\)MB#.\1MB#"` else size=`echo "$size"MB | sed -e "s#\(.\)MB#MB#"` fi fi echo ' '$size'' sha1=`sha1sum $i | cut -f1 -d' '` echo ' '$sha1'' echo '' echo '' done } echo '' echo '' echo ' ' echo ' ' echo ' ' echo '' process_folder "sources" "src" -process_folder "sources/kde-l10n" "src/kde-l10n" echo '
LocationSizeSha1 Sum
' diff --git a/pack.sh b/pack.sh index 66ac497..96508cd 100755 --- a/pack.sh +++ b/pack.sh @@ -1,87 +1,87 @@ #!/bin/bash . utils.sh . config repo_to_pack=$1 force=$2 if [ -z "$repo_to_pack" ]; then echo "No repo given" exit fi unset CDPATH mkdir -p sources mkdir -p versions function determineVersion() { . version versionFilePath=$PWD/versions/$repo_to_pack tarFile=$repo_to_pack-$version.tar.xz echo $tarFile } cat modules.git | while read repo branch; do if [ "$repo_to_pack" = "$repo" ]; then repoLine="$repo $branch" determineVersion - checkDownloadUptodate "git" "sources/$tarFile" + checkDownloadUptodate "sources/$tarFile" uptodate=$? if [ $uptodate = 1 ]; then echo "$repo is already up to date, no need to re-download. Use -f as second parameter if you want to force" break; fi checkout=1 echo "$repoLine" echo "$repoLine" > $versionFilePath while [ $checkout -eq 1 ]; do rev=`get_git_rev` basename=$repo-$version cd sources git archive --remote=kde:$repo $branch --prefix $basename/ | tar x errorcode=$PIPESTATUS # grab error code from git archive if [ $errorcode -eq 0 ]; then rev2=`get_git_rev` if [ $rev = $rev2 ]; then checkout=0 # Only for frameworks: grab translations and put them into the tarball if [ -f "$basename/$repo.yaml" ]; then grabTranslations "$basename" "$repo" fi if [ "$repo" != "kde-runtime" ] && [ "$repo" != "kdelibs" ]; then # kde-runtime, kdelibs, umbrello are Qt4-only and special, exclude them. setupGUITranslations "$basename" "$l10n_basedir5" "$repo" "../language_list" setupDOCTranslations "$basename" "$l10n_basedir5" "$repo" "../language_list" setupDataTranslations "$basename" "$l10n_basedir5" "$repo" "../language_list" fi tar c --owner 0 --group 0 --numeric-owner $basename | xz -9 > $tarFile if [ $make_zip -eq 1 ]; then zip -r $basename.zip $basename || exit 1 fi else # someone made a change meanwhile, retry rm -f $tarFile fi rm -rf $basename else echo "git archive --remote=kde:$repo $branch --prefix $basename/ failed with error code $errorcode" fi cd .. done echo "$rev" echo "$rev" >> $versionFilePath sha256sum sources/$tarFile >> $versionFilePath rm -f sources/$tarFile.sig gpg2 --digest-algo SHA512 --armor --detach-sign -o sources/$tarFile.sig -s sources/$tarFile fi done diff --git a/tag_all.sh b/tag_all.sh index f35235f..5614cf3 100755 --- a/tag_all.sh +++ b/tag_all.sh @@ -1,68 +1,67 @@ #!/bin/bash unset CDPATH here=$PWD # We look for the checkouts in subdirs (frameworks/, kdesupport/) of $srcdir # TODO: adapt this for KDE SC releases srcdir=/d/kde/src/5 if [ ! -d $srcdir ]; then echo "$srcdir does not exist, please fix srcdir variable" exit fi cat $here/modules.git | while read repo branch; do cd $srcdir || exit 1 echo $repo . $here/version tagname=v$version versionfile=$here/versions/$repo if [ ! -f $versionfile ]; then echo "$versionfile not found"; exit 1; fi b=`sed '2q;d' $versionfile` echo $b if [ -d frameworks/$repo ]; then cd frameworks/$repo elif [ -d kdesupport/$repo ]; then cd kdesupport/$repo || exit 2 elif [ -d $repo ]; then cd $repo || exit 2 else echo "NOT FOUND: $repo" exit 3 fi echo $PWD git fetch || exit 2 git tag -a $tagname $b -m "Create tag for $version" || exit 4 git push --tags || exit 5 done . $here/version svn mkdir svn+ssh://svn@svn.kde.org/home/kde/tags/Applications/$version -m "Create tag for $version" || exit 7 . $here/config if [ "$release_l10n_separately" = 1 ]; then l10n_repo=`echo $l10n_repo | sed 's#svn://anonsvn.kde.org#svn+ssh://svn@svn.kde.org#g'` svn mkdir svn+ssh://svn@svn.kde.org/home/kde/tags/Applications/$version/kde-l10n -m "Create tag for $version" || exit 9 - svn mkdir svn+ssh://svn@svn.kde.org/home/kde/tags/Applications/$version/kde-l10n/4 -m "Create tag for $version" || exit 9 svn mkdir svn+ssh://svn@svn.kde.org/home/kde/tags/Applications/$version/kde-l10n/5 -m "Create tag for $version" || exit 9 for lang in `cat language_list`; do echo $lang . $here/version versionfile=$here/versions/kde-l10n-$lang if [ ! -f $versionfile ]; then echo "$versionfile not found"; exit 10; fi b=`sed '2q;d' $versionfile` echo $b branch=`echo $l10n_repo5 | sed 's#svn://anonsvn.kde.org#svn+ssh://svn@svn.kde.org#g'` echo $branch svn cp --parents $branch/$lang@$b svn+ssh://svn@svn.kde.org/home/kde/tags/Applications/$version/kde-l10n/5 -m "Create tag for $version" || exit 11 variants=`svn cat svn+ssh://svn@svn.kde.org/home/kde/tags/Applications/$version/kde-l10n/5/$lang/pack-with-variants 2> /dev/null` || variants="" for variant in $variants; do echo $variant svn cp $branch/$variant@$b svn+ssh://svn@svn.kde.org/home/kde/tags/Applications/$version/kde-l10n/5 -m "Create tag for $version" || exit 12 done done fi diff --git a/update_l10n.sh b/update_l10n.sh index 259084e..56f8740 100755 --- a/update_l10n.sh +++ b/update_l10n.sh @@ -1,36 +1,46 @@ #!/bin/bash # Make a local checkout of l10n-something/* into a local dir +. utils.sh . config unset CDPATH function update_or_create_l10n_checkout() { local l10n_repo=$1 local l10n_local_dir=$2 if test -d $l10n_local_dir; then # Update existing checkout for dir in $l10n_local_dir/*; do - ( cd $dir ; svn update ) + svn update $dir@ + + rev=`get_svn_rev $dir@` + lang=`basename $dir` + echo $lang > versions/kde-l10n-$lang + echo $rev >> versions/kde-l10n-$lang done else # Make new checkout languages=`svn cat $l10n_repo/subdirs` for lang in $languages; do mkdir -p $l10n_local_dir/$lang # final @ required to handle languages like ca@valencia svn co $l10n_repo/$lang@ $l10n_local_dir/$lang + + rev=`get_svn_rev $l10n_local_dir/$lang@` + echo $lang > versions/kde-l10n-$lang + echo $rev >> versions/kde-l10n-$lang done fi } - +mkdir -p versions update_or_create_l10n_checkout $l10n_repo5 $l10n_basedir5 diff --git a/utils.sh b/utils.sh index 0a6154d..546f9a0 100644 --- a/utils.sh +++ b/utils.sh @@ -1,265 +1,257 @@ #!/bin/bash function get_git_rev() { echo `git ls-remote kde:$repo $branch | cut -f 1` } function get_svn_rev() { - echo `svn info $branch/$repo | grep "Last Changed Rev: " | cut -f 4 -d ' '` + echo `svn info $1 | grep "Last Changed Rev: " | cut -f 4 -d ' '` } function checkDownloadUptodate() { - local isGit="true" - if [ "$1" = "svn" ]; then - isGit="false" - fi - local finalDestination=$2 + local finalDestination=$1 local result=0 if [ "x$force" != "x-f" ]; then if [ -f $finalDestination ]; then if [ -f $versionFilePath ]; then fileRepoLine=`sed -n '1p' < $versionFilePath` if [ "$repoLine" = "$fileRepoLine" ]; then - if [ $isGit = "true" ]; then - rev=`get_git_rev` - else - rev=`get_svn_rev` - fi + rev=`get_git_rev` fileRev=`sed -n '2p' < $versionFilePath` if [ "$rev" = "$fileRev" ]; then fileSha=`sed -n '3p' < $versionFilePath` realFileSha=`sha256sum $finalDestination` if [ "$fileSha" = "$realFileSha" ]; then result=1 fi fi fi fi fi fi return $result } function no_macros_injection() { # return true if the module is in the exclude list, which mean # that it already calls the macros which deploy the translations. local searched_module="$1" grep -q "^${searched_module}$" ../no_lang_macros.txt return $? } function grabTranslations() { local basename=$1 mkdir $basename/po local repo=$2 local subdir for subdir in ../l10n/*; do local podir=$subdir/messages/$l10n_module if test -d $podir; then local lang=`basename $subdir` cp $podir/${repo}5.po $basename/po/$lang.po 2>/dev/null cp $podir/${repo}5_*.po $basename/po/$lang.po 2>/dev/null fi done } function getTranslationFileList() { local basedir="$1" local po_list="" # grab the generated pot files (including also temporary ones, but # they should not matter) for the module po_list=$(find $basedir -name 'Messages.sh' | while read messagefile; do cat $messagefile | grep 'podir.*\.pot[[:space:]]*\\\?$' | sed 's,.\+podir.*\/\(.\+\.po\)t[[:space:]]*\\\?$,\1,' | sort -f | uniq done) echo $po_list } function setupGUITranslations() { local basedir="$1" local basel10n="$2" local module="$3" local language_list="$4" local found_qm=0 local found_po=0 MATCH_QM='^.*_qt.po$' all_po_files=$(getTranslationFileList "${basedir}") while read lang; do for po_file in ${all_po_files}; do po_location=$(find "${basel10n}/${lang}/messages/" -name "${po_file}") if [ -z "${po_location}" ]; then continue fi if [[ "${po_file}" =~ ${MATCH_QM} ]]; then # files like *_qt.po are QM in disguise destdir=${basedir}/poqm/${lang} found_qm=1 else destdir=${basedir}/po/${lang} found_po=1 fi mkdir -p "${destdir}" cp -f "${po_location}" "${destdir}" done done < <(cat "${language_list}") if no_macros_injection "${module}"; then # the functions have been added to the source code found_qm=0 found_po=0 fi if [ ${found_qm} -eq 1 ]; then echo "ecm_install_po_files_as_qm(poqm)" >>${basedir}/CMakeLists.txt fi if [ ${found_po} -eq 1 ]; then # special cases: # - ktp-desktop-applets since it doesn't "need" k18n since it's all qml # but has po files to install so needs ki18n for ki18n_install # - kajongg has its own implementation if KI18n, waiting for the # proper binding if [ "${module}" = "ktp-desktop-applets" ] || [ "${module}" = "kajongg" ]; then echo "find_package(KF5 REQUIRED COMPONENTS I18n)" >>${basedir}/CMakeLists.txt fi echo "ki18n_install(po)" >>${basedir}/CMakeLists.txt fi } function setupDOCTranslations() { local basedir="$1" local basel10n="$2" local module="$3" local language_list="$4" local doc_dirs="" local man_files="" #echo "DIR SCRIPT: $(readlink -f $0) - $(dirname $(readlink -f $0))" all_doc_dirs=$(find ${basedir} -name CMakeLists.txt | \ xargs -n1 awk -f ../list_doc_subdirs.awk | sort -f) all_man_files=$(grep -ir kdoctools_create_manpage ${basedir} | \ sed 's/.*kdoctools_create_manpage(\(man-.\+\.docbook\) .\+$/\1/' | sort -f) # exception (difficult to handle in the regular way) if [ "${module}" = "kwave" ]; then all_doc_dirs="kwave" fi local translated_doc_found=0 while read lang; do # set -x local lang_doc_dir="${basel10n}/${lang}/docs" if [ ! -d "${lang_doc_dir}" ]; then continue fi local all_lang_docs=$(cd "${lang_doc_dir}/"; find . -type d) for doc_dir in ${all_doc_dirs}; do local doc_dir_found=$(echo "${all_lang_docs}" | grep -w "${doc_dir}") # exceptions (difficult to generalize) if [ "${doc_dir}" == "khelpcenter/glossary" ]; then doc_dir_found="./applications/glossary" fi if [ -n "${doc_dir_found}" ]; then # is the directory empty? If it is, skip it local is_doc_empty=$(find "${lang_doc_dir}/${doc_dir_found}" -maxdepth 0 -type d -empty 2>/dev/null) if [ -z "${is_doc_empty}" ]; then local dest_dir="${basedir}/po/${lang}/docs/${doc_dir}" mkdir -p "${dest_dir}" cp -r "${lang_doc_dir}/${doc_dir_found}/"* "${dest_dir}" translated_doc_found=1 fi fi done for man_file in ${all_man_files}; do man_file_found=$(cd "${lang_doc_dir}"; find . -name "${man_file}") local dest_dir="${basedir}/po/${lang}/docs" if [ -n "${man_file_found}" ]; then mkdir -p "${dest_dir}" cp -r "${lang_doc_dir}/${man_file_found}" "${dest_dir}" translated_doc_found=1 fi done # set +x done < <(cat "${language_list}") if no_macros_injection "${module}"; then # the function has been added to the source code translated_doc_found=0 fi if [ ${translated_doc_found} -eq 1 ]; then local main_cmakelists="${basedir}/CMakeLists.txt" echo -e "if (KF5DocTools_FOUND)\n kdoctools_install(po)\nendif()" >>${main_cmakelists} fi } function copyDataArtifacts() { # Copy the element of a special directory with translated # artifacts (data or scripts) # It is an helper function for setupDataTranslations() local basedir="$1" local basel10n="$2" local module="$3" local lang="$4" local artifacts_dir="$5" local out_dest_dir_var="$6" local lang_artifacts_dir="${basel10n}/${lang}/${artifacts_dir}" [ -d "${lang_artifacts_dir}" ] || return 1 # assume that ${module} is unique local artifacts_dir_full=$(cd "${lang_artifacts_dir}/"; find . -type d -name "${module}" | head -n 1) [ -n "${artifacts_dir_full}" ] || return 1 local artifacts_dir_base=$(basename ${artifacts_dir_full}) local relative_dest_dir="${lang}/${artifacts_dir}/${artifacts_dir_base}" local dest_dir="${basedir}/po/${relative_dest_dir}" if [ ! -d "${dest_dir}" ]; then mkdir -p "${dest_dir}" fi cp -r "${lang_artifacts_dir}/${artifacts_dir_full}/"* "${dest_dir}" eval ${out_dest_dir_var}="${relative_dest_dir}" return 0 } function setupDataTranslations() { # Takes care of both data/ and scripts/ local basedir="$1" local basel10n="$2" local module="$3" local language_list="$4" local rel_dest_dir="" while read lang; do # process the data/ directories (and cmake_modules, if available) if copyDataArtifacts "${basedir}" "${basel10n}" "${module}" "${lang}" \ "data" "rel_dest_dir"; then echo "add_subdirectory(${rel_dest_dir})" >>"${basedir}/po/CMakeLists.txt" # copy the content of cmake_modules is available local cmake_modules_dir="${basel10n}/${lang}/cmake_modules" if [ -d "${cmake_modules_dir}" ]; then local cmake_dest_dir="${basedir}/po/cmake_modules" mkdir -p "${cmake_dest_dir}" cp -r "${cmake_modules_dir}/"* "${cmake_dest_dir}" fi fi # process the scripts/ directories (and cmake_modules, if available) # WARNING: this requires KI18n <=5.33 or >=5.36, or with the # fix which restores ki18n_install_ts_files if copyDataArtifacts "${basedir}" "${basel10n}" "${module}" "${lang}" \ "scripts" "rel_dest_dir"; then echo "ki18n_install_ts_files(${lang} ${rel_dest_dir})" >>"${basedir}/po/CMakeLists.txt" fi done < <(cat "${language_list}") if [ -e "${basedir}/po/CMakeLists.txt" ]; then echo -e "include(ECMOptionalAddSubdirectory)\necm_optional_add_subdirectory(po)" >>${basedir}/CMakeLists.txt fi }