Allow git-version.h to be provided for the build

For a non-git build or for a git build w/o adequate git history, we now
allow the git-version.h file to be provided before the build.  If the
file does not exist, we either create an empty file or put a define of
RSYNC_GITVER in it based on the output of git describe.  The github
builds now snag the git-version.h file that was generated for the last
commit so that they all get the same version string, even with a shallow
checkout.
This commit is contained in:
Wayne Davison committed 2020-09-06 23:09:11 -07:00
1 parent 9f9240b661
commit ee75e51f2f
5 files changed
+23 -14

No files matched your search

+2 -1
View File
@@ -7,7 +7,8 @@ freebsd_task:
prep_script:
- dd if=/dev/zero of=/tmp/zpool bs=1M count=1024
- zpool create -m `pwd`/testtmp zpool /tmp/zpool
- pkg install -y autotools xxhash zstd liblz4
- pkg install -y autotools xxhash zstd liblz4 wget
- wget https://download.samba.org/pub/rsync/generated-files/git-version.h
configure_script:
- CPPFLAGS=-I/usr/local/include/ LDFLAGS=-L/usr/local/lib/ ./configure --disable-md2man
make_script:
+6 -5
View File
@@ -16,11 +16,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: prep
run: |
sudo apt-get install acl libacl1-dev attr libattr1-dev liblz4-dev libzstd-dev libxxhash-dev python3-cmarkgfm openssl
sudo apt-get install acl libacl1-dev attr libattr1-dev liblz4-dev libzstd-dev libxxhash-dev python3-cmarkgfm openssl wget
wget https://download.samba.org/pub/rsync/generated-files/git-version.h
echo "::add-path::/usr/local/bin"
- name: configure
run: ./configure
@@ -55,8 +54,9 @@ jobs:
- uses: actions/checkout@v2
- name: prep
run: |
brew install automake openssl xxhash zstd lz4
brew install automake openssl xxhash zstd lz4 wget
sudo pip3 install commonmark
wget https://download.samba.org/pub/rsync/generated-files/git-version.h
echo "::add-path::/usr/local/bin"
- name: configure
run: CPPFLAGS=-I/usr/local/opt/openssl/include/ LDFLAGS=-L/usr/local/opt/openssl/lib/ ./configure
@@ -91,7 +91,8 @@ jobs:
args: install -y --no-progress cygwin cyg-get
- name: prep
run: |
cyg-get make autoconf automake gcc-core attr libattr-devel python3 python36-commonmark libzstd-devel liblz4-devel libssl-devel
cyg-get make autoconf automake gcc-core attr libattr-devel python3 python36-commonmark libzstd-devel liblz4-devel libssl-devel wget
wget https://download.samba.org/pub/rsync/generated-files/git-version.h
echo "::add-path::C:/tools/cygwin/bin"
- name: configure
run: bash -c './configure --disable-xxhash'
+2 -2
View File
@@ -32,7 +32,7 @@ SHELL=/bin/sh
SIMD_x86_64=simd-checksum-x86_64.o
ASM_x86_64=lib/md5-asm-x86_64.o
GENFILES=configure.sh aclocal.m4 config.h.in rsync.1 rsync.1.html \
GENFILES=configure.sh aclocal.m4 config.h.in git-version.h rsync.1 rsync.1.html \
rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html
HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
lib/pool_alloc.h lib/mdigest.h lib/md-defines.h
@@ -254,7 +254,7 @@ rsyncd.conf.5: rsyncd.conf.5.md md2man version.h Makefile
.PHONY: clean
clean: cleantests
rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
rounding rounding.h *.old rsync*.1 rsync*.5 rsync*.html \
git-version.h rounding rounding.h *.old rsync*.1 rsync*.5 rsync*.html \
daemon-parm.h help-*.h default-*.h proto.h proto.h-tstamp
.PHONY: cleantests
+9 -6
View File
@@ -3,9 +3,12 @@
srcdir=`dirname $0`
gitver=`git describe --abbrev=8 2>/dev/null`
if test x"$gitver" != x; then
gitver=\""$gitver"\"
else
gitver=RSYNC_VERSION
fi
echo "#define RSYNC_GITVER $gitver" >git-version.h
case "$gitver" in
*.*)
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h
;;
*)
# We either create an empty file or update the time on what the user gave us.
touch git-version.h
;;
esac
+4
View File
@@ -253,7 +253,11 @@ void daemon_usage(enum logcode F)
const char *rsync_version(void)
{
#ifdef RSYNC_GITVER
return RSYNC_GITVER;
#else
return RSYNC_VERSION;
#endif
}
const char *default_cvsignore(void)