update packaging (#100)

This commit is contained in:
Kevin Yue
2021-10-24 12:11:54 +08:00
committed by GitHub
parent 36d9753008
commit 9e7fb17bd3
46 changed files with 823 additions and 1192 deletions

26
scripts/_archive-all.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash -e
VERSION=$(cat VERSION VERSION_SUFFIX)
rm -rf ./artifacts && mkdir -p ./artifacts/{obs,aur,flatpak}
# Add the version file
echo $VERSION > ./artifacts/VERSION
# Archive the source code
git-archive-all \
--force-submodules \
--prefix=globalprotect-openconnect-${VERSION}/ \
./artifacts/globalprotect-openconnect-${VERSION}.tar.gz
# Prepare the OBS package
cp -r ./packaging/obs ./artifacts
cp ./artifacts/*.tar.gz ./artifacts/obs/globalprotect-openconnect.tar.gz
# Prepare the AUR package
cp ./packaging/aur/PKGBUILD ./artifacts/aur
cp ./artifacts/*.tar.gz ./artifacts/aur/globalprotect-openconnect.tar.gz
# Prepare the flatpak package
cp ./packaging/flatpak/com.yuezk.qt.gpclient.yml ./artifacts/flatpak
cp ./artifacts/*.tar.gz ./artifacts/flatpak/globalprotect-openconnect.tar.gz

7
scripts/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash -e
./cmakew -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS_RELEASE=-s
MAKEFLAGS=-j$(nproc) ./cmakew --build build

View File

@@ -444,7 +444,7 @@ do-versionfile
# do-changelog
# do-branch
do-commit
tag "${V_USR_INPUT}" "${REL_NOTE}"
# tag "${V_USR_INPUT}" "${REL_NOTE}"
do-push
echo -e "\n${S_LIGHT}"

View File

@@ -1,9 +1,10 @@
#!/bin/bash -e
./cmakew -B build -DCMAKE_BUILD_TYPE=Release
MAKEFLAGS=-j$(nproc) ./cmakew --build build
./scripts/build.sh
sudo ./cmakew --install build
sudo systemctl enable gpservice.service
sudo systemctl daemon-reload
sudo systemctl restart gpservice.service

53
scripts/ppa-publish.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/bash -e
VERSION="$(cat VERSION VERSION_SUFFIX)"
OLD_REVISION="1"
PPA_REPO="ppa:yuezk/globalprotect-openconnect-snapshot"
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--stable)
PPA_REPO="ppa:yuezk/globalprotect-openconnect"
shift
;;
"18.04")
DISTRIBUTION="18.04"
DISTRIBUTION_NAME="bionic"
shift
;;
"20.04")
DISTRIBUTION="20.04"
DISTRIBUTION_NAME="focal"
shift
;;
"21.04")
DISTRIBUTION="21.04"
DISTRIBUTION_NAME="hirsute"
shift
;;
"21.10")
DISTRIBUTION="21.10"
DISTRIBUTION_NAME="impish"
shift
;;
*)
echo "Unkown options $key"
exit 1
;;
esac
done
[ -z $DISTRIBUTION ] && echo "The distribuation is required" && exit 1;
NEW_REVISION="ppa1~ubuntu${DISTRIBUTION}"
sed -i"" "1s/${VERSION}-${OLD_REVISION}/${VERSION}-${NEW_REVISION}/;1s/unstable/${DISTRIBUTION_NAME}/" debian/changelog
debmake
debuild -S -sa \
-k"${PPA_GPG_KEYID}" \
-p"gpg --batch --passphrase ${PPA_GPG_PASSPHRASE} --pinentry-mode loopback"
dput $PPA_REPO ../globalprotect-openconnect_${VERSION}-${NEW_REVISION}_source.changes

40
scripts/prepare-packaging.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash -e
OLD_VERSION=$(git tag --sort=-v:refname --list "v[0-9]*" | head -n 1 | cut -c 2-)
NEW_VERSION="$(cat VERSION)"
FULL_VERSION="$(cat VERSION VERSION_SUFFIX)"
HISTORY_ENTRIES=$(git log --format=" * %s" v${OLD_VERSION}.. | cat -n | sort -uk2 | sort -n | cut -f2-)
function update_debian_changelog() {
local OLD_CHANGELOG=$(cat debian/changelog)
cat > debian/changelog <<-EOF
globalprotect-openconnect (${FULL_VERSION}-1) unstable; urgency=medium
${HISTORY_ENTRIES}
-- Kevin Yue <k3vinyue@gmail.com> $(date -R)
${OLD_CHANGELOG}
EOF
}
function update_rpm_changelog() {
local OLD_CHANGELOG=$(cat packaging/obs/globalprotect-openconnect.changes)
cat > packaging/obs/globalprotect-openconnect.changes <<-EOF
-------------------------------------------------------------------
$(LC_ALL=en.US date -u "+%a %b %e %T %Z %Y") - k3vinyue@gmail.com - ${FULL_VERSION}
- Update to ${FULL_VERSION}
${HISTORY_ENTRIES}
${OLD_CHANGELOG}
EOF
}
# Update rpm version
sed -i"" -re "s/(Version:\s+).+/\1${FULL_VERSION}/" packaging/obs/globalprotect-openconnect.spec
update_rpm_changelog
update_debian_changelog

3
scripts/release-archive-all.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash -e
./scripts/_archive-all.sh

13
scripts/release.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/bash -e
VERSION=$(cat VERSION)
# Clear the VERSION_SUFFIX
cat /dev/null > VERSION_SUFFIX
# Update packaging, e.g., version, changelog, etc.
./scripts/prepare-packaging.sh
# Commit the changes
git commit -m "Release ${VERSION}" .
git tag v$VERSION -a -m "Release ${VERSION}"

17
scripts/snapshot-archive-all.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash -e
./scripts/snapshot-version.sh
./scripts/prepare-packaging.sh
./scripts/_archive-all.sh
# Update the OBS packaging
mv ./artifacts/obs/globalprotect-openconnect.tar.gz ./artifacts/obs/globalprotect-openconnect-snapshot.tar.gz
mv ./artifacts/obs/globalprotect-openconnect.spec ./artifacts/obs/globalprotect-openconnect-snapshot.spec
mv ./artifacts/obs/globalprotect-openconnect.changes ./artifacts/obs/globalprotect-openconnect-snapshot.changes
mv ./artifacts/obs/globalprotect-openconnect-rpmlintrc ./artifacts/obs/globalprotect-openconnect-snapshot-rpmlintrc
sed -i"" -re "s/(Name:\s+).+/\1globalprotect-openconnect-snapshot/" \
-re "s/(Conflicts:\s+).+/\1globalprotect-openconnect/" \
./artifacts/obs/globalprotect-openconnect-snapshot.spec
# Update the AUR package
cp ./packaging/aur/PKGBUILD-git ./artifacts/aur/PKGBUILD

3
scripts/snapshot-version.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash -e
git describe --tags --match "v$(cat VERSION)" | sed -r -e 's/v([^-]+)-/+snapshot/' -e 's/-/./' > VERSION_SUFFIX