Mercurial > hgweb.cgi > pecunia
changeset 172:b98971dd8836
Rough DEB packing support.
author | John Schneiderman <JohnMS@member.fsf.org> |
---|---|
date | Sat, 23 Jan 2021 13:03:24 +0100 |
parents | 29d5cccadc9e |
children | 1c6827969d93 |
files | pkg/buildDeb.sh pkg/buildRpm.sh pkg/debian/changelog pkg/debian/compat pkg/debian/control pkg/debian/copyright pkg/debian/pecunia-dev.dirs pkg/debian/pecunia-dev.install pkg/debian/pecunia.dirs pkg/debian/pecunia.install pkg/debian/rules pkg/debian/shlibs.local pkg/debian/source/format |
diffstat | 13 files changed, 238 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/buildDeb.sh Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,136 @@ +#******************************************************************************* +#** This file is part of Pecunia. *** +#** *** +#** Copyright (C) 2016, 2017, 2018, 2019, 2020 *** +#** John Schneiderman <Licensing _AT_ Schneiderman _DOT_ me> *** +#** *** +#** This program is free software: you can redistribute it and/or modify it *** +#** under the terms of the GNU Lesser General Public License as published *** +#** by the Free Software Foundation, either version 3 of the License, or *** +#** (at your option) any later version. *** +#** *** +#** This program is distributed in the hope that it will be useful, but *** +#** WITHOUT ANY WARRANTY; without even the implied warranty of *** +#** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *** +#** See the GNU Lesser General Public License for more details. *** +#** *** +#** You should have received a copy of the GNU Lesser General Public License*** +#** along with this program. If not, see <http://www.gnu.org/licenses/>. *** +#******************************************************************************* + +#!/usr/bin/env bash +#shopt -s -o xtrace # Enables echoing out every statement prior to invocation. +shopt -s -o nounset # Don't allow the use of variables that haven't been declared +shopt -s extglob # Allow the use of the extra pattern +# 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 pipefail + +# Program Variables +#___________________________________________________________________________________________________ +declare -r scriptName=${0##*/} +declare -r path="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +declare -r options="hk:v:" +declare optionResult="" +declare -r projectName="pecunia" +declare version="" +declare keyId="" +declare -r debBuildDirectoryPath="$HOME/debbuild" +declare tarballFileName="" +declare tarballOrigFileName="" +# licence in copyright file (apache|artistic|bsd|gpl|gpl2|gpl3|isc|lgpl|lgpl2|lgpl3|mit|custom) +declare -r licence="lgpl3" +# single, indep (arch-independent), library, python +declare -r packageclass="library" + +# Program Argument Validation +#___________________________________________________________________________________________________ +while getopts "${options}" optionResult +do + case ${optionResult} in + h) # Show help + printf "usage: ${scriptName} [options]\n" + printf "Options:\n" + printf " -k <id> Sets the ID of the sign key.\n" + printf " -v <version> Sets the version to package.\n" + exit 0 + ;; + k) # Set Key Sign ID + keyId="$OPTARG" + ;; + v) # Set Package Version + version="$OPTARG" + ;; + \?) + exit 2 + ;; + *) + exit 2 + ;; + esac +done + +if [[ -z "${keyId}" ]] +then + echo "The ID for the signing key must be specified." + exit 1 +fi + +if [[ -z "${version}" ]] +then + echo "The version of ${projectName} must be specified." + exit 1 +fi + + +# Program Execution +#___________________________________________________________________________________________________ +tarballFileName="${projectName}-${version}.tar" +tarballOrigFileName="${projectName}_${version}.orig.tar.xz" +cd "$path/.." + +echo "Generating project tarball..." +hg archive "${tarballFileName}" || exit $? + +if [[ ! -e "${debBuildDirectoryPath}/" ]] +then + mkdir "${debBuildDirectoryPath}/" || exit $? +fi +mv "${tarballFileName}" "${debBuildDirectoryPath}/" || exit $? + +echo "Generating Debian file structure..." +cd "${debBuildDirectoryPath}" || exit $? +tar -xf "${tarballFileName}" || exit $? +cd "${projectName}-${version}/" || exit $? + +if [[ -e "${debBuildDirectoryPath}/${projectName}-${version}/pkg/debian" ]] +then + mv "${debBuildDirectoryPath}/${projectName}-${version}/pkg/debian" . || exit $? + xz "../${tarballFileName}" || exit $? + mv "../${tarballFileName}.xz" "../${tarballOrigFileName}" || exit $? +else + dh_make \ + --yes \ + --copyright ${licence} \ + --${packageclass} \ + --createorig \ + || exit $? +fi + +echo "Building DEB package..." +dpkg-buildpackage -us -uc || exit $? + +echo "Signing DEB package..." +debsign -k${keyId} || exit $? + +echo "Cleaning up temporary build files..." +cd .. || exit $? +rm --recursive --dir "${projectName}-${version}/" || exit $? + +if [[ -e "${tarballFileName}" ]] +then + rm "${tarballFileName}" || exit $? +fi + +echo "Successfully created DEB package." +
--- a/pkg/buildRpm.sh Thu Jan 21 19:27:05 2021 +0100 +++ b/pkg/buildRpm.sh Sat Jan 23 13:03:24 2021 +0100 @@ -71,15 +71,15 @@ # Program Execution #___________________________________________________________________________________________________ tarballFileName="${projectName}-${version}.tar.gz" - pushd "$path/.." -echo "Copying SPEC file..." -cp "pkg/${specFileName}" "${rpmSpecDirectoryPath}" || exit $? echo "Generating project tarball..." hg archive "${tarballFileName}" || exit $? mv "${tarballFileName}" "${rpmBuildDirectoryPath}/SOURCES" || exit $? +echo "Copying SPEC file..." +cp "pkg/${specFileName}" "${rpmSpecDirectoryPath}" || exit $? + echo "Building RPM package..." rpmbuild -ba --clean --rmsource --rmspec "${rpmSpecDirectoryPath}/${specFileName}" || exit $?
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/changelog Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,5 @@ +pecunia (0.5.0-1) unstable; urgency=medium + + * Initial release + + -- John Schneiderman <JohnMS@member.fsf.org> Fri, 22 Jan 2021 16:38:16 +0100
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/compat Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,1 @@ +11
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/control Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,26 @@ +Source: pecunia +Priority: optional +Maintainer: John Schneiderman <JohnMS@member.fsf.org> +Build-Depends: debhelper (>= 11) +Standards-Version: 4.1.3 +Section: libs +Homepage: http://www.schneiderman.me/projects/pecunia +Vcs-Browser: https://source.schneiderman.me/pecunia +#Vcs-Git: https://salsa.debian.org/debian/pecunia.git + +Package: pecunia-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: pecunia (= ${binary:Version}), ${misc:Depends} +Description: Provides the headers needed for development. + +Package: pecunia +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: A C++ library for working with currencies using + the ISO-4217 standard. The monetary representation is in a + fixed size and the operations between difference currencies + is seamlessly supported. +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/copyright Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,34 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: pecunia +Source: https://source.schneiderman.me/pecunia + +Files: * +Copyright: 2021 John Schneiderman <JohnMS@member.fsf.org> + +License: LGPL-3.0+ + +Files: debian/* +Copyright: 2021 John Schneiderman <JohnMS@member.fsf.org> +License: LGPL-3.0+ + +License: LGPL-3.0+ + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + . + On Debian systems, the complete text of the GNU Lesser General + Public License can be found in "/usr/share/common-licenses/LGPL-3". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/pecunia-dev.dirs Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,2 @@ +usr/lib +usr/include
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/pecunia-dev.install Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,2 @@ +usr/include/* +usr/lib/cmake/*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/pecunia.dirs Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,1 @@ +usr/lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/pecunia.install Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,1 @@ +usr/lib/lib*.so.*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/debian/rules Sat Jan 23 13:03:24 2021 +0100 @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) +