]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
packaging: cleanup scripts
authorTomas Krizek <tomas.krizek@nic.cz>
Thu, 22 Feb 2018 14:13:39 +0000 (15:13 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 27 Feb 2018 16:50:22 +0000 (17:50 +0100)
.gitlab-ci.yml
scripts/build-in-obs.sh
scripts/make-archive.sh
scripts/make-distrofiles.sh
scripts/make-srpm.sh
scripts/show-version.sh [deleted file]

index 16966b3bcf5e89361468cf6b8c5c10bad3e37175..e0f147fc8c9a7288f9eeee5c958911db785a7866 100644 (file)
@@ -346,15 +346,16 @@ pages:
       - public
 
 # trigger obs build for master branch
-obs:
+obs:devel:
   stage: deploy
   only:
     - master
   dependencies: []
   script:
+    - scripts/make-archive.sh
     - scripts/make-distrofiles.sh
     - echo -e "[general]\napiurl = https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = CZ-NIC\npass = $OBS_PASSWORD" > /root/.oscrc
-    - scripts/build-in-obs.sh knot-devel
+    - scripts/build-in-obs.sh knot-dns-devel
     - scripts/build-in-obs.sh knot-resolver-devel
 
 #arm_build:
index eec967adfa05dd5531067192074063407f6f77ad..fea8f1a4e3a8ca5b0081298c29441cc220318deb 100755 (executable)
@@ -1,18 +1,21 @@
 #!/bin/bash -e
 
 # Example usage:
-# scripts/make-distrofiles.sh
-# scripts/build-in-obs.sh knot-resolver-devel
+# 1. place tarball to be released in git root dir
+# 2. scripts/make-distrofiles.sh
+# 3. scripts/build-in-obs.sh knot-resolver-latest
 
-repo=home:CZ-NIC:$1
+project=home:CZ-NIC:$1
+package=knot-resolver
 
-osc co "$repo" knot-resolver
-cd "$repo/knot-resolver"
-osc del *
+osc co "${project}" "${package}"
+pushd "${project}/${package}"
+osc del * ||:
 cp ../../*.tar.xz ./
 cp -rL ../../distro/fedora/* ./
 cp -rL ../../distro/arch/* ./
 cp ../../distro/debian/*.debian.tar.xz ./
-cp ../../distro/debian/knot-resolver.dsc ./
+cp "../../distro/debian/${package}.dsc" ./
 osc addremove
 osc ci -n
+popd
index 3b9b96503bdd530df7e88240a2495d50726f86ac..e3b1a9702baf396a07c5ee28ff2b61005b65cc06 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 # Create a distribution tarball, like 'make dist' from autotools.
 cd "$(git rev-parse --show-toplevel)"
-ver="$(scripts/show-version.sh)"
+ver=$(git describe | sed 's/^v//' | sed 's/-/\./g')
 test 0 -ne $(git status --porcelain | wc -l) && \
        echo "Git working tree is dirty, make it clean first" && \
        exit 1
index 8fb5547e579f1bda932dc660aba059a2b9f1f719..576b21afe55884442196cee1f3a78ab2fa6f2b80 100755 (executable)
@@ -1,24 +1,30 @@
 #!/bin/bash -e
 
-scripts/make-archive.sh
+package=knot-resolver
 
 cd "$(git rev-parse --show-toplevel)"
-VERSION=$(scripts/show-version.sh)
+version=$(ls ${package}*.tar.xz | sed "s/${package}-\(.*\).tar.xz/\1/")
+
+# Check version for invalid characters
+if [[ $(echo "${version}" | grep '^[[:alnum:].]$') -ne 0 ]]; then
+       echo "Invalid version number: may contain only alphanumeric characters and dots"
+       exit 1
+fi
 
 # Fill in VERSION field in distribution specific files
-files='distro/fedora/knot-resolver.spec distro/arch/PKGBUILD distro/debian/debian/changelog distro/debian/knot-resolver.dsc'
-for file in $files; do
-       sed -i "s/__VERSION__/$VERSION/g" "$file"
+files="distro/fedora/${package}.spec distro/debian/debian/changelog distro/debian/${package}.dsc distro/arch/PKGBUILD"
+for file in ${files}; do
+       sed -i "s/__VERSION__/${version}/g" "${file}"
 done
 
 # Rename archive to debian format
-mv knot-resolver-$VERSION.tar.xz knot-resolver_$VERSION.orig.tar.xz
+mv "${package}-${version}.tar.xz" "${package}_${version}.orig.tar.xz"
 
 # Create debian archive and dsc
 pushd distro/debian
-tar -chaf knot-resolver_$VERSION-1.debian.tar.xz debian
-archive=knot-resolver_$VERSION-1.debian.tar.xz
-echo " $(md5sum $archive | cut -d' ' -f1) $(wc -c $archive)" >> knot-resolver.dsc
+tar -chaf "${package}_${version}-1.debian.tar.xz" debian
+archive=${package}_${version}-1.debian.tar.xz
+echo " $(md5sum ${archive} | cut -d' ' -f1) $(wc -c ${archive})" >> ${package}.dsc
 popd
-archive=knot-resolver_$VERSION.orig.tar.xz
-echo " $(md5sum $archive | cut -d' ' -f1) $(wc -c $archive)" >> distro/debian/knot-resolver.dsc
+archive=${package}_${version}.orig.tar.xz
+echo " $(md5sum ${archive} | cut -d' ' -f1) $(wc -c ${archive})" >> distro/debian/${package}.dsc
index 5fdaa7686827779f60dbe6863278453b50dbda40..dbccb3410224f1a3c14fcce045f3da59f54f93f3 100755 (executable)
@@ -3,6 +3,7 @@
 # Create a source rpm for Fedora/EPEL
 
 cd "$(git rev-parse --show-toplevel)"
+scripts/make-archive.sh
 scripts/make-distrofiles.sh
 mv knot-resolver_*.orig.tar.xz distro/fedora/
 cd distro/fedora
diff --git a/scripts/show-version.sh b/scripts/show-version.sh
deleted file mode 100755 (executable)
index 36eafcd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash -e
-git describe | sed 's/^v//' | sed 's/-/\./g'