summaryrefslogtreecommitdiffstats
path: root/packaging/prep-auto-dir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 16:14:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 16:14:31 +0000
commit2d5707c7479eacb3b1ad98e01b53f56a88f8fb78 (patch)
treed9c334e83692851c02e3e1b8e65570c97bc82481 /packaging/prep-auto-dir
parentInitial commit. (diff)
downloadrsync-2d5707c7479eacb3b1ad98e01b53f56a88f8fb78.tar.xz
rsync-2d5707c7479eacb3b1ad98e01b53f56a88f8fb78.zip
Adding upstream version 3.2.7.upstream/3.2.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/prep-auto-dir')
-rwxr-xr-xpackaging/prep-auto-dir43
1 files changed, 43 insertions, 0 deletions
diff --git a/packaging/prep-auto-dir b/packaging/prep-auto-dir
new file mode 100755
index 0000000..b67f390
--- /dev/null
+++ b/packaging/prep-auto-dir
@@ -0,0 +1,43 @@
+#!/bin/sh -e
+
+# This script will setup the build dir based on the current git branch and the
+# directory auto-build-save/$BRANCH. We don't use a symlink for the build dir
+# because we want to maximize the ccache reuse, so all builds must happen in
+# the same real dir. When a dir is moved out of auto-build-save/$BRANCH to the
+# build dir, it is replaced with a symlink so that it can still be found under
+# that dir. The build dir also gets a .branch -> $BRANCH symlink so that we
+# can figure out the current build dir's branch.
+
+# To get started, just clone the rsync git repo and create the auto-build-save
+# dir. If you have an existing git checkout and it is not in a pristine state,
+# run "make distclean" before creating the auto-build-save dir.
+
+auto_top='auto-build-save'
+if test -d $auto_top && test -d .git; then
+ desired_branch=`git rev-parse --abbrev-ref HEAD | tr / %`
+ if test "$desired_branch" = HEAD; then
+ echo "ERROR: switch to the right build dir manually when in detached HEAD mode." 1>&2
+ exit 1
+ fi
+ auto_dir="$auto_top/$desired_branch"
+ if test -d build; then
+ cur_branch=`readlink build/.branch`
+ else
+ cur_branch='/'
+ fi
+ if test "$desired_branch" != "$cur_branch"; then
+ if test "$cur_branch" != /; then
+ rm -f "$auto_top/$cur_branch"
+ mv build "$auto_top/$cur_branch"
+ fi
+ test -d "$auto_dir" || mkdir "$auto_dir"
+ test -h "$auto_dir/.branch" || ln -s "$desired_branch" "$auto_dir/.branch"
+ mv "$auto_dir" build
+ ln -s ../build "$auto_dir"
+ fi
+ if test ! -h Makefile; then
+ rm -f Makefile
+ ln -s packaging/auto-Makefile Makefile
+ fi
+ echo $desired_branch
+fi