mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Allow copy-builtin to work with modified sources
`scripts/make_gitrev.sh` had 'set -e' so if any command failed it would fail and cause copy-builtin to fail (copy-builtin also has `set -e`. This commit also simplifies scripts/make_gitrev.sh to always write a file by using a cleanup function. It also simplifies other areas of the script as well (making it much shorter). Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matthew Thode <mthode@mthode.org> Closes #8022 Closes #8025
This commit is contained in:
parent
2e55034471
commit
8d43194003
@ -30,7 +30,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
make clean || true
|
make clean || true
|
||||||
scripts/make_gitrev.sh
|
scripts/make_gitrev.sh || true
|
||||||
|
|
||||||
rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs"
|
rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs"
|
||||||
cp --recursive include "$KERNEL_DIR/include/zfs"
|
cp --recursive include "$KERNEL_DIR/include/zfs"
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
# CDDL HEADER END
|
# CDDL HEADER END
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||||
#
|
# Copyright (c) 2018 by Matthew Thode. All rights reserved.
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate zfs_gitrev.h. Note that we need to do this for every
|
# Generate zfs_gitrev.h. Note that we need to do this for every
|
||||||
@ -26,29 +25,19 @@
|
|||||||
# `configure` is run.
|
# `configure` is run.
|
||||||
#
|
#
|
||||||
|
|
||||||
BASE_DIR=$(dirname "$0")
|
set -e -u
|
||||||
|
|
||||||
file=${BASE_DIR}/../include/zfs_gitrev.h
|
cleanup() {
|
||||||
|
ZFS_GIT_REV=${ZFS_GIT_REV:-"unknown"}
|
||||||
|
cat << EOF > "$(dirname "$0")"/../include/zfs_gitrev.h
|
||||||
|
#define ZFS_META_GITREV "${ZFS_GIT_REV}"
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
#
|
|
||||||
# Set default file contents in case we bail.
|
|
||||||
#
|
|
||||||
rm -f "$file"
|
|
||||||
# shellcheck disable=SC2039
|
|
||||||
/bin/echo -e "#define\tZFS_META_GITREV \"unknown\"" >>"$file"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check if git is installed and we are in a git repo.
|
# Check if git is installed and we are in a git repo.
|
||||||
#
|
git rev-parse --git-dir > /dev/null 2>&1
|
||||||
git rev-parse --git-dir > /dev/null 2>&1 || exit
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check if there are uncommitted changes
|
# Check if there are uncommitted changes
|
||||||
#
|
git diff-index --quiet HEAD
|
||||||
git diff-index --quiet HEAD || exit
|
# Get the git current git revision
|
||||||
|
ZFS_GIT_REV=$(git describe 2>/dev/null)
|
||||||
rev=$(git describe 2>/dev/null) || exit
|
|
||||||
|
|
||||||
rm -f "$file"
|
|
||||||
# shellcheck disable=SC2039
|
|
||||||
/bin/echo -e "#define\tZFS_META_GITREV \"${rev}\"" >>"$file"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user