diff --git a/RoboFile.php b/RoboFile.php index 6b4dbc5..f869c33 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 0000000..626d6fa --- /dev/null +++ b/dist/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +DH_VERBOSE = 1 + +%: + dh $@ \ No newline at end of file