summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Krizek <tomas.krizek@nic.cz>2021-06-07 13:42:43 +0200
committerTomas Krizek <tomas.krizek@nic.cz>2021-06-10 11:17:37 +0200
commit27165cee5922782827e2aafd212f7979901e53fd (patch)
tree6d0a98f72a81379fad940c911a7de8f049c17a68
parentci: split pkgtest into separate child pipeline (diff)
downloadknot-resolver-27165cee5922782827e2aafd212f7979901e53fd.tar.xz
knot-resolver-27165cee5922782827e2aafd212f7979901e53fd.zip
scripts/make-archive: allow creation of tagged archive
-rw-r--r--.gitlab-ci.yml7
-rw-r--r--distro/config/apkg.toml2
-rw-r--r--doc/build.rst2
-rwxr-xr-xscripts/make-archive.sh (renamed from scripts/make-dev-archive.sh)30
-rwxr-xr-xscripts/obs-build.sh2
5 files changed, 20 insertions, 23 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bdb00245..0047ef26 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -84,12 +84,7 @@ archive:
EMAIL: 'ci@nic'
except: null
script:
- - >
- if [[ -z "${CI_COMMIT_TAG}" ]]; then
- ./scripts/make-dev-archive.sh
- else
- meson build_dist; ninja -C build_dist dist
- fi
+ - apkg make-archive
build:
<<: *build
diff --git a/distro/config/apkg.toml b/distro/config/apkg.toml
index 1096c38b..8b98b85b 100644
--- a/distro/config/apkg.toml
+++ b/distro/config/apkg.toml
@@ -1,7 +1,7 @@
[project]
name = "knot-resolver"
# needed for make-archive
-make_archive_script = "scripts/make-dev-archive.sh"
+make_archive_script = "scripts/make-archive.sh"
[upstream]
# needed for get-archive
diff --git a/doc/build.rst b/doc/build.rst
index ce26d8c5..75acf7d2 100644
--- a/doc/build.rst
+++ b/doc/build.rst
@@ -220,7 +220,7 @@ It's also possible to make a development snapshot tarball:
.. code-block:: bash
- $ ./scripts/make-dev-archive.sh
+ $ ./scripts/make-archive.sh
.. _packaging:
diff --git a/scripts/make-dev-archive.sh b/scripts/make-archive.sh
index 8bca4dcd..c678818a 100755
--- a/scripts/make-dev-archive.sh
+++ b/scripts/make-archive.sh
@@ -5,26 +5,28 @@ set -o errexit -o nounset -o xtrace
cd "$(dirname ${0})/.."
-# devel version
-GIT_HASH=$(git rev-parse --short HEAD )
-TIMESTAMP=$(date -u +'%s' 2>/dev/null)
-
# make sure we don't accidentally add / overwrite forgotten changes in git
(git diff-index --quiet HEAD && git diff-index --cached --quiet HEAD) || \
(echo 'git index has uncommited changes!'; exit 1)
-# modify and commit meson.build
-sed -i "s/^\(\s*version\s*:\s*'\)\([^']\+\)\('.*\)/\1\2.$TIMESTAMP.$GIT_HASH\3/" meson.build
+if ! git describe --tags --exact-match; then
+ # devel version
+ GIT_HASH=$(git rev-parse --short HEAD )
+ TIMESTAMP=$(date -u +'%s' 2>/dev/null)
+
+ # modify and commit meson.build
+ sed -i "s/^\(\s*version\s*:\s*'\)\([^']\+\)\('.*\)/\1\2.$TIMESTAMP.$GIT_HASH\3/" meson.build
-: changed version in meson.build, changes must be commited to git
-git add meson.build
-git commit -m 'DROP: devel version archive'
+ : changed version in meson.build, changes must be commited to git
+ git add meson.build
+ git commit -m 'DROP: devel version archive'
-cleanup() {
- # undo commit
- git reset --hard HEAD^ >/dev/null
-}
-trap cleanup EXIT
+ cleanup() {
+ # undo commit
+ git reset --hard HEAD^ >/dev/null
+ }
+ trap cleanup EXIT
+fi
# create tarball
rm -rf build_dist ||:
diff --git a/scripts/obs-build.sh b/scripts/obs-build.sh
index 5b1e33c3..77e57012 100755
--- a/scripts/obs-build.sh
+++ b/scripts/obs-build.sh
@@ -13,7 +13,7 @@ if [[ $(git status --porcelain | wc -l) -ne 0 ]]; then
fi
# Create tarball
-scripts/make-dev-archive.sh
+scripts/make-archive.sh
# Submit to OBS
scripts/make-distrofiles.sh -s