From 3c9f4dd66fd854b243e73eecc14dee8ba9e08de1 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Fri, 21 May 2021 12:51:20 -0400 Subject: [PATCH] Prototype Debian rules file --- RoboFile.php | 20 ++++++++++++++++++++ dist/debian/rules | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 dist/debian/rules diff --git a/RoboFile.php b/RoboFile.php index 6b4dbc50..f869c33c 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -246,6 +246,26 @@ class RoboFile extends \Robo\Tasks { return $t->run(); } + /** Packages a release tarball into a Debian package */ + public function packageDeb(string $tarball): Result { + $t = $this->collectionBuilder(); + $dir = $t->tmpDir().\DIRECTORY_SEPARATOR; + // name the "orig" tarball + $orig = $dir.str_replace(".tar.gz", ".orig.tar.gz", str_replace("arsse-", "arsse_", basename($tarball))); + // copy the tarball + $t->addTask($this->taskFilesystemStack()->copy($tarball, $orig)); + // extract the tarball and keep all "dist files" + $t->addCode(function() use ($tarball, $dir) { + // because Robo doesn't support extracting a single file we have to do it ourselves + (new \Archive_Tar($tarball))->extract($dir, false); + // perform a do-nothing filesystem operation since we need a Robo task result + return $this->taskFilesystemStack()->rename($dir."arsse", $dir."src")->run(); + }); + $t->addTask($this->taskFilesystemStack()->mirror($dir."src/dist", $dir)); + $t->addTask($this->taskExec("deber")->dir($dir)); + return $t->run(); + } + /** Generates static manual pages in the "manual" directory * * The resultant files are suitable for offline viewing and inclusion into release builds diff --git a/dist/debian/rules b/dist/debian/rules new file mode 100644 index 00000000..626d6fa2 --- /dev/null +++ b/dist/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +DH_VERBOSE = 1 + +%: + dh $@ \ No newline at end of file