1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Add Arch packaging to Robo file

This commit is contained in:
J. King 2021-05-19 11:27:21 -04:00
parent 79391446cd
commit e75f8cebfb

View file

@ -167,6 +167,16 @@ class RoboFile extends \Robo\Tasks {
$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->taskFilesystemStack()->remove($dir))
->completion($this->taskExec("git worktree prune")); ->completion($this->taskExec("git worktree prune"));
// patch the Arch PKGBUILD file with the correct version string
$t->addCode(function () use ($dir) {
$ver = trim(preg_replace('/^([^-]+)-(\d+)-(\w+)$/', "$1.r$2.$3", `git -C "$dir" describe --tags`));
return $this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^pkgver=.*$/m')->to("pkgver=$ver")->run();
});
// patch the Arch PKGBUILD file with the correct source file
$t->addCode(function () use ($dir, $archive) {
$tar = basename($archive);
return $this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^source=\("arsse-[^"]+"\)$/m')->to("source=(\"$tar\")")->run();
});
// perform Composer installation in the temp location with dev dependencies // perform Composer installation in the temp location with dev dependencies
$t->taskComposerInstall()->dir($dir); $t->taskComposerInstall()->dir($dir);
// generate the manual // generate the manual
@ -225,7 +235,13 @@ class RoboFile extends \Robo\Tasks {
$t->addCode(function() use ($version) { $t->addCode(function() use ($version) {
return $this->package($version); return $this->package($version);
}); });
// extract PKGBUILD and run it; todo // extract the PKGBUILD from the just-created archive and build it
$t->addCode(function() use ($archive) {
// because Robo doesn't support extracting a single file we have to do it ourselves
(new \Archive_Tar($archive))->extractList("arsse/dist/arch/PKGBUILD", BASE, "arsse/dist/arch/", false);
return $this->taskFilesystemStack()->touch(BASE."PKGBUILD")->run();
})->completion($this->taskFilesystemStack()->remove(BASE."PKGBUILD"));
$t->taskExec("makepkg -Ccf")->dir(BASE);
return $t->run(); return $t->run();
} }