From 5ab9dc384027b12077c678ac4f45b8761f4b4823 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 8 Jul 2021 23:07:59 -0400 Subject: [PATCH] Add missing pbuilder script --- dist/debian/.gitignore | 15 --------------- dist/debian/pbuilder.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 15 deletions(-) delete mode 100644 dist/debian/.gitignore create mode 100755 dist/debian/pbuilder.sh diff --git a/dist/debian/.gitignore b/dist/debian/.gitignore deleted file mode 100644 index f32f229d..00000000 --- a/dist/debian/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -* -!.gitignore -!arsse.* -!compat -!control -!copyright -!lintian-overrides -!rules -!config.php -!dbconfig-common.php - -!source/ -source/* -!source/lintian-overrides -!source/format diff --git a/dist/debian/pbuilder.sh b/dist/debian/pbuilder.sh new file mode 100755 index 00000000..bb74b0aa --- /dev/null +++ b/dist/debian/pbuilder.sh @@ -0,0 +1,40 @@ +#! /bin/bash -e + +### +# This script is fed to pbuilder to build Debian packages. The base tarball +# should be created with a command similar to the following: +# +# sudo pbuilder create --basetgz pbuilder-arsse.tgz --mirror http://ftp.ca.debian.org/debian/ --extrapackages debhelper --extrapackages devscripts +# +# Thereafter pbuilder can be used to build packages with this command: +# +# sudo pbuilder execute --basetgz pbuilder-arsse.tgz --bindmounts `basedir "/path/to/release/tarball"` -- pbuilder.sh "/path/to/release/tarball" +# +# This somewhat roundabout procedure is used because the pbuilder debuild +# command does not seem to work in Arch Linux, nor does pdebuild. Doing +# as much as possible within the chroot itself works around these problems. +### + +# create a temporary directory +tmp=`mktemp -d` + +# define various variables +here=`dirname "$1"` +tarball=`basename "$1"` +version=`echo "$tarball" | grep -oP '\d+(?:\.\d+)*' | head -1` +out="$here/debian" +in="$tmp/arsse-$version" + +# create necessary directories +mkdir -p "$in" "$out" +# extract the release tarball +tar -C "$in" -xf "$1" --strip-components=1 +# repackage the release tarball into a Debian "orig" tarball +tar -C "$tmp" -czf "$tmp/arsse_$version.orig.tar.gz" "arsse-$version" +# copy the "dist/debian" directory down the tree where Debian expects it +cp -r "$in/dist/debian" "$in/debian" +# build the package +cd "$in" +debuild +# move the resultant files to their final destination +find "$tmp" -maxdepth 1 -type f -exec mv '{}' "$out" \;