forked from osmocom/wireshark
packaging: Provide workaround for rpm-package from source tarball
Users might want to download a source tarball and build an RPM package from it. Have git-export-release.sh use git-archive's 'export-subst' feature so that it can detect whether it is being run from a git repository versus run from source extracted from a tarball produced by git-archive. In the latter case, produce a helpful console message telling the user to copy the downloaded tarball into the binary directory so that the rpm-package target can succeed. Also update the Developer's Guide to suggest this as well. We could try to create our own archive using tar, but there are several possible gotchas, such as in-source builds, excluding a build directory that is a subdirectory of the source dir, excluding unknown different build directories from previous builds, dealing with different options in different versions of tar, etc. This is good enough for the common case, and anyone who wants something more complicated can hopefully create their own tarball. Fix #15167pespin/osmux-wip
parent
5a48815fb4
commit
81c67b3e05
|
@ -6,3 +6,4 @@
|
|||
.gitignore export-ignore
|
||||
.gitreview export-ignore
|
||||
tools/make-version.pl export-subst
|
||||
packaging/source/git-export-release.sh.in export-subst
|
||||
|
|
|
@ -940,9 +940,12 @@ to build the Debian Package.
|
|||
|
||||
==== Red Hat: .rpm Packages
|
||||
|
||||
You can build an RPM package using the `rpm-package` target. The package
|
||||
version is derived from the current git HEAD, so you must build from a
|
||||
git checkout.
|
||||
You can build an RPM package using the `rpm-package` target. If you
|
||||
are building from a git checkout, the package version is derived from
|
||||
the current git HEAD. If you are building from source extracted from a
|
||||
tarball created with `git archive` (such as those downloaded from
|
||||
http://www.wireshark.org/download.html), you must place the original
|
||||
tarball into your build directory.
|
||||
|
||||
The package is built using https://rpm.org/[rpmbuild], which comes as
|
||||
standard on many flavours of Linux, including Red Hat, Fedora, and
|
||||
|
|
|
@ -41,6 +41,37 @@ fi
|
|||
|
||||
TARBALL="${DESTDIR}/wireshark-${VERSION}.tar.xz"
|
||||
|
||||
# A tarball produced by 'git archive' will have the $Format string
|
||||
# substituted due to the use of 'export-subst' in .gitattributes.
|
||||
# shellcheck disable=SC2016
|
||||
COMMIT='$Format:%H$'
|
||||
|
||||
if [[ $COMMIT != \$F* ]] ; then
|
||||
# This file was extracted from a tarball produced by git archive
|
||||
# and so we are not in a git repository.
|
||||
if [[ -f "$TARBALL" ]] ; then
|
||||
# git get-tar-commit-id works outside a git repo, as it
|
||||
# only reads the first 1024 bytes of the tar extended header.
|
||||
if [[ $(git get-tar-commit-id < <(xzcat "$TARBALL")) == "$COMMIT" ]] ; then
|
||||
echo "$TARBALL commit ID matches $COMMIT."
|
||||
else
|
||||
# Allow people to make changes to a downloaded source tarball
|
||||
# and re-tar it?
|
||||
echo "WARNING: $TARBALL is not the original git archive."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "The build system cannot produce a source tarball outside of a git repository."
|
||||
echo "If you are trying to build an RPM package from source extracted from a tarball,"
|
||||
echo "copy it (i.e., wireshark-${VERSION}.tar.xz) to"
|
||||
echo "$DESTDIR"
|
||||
echo "and run the build command again."
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMMIT="${CI_COMMIT_SHA:-HEAD}"
|
||||
|
||||
STASH_ID=$(git stash create)
|
||||
|
|
Loading…
Reference in New Issue