diff options
-rwxr-xr-x | astyle/beautify_source_tree | 29 | ||||
-rw-r--r-- | astyle/tde_astylerc | 14 | ||||
-rwxr-xr-x | conversions/tde-l10n/tde-l10n_split_desktop | 3 | ||||
-rwxr-xr-x | create_all_tarballs | 31 | ||||
-rwxr-xr-x | create_tarball | 59 | ||||
-rwxr-xr-x | misc/replace_includehints | 59 | ||||
-rwxr-xr-x | switch_all_submodules_to_head_and_clean | 19 |
7 files changed, 139 insertions, 75 deletions
diff --git a/astyle/beautify_source_tree b/astyle/beautify_source_tree deleted file mode 100755 index 0628a8e..0000000 --- a/astyle/beautify_source_tree +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -if [[ $1 == "" ]]; then - echo "Please specify the source directory to beautify" - exit 1 -fi - -ASTYLEARGS=$( cat <<EOF ---indent=tab \ ---indent-classes \ ---indent-switches \ ---indent-cases \ ---indent-namespaces \ ---indent-labels \ ---indent-col1-comments \ - \ ---unpad-paren \ - \ ---style=java \ ---add-brackets \ ---break-closing-brackets \ ---keep-one-line-statements -EOF -) - -astyle $ASTYLEARGS --recursive $1/*.c || true -astyle $ASTYLEARGS --recursive $1/*.cc || true -astyle $ASTYLEARGS --recursive $1/*.cpp || true -astyle $ASTYLEARGS --recursive $1/*.h || true diff --git a/astyle/tde_astylerc b/astyle/tde_astylerc deleted file mode 100644 index 3eff9ec..0000000 --- a/astyle/tde_astylerc +++ /dev/null @@ -1,14 +0,0 @@ ---indent=tab ---indent-classes ---indent-switches ---indent-cases ---indent-namespaces ---indent-labels ---indent-col1-comments - ---unpad-paren - ---style=java ---add-brackets ---break-closing-brackets ---keep-one-line-statements diff --git a/conversions/tde-l10n/tde-l10n_split_desktop b/conversions/tde-l10n/tde-l10n_split_desktop index aaba8f4..a6dc553 100755 --- a/conversions/tde-l10n/tde-l10n_split_desktop +++ b/conversions/tde-l10n/tde-l10n_split_desktop @@ -116,7 +116,8 @@ done printf "%s" "${DX#|}" | tr "|" "\0" | xargs -r0 \ xgettext --foreign-user --from-code=UTF-8 -Cc -ki18n -o - | \ sed "s|\.tde_l10n||g" | \ -sed "s|Content-Type: text/plain; charset=CHARSET|Content-Type: text/plain; charset=UTF-8|" \ +sed "s|Content-Type: text/plain; charset=CHARSET|Content-Type: text/plain; charset=UTF-8|" | \ +msguniq -o - \ > "$TRANSLATIONS_DIR/$POT" POT_HEADER=$(sed -n "1,/^$/p" "$TRANSLATIONS_DIR/$POT") diff --git a/create_all_tarballs b/create_all_tarballs index 81a7444..7caf7bd 100755 --- a/create_all_tarballs +++ b/create_all_tarballs @@ -16,7 +16,10 @@ TARBALLS_BASE=${TARBALLS_BASE:-} # List of modules to be omitted during creating tarballs. SKIP_MODULES=" -common +common/admin +common/libltdl +common/libtdevnc +common/other defaultsettins experimental infrastructure @@ -67,17 +70,25 @@ cd `git rev-parse --show-toplevel` # Check remote branch branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` if [[ -z "$branch" ]]; then - branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + branch_detached=`git branch --contains HEAD | egrep "^\* \(HEAD detached at" | head -n1 | sed "s|^\* (HEAD detached at \([^)]*\)).*$|\1|"` + branch=`git tag | grep -Fx "${branch_detached}"` +fi +if [[ -z "$branch" ]]; then + branch=`git branch -r --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + branch=${branch#origin/} fi if [[ -z "$branch" ]] || - [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then - echo "There is not active upstream branch. Exiting..." - exit 1 + ( [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]] && + [[ -z "`git tag | grep -Fx \"${branch}\"`" ]] ); then + echo "There is not active upstream branch. Exiting." + exit 1 fi # Set target version if [ -z "$TARGET" ]; then - if [ -f main/core/tdelibs/tdecore/tdeversion.h ]; then + if [ -f main/dependencies/tde-cmake/modules/TDEVersion.cmake ]; then + tdeversionHeader=main/dependencies/tde-cmake/modules/TDEVersion.cmake + elif [ -f main/core/tdelibs/tdecore/tdeversion.h ]; then tdeversionHeader=main/core/tdelibs/tdecore/tdeversion.h elif [ -f main/core/tdelibs/kdecore/kdeversion.h ]; then tdeversionHeader=main/core/tdelibs/kdecore/kdeversion.h @@ -90,7 +101,7 @@ if [ -z "$TARGET" ]; then echo "Cannot find TDE core headers. Exiting." exit 1 fi - TARGET=`sed -n 's|#define [KT]DE_VERSION_STRING "[^0-9]\?\([^ "]*\).*|\1|p' $tdeversionHeader` + TARGET=`sed -n 's/^[ \t]*\(set( DEFAULT_VERSION\|#define [KT]DE_VERSION_STRING\) "[^0-9]\?\([^ ~"]*\).*/\2/p' $tdeversionHeader` fi export TARGET @@ -101,12 +112,18 @@ if [ "$TARGET" != "${TARGET#3.5.}" ]; then else targetBranch=master fi + if [ "$branch" = "v${TARGET}" ]; then + targetBranch=v${TARGET} + fi else if [ "$TARGET" != "${TARGET%.0}" ]; then targetBranch=master else targetBranch=r${TARGET%.*}.x fi + if [ "$branch" = "r${TARGET}" ]; then + targetBranch=r${TARGET} + fi fi if [ "$branch" != "$targetBranch" ]; then echo "Target $TARGET is not valid on $branch branch. Exiting." diff --git a/create_tarball b/create_tarball index 62abb6d..af991b0 100755 --- a/create_tarball +++ b/create_tarball @@ -30,12 +30,18 @@ fi # Check remote branch branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` if [[ -z "$branch" ]]; then - branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + branch_detached=`git branch --contains HEAD | egrep "^\* \(HEAD detached at" | head -n1 | sed "s|^\* (HEAD detached at \([^)]*\)).*$|\1|"` + branch=`git tag | grep -Fx "${branch_detached}"` +fi +if [[ -z "$branch" ]]; then + branch=`git branch -r --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + branch=${branch#origin/} fi if [[ -z "$branch" ]] || - [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then - echo "There is not active upstream branch. Exiting..." - exit 1 + ( [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]] && + [[ -z "`git tag | grep -Fx \"${branch}\"`" ]] ); then + echo "There is not active upstream branch. Exiting." + exit 1 fi # Get submodule name @@ -57,7 +63,9 @@ MODULE=${SUBROOT#$TDEROOT/main/} # Set target version if [ -z "$TARGET" ]; then - if [ -f $TDEROOT/main/core/tdelibs/tdecore/tdeversion.h ]; then + if [ -f $TDEROOT/main/dependencies/tde-cmake/modules/TDEVersion.cmake ]; then + tdeversionHeader=$TDEROOT/main/dependencies/tde-cmake/modules/TDEVersion.cmake + elif [ -f $TDEROOT/main/core/tdelibs/tdecore/tdeversion.h ]; then tdeversionHeader=$TDEROOT/main/core/tdelibs/tdecore/tdeversion.h elif [ -f $TDEROOT/main/core/tdelibs/kdecore/kdeversion.h ]; then tdeversionHeader=$TDEROOT/main/core/tdelibs/kdecore/kdeversion.h @@ -70,7 +78,7 @@ if [ -z "$TARGET" ]; then echo "Cannot find TDE core headers. Exiting." exit 1 fi - TARGET=`sed -n 's|#define [KT]DE_VERSION_STRING "[^0-9]\?\([^ "]*\).*|\1|p' $tdeversionHeader` + TARGET=`sed -n 's/^[ \t]*\(set( DEFAULT_VERSION\|#define [KT]DE_VERSION_STRING\) "[^0-9]\?\([^ ~"]*\).*/\2/p' $tdeversionHeader` fi # Check branch by target @@ -80,12 +88,18 @@ if [ "$TARGET" != "${TARGET#3.5.}" ]; then else targetBranch=master fi + if [ "$branch" = "v${TARGET}" ]; then + targetBranch=v${TARGET} + fi else if [ "$TARGET" != "${TARGET%.0}" ]; then targetBranch=master else targetBranch=r${TARGET%.*}.x fi + if [ "$branch" = "r${TARGET}" ]; then + targetBranch=r${TARGET} + fi fi if [ "$branch" != "$targetBranch" ]; then echo "Target $TARGET is not valid on $branch branch. Exiting." @@ -126,21 +140,26 @@ if [[ -n "$target_tag" ]] && \ fi # Calculate version -tag=`git tag | \ - sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \ - while read t; do \ - git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ - echo "$t..HEAD" && break; done` +if [[ -z "$target_tag" ]]; then + tag=`git tag | \ + sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \ + while read t; do \ + git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ + echo "$t..HEAD" && break; done` +else + tag="$target_tag..HEAD" +fi count=`git log $tag --pretty=oneline | wc -l` +pkgver=$TARGET +if [[ "$count" -gt 0 ]] || [[ -z "$target_tag" ]]; then + pkgver=$pkgver~pre$count+$(git rev-parse HEAD | cut -c 1-8) +fi if [ "$SUFFIX" = "true" ]; then - package=$(basename $PWD)-trinity-$TARGET + package=$(basename $PWD)-trinity-$pkgver else - package=trinity-$(basename $PWD)-$TARGET -fi -if [[ "$count" -gt 0 ]] || [[ -z "$target_tag" ]]; then - package=$package~pre$count+$(git rev-parse HEAD | cut -c 1-8) + package=trinity-$(basename $PWD)-$pkgver fi # Create tarball @@ -149,16 +168,18 @@ if [ ! -e $TARBALL_DIR/$package.tar$TAR_SUFFIX ]; then echo "Creating tarball in $TARBALL_DIR." echo "# TDE SCM module information" > .tdescminfo echo "Name: $MODULE" >> .tdescminfo + echo "Version: R$pkgver" >> .tdescminfo echo "Revision: $branch-$(git rev-parse HEAD)" >> .tdescminfo date +"DateTime: %m/%d/%Y %H:%M" -u -d "@$(git log -1 --pretty=format:"%ct")" >> .tdescminfo trap "rm $TARBALL_DIR/tar-$$; rm .tdescminfo; exit 1" INT - find ./ -print0 | LC_ALL=C sort -z | \ + find ./ | LC_ALL=C sort | \ + egrep -v '(^|/)(\.git|\.gitmodules)(/|$)' | tr "\n" "\0" | \ tar c --no-recursion --null -T - \ --mode=u+rw,go=rX,a-s \ + --owner=root --group=users \ --mtime "@$(git log -1 --pretty=format:"%ct")" \ - --owner=root --group=users --exclude .git --exclude .gitmodules \ --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ - --transform "s|^\.\(/\|$\)|$package\1|" ./ | \ + --transform "s|^\.\(/\|$\)|$package\1|" | \ $COMPRESS -9 >$TARBALL_DIR/tar-$$ && \ mv $TARBALL_DIR/tar-$$ $TARBALL_DIR/$package.tar$TAR_SUFFIX || \ rm $TARBALL_DIR/tar-$$ diff --git a/misc/replace_includehints b/misc/replace_includehints new file mode 100755 index 0000000..edccc89 --- /dev/null +++ b/misc/replace_includehints @@ -0,0 +1,59 @@ +#!/bin/bash +# +# This script replaces <includehints> in TQt designer UI files +# with global <include>'s, removing duplicate includes. +# +# The reasons for this is that includehints are not well supported +# and can cause FTBFS. +# +# Copyright (C) 2022 Mavridis Philippe <mavridisf@gmail.com> +# for the Trinity Desktop Project +# +# Licensed under GNU GPLv2 or later. +# + +# Find files needing update +TO_REPLACE=$(find * -name \*.ui -exec grep -l includehint '{}' \;) + +if [[ ${#TO_REPLACE} == 0 ]] +then + echo "No files need to be modified." + exit 0 +fi + +echo "Files that will be modified:" +for f in $TO_REPLACE +do + echo " - $f" +done + +echo +echo "Press any key to continue to ^C to cancel." +read + +# Start replacing +declare -a headers +for f in $TO_REPLACE +do + echo "Updating file '$f'..." + + # Replace containing tag + sed -Ei 's!<(\/?)includehints>!<\1includes>!g' $f + + # Replace includes themselves while avoiding duplicates (a simple + # sed -Ei 's/<includehint>([[:alnum:]\/.]*)</includehint>/<include location="global" impldecl="in implementation">\1</include>/g' $f + # would leave duplicates behind). + headers=() + for h in $(grep -o "<includehint>[[:alnum:]\/.]*</includehint>" $f | sed -E 's/<\/?includehint>//g') + do + if [[ ! "${headers[*]}" =~ $h ]] # if this is a unique header + then + echo " - $h" + sed -i "0,/<includehint>$h<\/includehint>/{s//<include location=\"global\" impldecl=\"in implementation\">$h<\/include>/}" $f + headers+=($h) + fi + done + + # Remove leftover duplicate includehints + sed -Ei '/<includehint>([[:alnum:]\/.]*)<\/includehint>/d' $f +done diff --git a/switch_all_submodules_to_head_and_clean b/switch_all_submodules_to_head_and_clean index 2c136fd..661ff8d 100755 --- a/switch_all_submodules_to_head_and_clean +++ b/switch_all_submodules_to_head_and_clean @@ -33,7 +33,7 @@ if [[ -z "$remote" ]]; then fi # get git user -echobd "Preparing $(git rev-parse --show-toplevel | xargs -r basename) $branch branch for development use" +echobd "Preparing $(git rev-parse --show-toplevel | xargs -r basename) on $branch branch for development use" if [[ $1 == "" ]]; then gituser=`git config --local remote.$remote.url | sed -n "s|\(https\?://\)\?\([^@]*\)@.*|\2|p" | grep -v "\(anonymous\|system\)"` else @@ -48,6 +48,10 @@ if [[ $gituser == "" ]]; then gituser="anonymous" fi +if [[ -n "$(git config --get user.signingkey)" ]]; then + GIT_SIGN="-S" +fi + # check git abilities if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then GIT_IGNORE_SUBMODULES="--ignore-submodules" @@ -76,9 +80,13 @@ updateModule() { fi git remote | while read REMOTE; do - REPO_SERVER=$(git config remote."$REMOTE".url | + REPO_URL=$(git config remote."$REMOTE".url) + REPO_SERVER=$(echo "$REPO_URL" | sed -n "s|^http[^/]*/*\([^@]*@\)\?\([^/]*\)/.*|\2|p") - if [ -x /usr/bin/fping ] && [ -n "$REPO_SERVER" ]; then + if [ -x /usr/bin/curl ] && [ "${REPO_URL}" != "${REPO_URL#http}" ]; then + curl --silent --connect-timeout 10 --max-time 15 --location --netrc \ + $REPO_URL/info/refs?service=git-upload-pack >/dev/null || continue + elif [ -x /usr/bin/fping ] && [ -n "$REPO_SERVER" ]; then fping -q -r1 "$REPO_SERVER" || continue fi echo Fetching $REMOTE @@ -88,7 +96,7 @@ updateModule() { git checkout $branch remote=`git config branch."$branch".remote` [[ -n "$remote" ]] || return - git rebase $remote/$branch $branch + git rebase $GIT_SIGN $remote/$branch $branch if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then git reset --hard HEAD git clean -dxff @@ -135,8 +143,9 @@ updateModule() { cd $REPO_LOCALTREE && git fetch && git worktree prune && - git worktree add $PARENTDIR/$MODULE$submodule $branch && + git worktree add $PARENTDIR/$MODULE$submodule origin/$branch && cd $PARENTDIR/$MODULE$submodule && + git checkout $branch && git branch --set-upstream-to=origin/$branch ) || continue fi |