]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
scripts/make-archive: allow creation of tagged archive
authorTomas Krizek <tomas.krizek@nic.cz>
Mon, 7 Jun 2021 11:42:43 +0000 (13:42 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 10 Jun 2021 09:17:37 +0000 (11:17 +0200)
.gitlab-ci.yml
distro/config/apkg.toml
doc/build.rst
scripts/make-archive.sh [moved from scripts/make-dev-archive.sh with 50% similarity]
scripts/obs-build.sh

index bdb00245bff8194fbd13d2471f9f225370ec6fae..0047ef26d7fbc3b549f32544799546073078150f 100644 (file)
@@ -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
index 1096c38b0bc1ab098c7ad22b7c217a2766fc30a8..8b98b85b0c653e559eb6ecd0d45bc0630b61cf7e 100644 (file)
@@ -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
index ce26d8c54991e054f9e688cfdcb7326968d63054..75acf7d294974db595076f2b0abe5fbf9af96dff 100644 (file)
@@ -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:
 
similarity index 50%
rename from scripts/make-dev-archive.sh
rename to scripts/make-archive.sh
index 8bca4dcd068118594a8b2581e3e79e5a13c6850f..c678818a4130474dfff12eef68bd9e20595d4cc2 100755 (executable)
@@ -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 ||:
index 5b1e33c3c9903e804d0f1d16c25f753920138cb9..77e570122e5b9a882b25782dceffda383c4b7402 100755 (executable)
@@ -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