From 79391446cdbc773aaade3859a44d00b9c44071f4 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Wed, 19 May 2021 08:51:17 -0400 Subject: [PATCH] Start moving Arch build responsibility to Robo Also clean up the generic packaging task --- RoboFile.php | 37 +++++++++++++++++++++++++++++++------ dist/arch/PKGBUILD | 23 ++--------------------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index ec6457cf..7e78ac45 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -149,7 +149,7 @@ class RoboFile extends \Robo\Tasks { * * The version to package may be any Git tree-ish identifier: a tag, a branch, * or any commit hash. If none is provided on the command line, Robo will prompt - * for a commit to package; the default is "head". + * for a commit to package; the default is "HEAD". * * Note that while it is possible to re-package old versions, the resultant tarball * may not be equivalent due to subsequent changes in the exclude list, or because @@ -164,7 +164,9 @@ class RoboFile extends \Robo\Tasks { // create a temporary directory $dir = $t->tmpDir().\DIRECTORY_SEPARATOR; // create a Git worktree for the selected commit in the temp location - $t->taskExec("git worktree add ".escapeshellarg($dir)." ".escapeshellarg($version)); + $t->taskExec("git worktree add ".escapeshellarg($dir)." ".escapeshellarg($version)) + ->completion($this->taskFilesystemStack()->remove($dir)) + ->completion($this->taskExec("git worktree prune")); // perform Composer installation in the temp location with dev dependencies $t->taskComposerInstall()->dir($dir); // generate the manual @@ -195,13 +197,36 @@ class RoboFile extends \Robo\Tasks { ]); // generate a sample configuration file $t->taskExec(escapeshellarg(\PHP_BINARY)." arsse.php conf save-defaults config.defaults.php")->dir($dir); + // remove any existing archive + $t->taskFilesystemStack()->remove($archive); // package it all up $t->taskPack($archive)->addDir("arsse", $dir); // execute the collection - $out = $t->run(); - // clean the Git worktree list - $this->_exec("git worktree prune"); - return $out; + return $t->run(); + } + + /** Packages a given commit of the software into an Arch package + * + * The version to package may be any Git tree-ish identifier: a tag, a branch, + * or any commit hash. If none is provided on the command line, Robo will prompt + * for a commit to package; the default is "HEAD". + * + * Note that while it is possible to re-package old versions, the resultant tarball + * may not be equivalent due to subsequent changes in the exclude list, or because + * of new tooling. + */ + public function packageArch(string $version = null): Result { + // establish which commit to package + $version = $version ?? $this->askDefault("Commit to package:", "HEAD"); + $archive = BASE."arsse-$version.tar.gz"; + // start a collection + $t = $this->collectionBuilder(); + // create a tarball + $t->addCode(function() use ($version) { + return $this->package($version); + }); + // extract PKGBUILD and run it; todo + return $t->run(); } /** Generates static manual pages in the "manual" directory diff --git a/dist/arch/PKGBUILD b/dist/arch/PKGBUILD index d6651408..b44991c9 100644 --- a/dist/arch/PKGBUILD +++ b/dist/arch/PKGBUILD @@ -1,42 +1,23 @@ pkgname="arsse" -pkgver=0.9.1.r16.d1fd6e9 +pkgver=0.9.1 pkgrel=1 epoch= pkgdesc="RSS/Atom newsfeed synchronization server" arch=("any") url="https://thearsse.com/" license=("MIT") -groups=() depends=() makedepends=("git" "php" "php-intl" "composer") checkdepends=() optdepends=("php-pgsql: PostgreSQL database support" "nginx: HTTP server" "apache: HTTP server") -provides=() -conflicts=() -replaces=() backup=("etc/webapps/arsse/config.php" "etc/php/php-fpm.d/arsse.conf") -options=() install= changelog= -source=("git+file://$(dirname $(dirname $(pwd)))") -noextract=() +source=("arsse-0.9.1.tar.gz") md5sums=("SKIP") -pkgver() { - git describe --tags | sed 's/\([^-]*-\)g/r\1/;s/-/./g' -} - -build() { - cd "$srcdir/arsse" - composer install - ./robo manual - composer install --no-dev -o -n --no-scripts - php arsse.php conf save-defaults config.defaults.php - rm -r vendor/bin -} - package() { depends=("php" "php-intl" "php-sqlite" "php-fpm") cd "$pkgdir"