Mercurial > hgweb.cgi > drn
changeset 929:399d9d1c2cad
IN 11: No longer require a tag to package on Debian.
author | John Schneiderman <JohnMS@member.fsf.org> |
---|---|
date | Tue, 20 Dec 2022 14:44:48 +0100 |
parents | 4100ea4708c6 |
children | f615d50eb089 f6adb91af7ab |
files | pkg/buildDeb.sh pkg/buildRpm.sh pkg/debian/changelog pkg/debian/rules pkg/debian/shlibs.local |
diffstat | 5 files changed, 67 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/buildDeb.sh Tue Dec 20 13:35:21 2022 +0100 +++ b/pkg/buildDeb.sh Tue Dec 20 14:44:48 2022 +0100 @@ -19,18 +19,16 @@ #******************************************************************************* #!/usr/bin/env bash -shopt -s -o nounset # Don't allow the use of variables that haven't been declared -shopt -s -o pipefail # This option sets the exit code of a pipeline to that of the rightmost - # command to exit with a non-zero status, or zero if all commands of the - # pipeline exit successfully. -shopt -s -o errexit # Exit when a command fails -shopt -s extglob # Allow the use of the extra pattern +shopt -s -o nounset +shopt -s -o pipefail +shopt -s -o errexit +shopt -s extglob # Program Variables #___________________________________________________________________________________________________ declare -r scriptName=${0##*/} declare -r path="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -declare -r options="a:hk:v:" +declare -r options="a:b:hk:r:" declare optionResult="" declare -r projectName="duxreinummariae" declare version="" @@ -43,6 +41,8 @@ # single, indep (arch-independent), library, python declare -r packageclass="single" declare apiKey="" +declare branch="" +declare release=0 # Program Argument Validation #___________________________________________________________________________________________________ @@ -52,24 +52,29 @@ a) # Set API key apiKey="$OPTARG" ;; + b) # Set Branch Name + branch="$OPTARG" + ;; h) # Show help printf "usage: ${scriptName} [options]\n" printf "Options:\n" printf " -a <key> Sets the API key for currency updates.\n" + printf " -b <name> Sets the name of the branch to package.\n" printf " -k <id> Sets the ID of the sign key.\n" - printf " -v <version> Sets the version to package.\n" + printf " -r <release> Sets the package release number.\n" exit 0 ;; k) # Set Key Sign ID keyId="$OPTARG" ;; - v) # Set Package Version - version="$OPTARG" + r) # Set Package Release Number + release="$OPTARG" ;; \?) exit 2 ;; *) + printf "Unknown option: ${optionResult}\n" 1>&2 exit 2 ;; esac @@ -81,61 +86,84 @@ exit 1 fi -if [[ -z "${version}" ]] +if [[ -z "${branch}" ]] then - echo "The version of ${projectName} must be specified." + echo "The branch name of ${projectName} must be specified." 1>&2 + exit 1 +fi + +if (( ${release} <= 0 )) +then + echo "The package release number is missing or not a number." 1>&2 exit 1 fi # Program Execution #___________________________________________________________________________________________________ -tarballFileName="${projectName}-${version}.tar" -tarballOrigFileName="${projectName}_${version}.orig.tar.xz" -cd "$path/.." +pushd "$path/.." +version=$(grep VERSION CMakeLists.txt | tail -1 | awk '{ print $2 }') + +if [[ -z "${version}" ]] +then + echo "Failed to determine the version of ${projectName}." + exit 1 +else + echo "Determine the version of ${projectName} to be ${version}." + tarballFileName="${projectName}-${version}.tar" + tarballOrigFileName="${projectName}_${version}.orig.tar.xz" +fi echo "Generating project tarball..." -hg archive "${tarballFileName}" -r "${version}" || exit $? +hg pull --rev "${branch}" +hg update --clean --rev "${branch}" +hg archive "${tarballFileName}" --rev "${branch}" if [[ ! -e "${debBuildDirectoryPath}/" ]] then - mkdir "${debBuildDirectoryPath}/" || exit $? + mkdir "${debBuildDirectoryPath}/" fi -mv "${tarballFileName}" "${debBuildDirectoryPath}/" || exit $? +mv "${tarballFileName}" "${debBuildDirectoryPath}/" echo "Generating Debian file structure..." -cd "${debBuildDirectoryPath}" || exit $? -tar -xf "${tarballFileName}" || exit $? -cd "${projectName}-${version}/" || exit $? +cd "${debBuildDirectoryPath}" +tar -xf "${tarballFileName}" +cd "${projectName}-${version}/" if [[ -e "${debBuildDirectoryPath}/${projectName}-${version}/pkg/debian" ]] then - mv "${debBuildDirectoryPath}/${projectName}-${version}/pkg/debian" . || exit $? - xz "../${tarballFileName}" || exit $? - mv "../${tarballFileName}.xz" "../${tarballOrigFileName}" || exit $? + mv "${debBuildDirectoryPath}/${projectName}-${version}/pkg/debian" . + xz "../${tarballFileName}" + mv "../${tarballFileName}.xz" "../${tarballOrigFileName}" else dh_make \ --yes \ --copyright ${licence} \ --${packageclass} \ - --createorig \ - || exit $? + --createorig fi +echo "Updating package version information..." +sed -i "s/@@BINARY_VERSION@@/${version}/" debian/changelog +sed -i "s/@@PACKAGE_RELEASE@@/${release}/" debian/changelog +sed -i "s/@@BUILD_TIME@@/$(date --rfc-email)/" debian/changelog +sed -i "s/@@BINARY_VERSION@@/${version}/" debian/shlibs.local echo "Building DEB package..." -export CURRENCY_API_KEY="${apiKey}" \ - && dpkg-buildpackage -us -uc || exit $? +export CURRENCY_API_KEY="${apiKey}" && \ + export BINARY_VERSION="${version}" && \ + export PACKAGE_RELEASE="${release}" && \ + dpkg-buildpackage -us -uc echo "Signing DEB package..." -debsign -k${keyId} || exit $? +debsign -k${keyId} echo "Cleaning up temporary build files..." -cd .. || exit $? -rm --recursive --dir "${projectName}-${version}/" || exit $? +cd .. +rm --recursive --dir "${projectName}-${version}/" if [[ -e "${tarballFileName}" ]] then - rm "${tarballFileName}" || exit $? + rm "${tarballFileName}" fi echo "Successfully created DEB package."
--- a/pkg/buildRpm.sh Tue Dec 20 13:35:21 2022 +0100 +++ b/pkg/buildRpm.sh Tue Dec 20 14:44:48 2022 +0100 @@ -38,6 +38,7 @@ declare -r specFileName="${projectName}.spec" declare apiKey="" declare branch="" +declare release=0 # Program Argument Validation #___________________________________________________________________________________________________ @@ -100,8 +101,8 @@ exit 1 else echo "Determine the version of ${projectName} to be ${version}." + tarballFileName="${projectName}-${version}.tar.gz" fi -tarballFileName="${projectName}-${version}.tar.gz" echo "Generating project tarball..." hg pull --rev "${branch}" hg update --clean --rev "${branch}"
--- a/pkg/debian/changelog Tue Dec 20 13:35:21 2022 +0100 +++ b/pkg/debian/changelog Tue Dec 20 14:44:48 2022 +0100 @@ -1,11 +1,6 @@ -duxreinummariae (0.4.1-1) unstable; urgency=medium - - * Bug fix package - - -- John M. Schneiderman <JohnMS@member.fsf.org> Mon, 21 Feb 2022 17:01:08 +0100 +duxreinummariae (@@BINARY_VERSION@@-@@PACKAGE_RELEASE@@) unstable; urgency=medium -duxreinummariae (0.4.0-1) unstable; urgency=medium + * Package Created - * Initial package + -- John M. Schneiderman <JohnMS@member.fsf.org> @@BUILD_TIME@@ - -- John M. Schneiderman <JohnMS@member.fsf.org> Wed, 22 Dec 2021 13:32:06 +0100
--- a/pkg/debian/rules Tue Dec 20 13:35:21 2022 +0100 +++ b/pkg/debian/rules Tue Dec 20 14:44:48 2022 +0100 @@ -17,9 +17,6 @@ %: dh $@ - -# dh_make generated override targets -# This is example for Cmake (See https://bugs.debian.org/641051 ) override_dh_auto_configure: dh_auto_configure -- \ - -DDuxReiNummariae_OPEN_EXCHANGE_RATES_API_KEY="${CURRENCY_API_KEY}" + -DDuxReiNummariae_OPEN_EXCHANGE_RATES_API_KEY="${CURRENCY_API_KEY}"