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

Make parts of generic packaging conditional

This should allow to rebuild old releases from before Debian packages,
Arch ppackages, manpages, or even the HTML manual were added
This commit is contained in:
J. King 2021-07-17 07:12:24 -04:00
parent cf3d270077
commit 70b063e028

View file

@ -201,22 +201,30 @@ class RoboFile extends \Robo\Tasks {
return $result; return $result;
} }
try { try {
if (file_exists($dir."dist/debian")) {
// generate the Debian changelog; this also validates our original changelog // generate the Debian changelog; this also validates our original changelog
$debianChangelog = $this->changelogDebian($this->changelogParse(file_get_contents($dir."CHANGELOG"), $version), $version); $debianChangelog = $this->changelogDebian($this->changelogParse(file_get_contents($dir."CHANGELOG"), $version), $version);
// save commit description to VERSION file for reference // save the Debian-format changelog
$t->addTask($this->taskWriteToFile($dir."VERSION")->text($version)); $t->addTask($this->taskWriteToFile($dir."dist/debian/changelog")->text($debianChangelog));
}
if (file_exists($dir."dist/arch")) {
// patch the Arch PKGBUILD file with the correct version string // patch the Arch PKGBUILD file with the correct version string
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^pkgver=.*$/m')->to("pkgver=$archVersion")); $t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^pkgver=.*$/m')->to("pkgver=$archVersion"));
// patch the Arch PKGBUILD file with the correct source file // patch the Arch PKGBUILD file with the correct source file
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^source=\("arsse-[^"]+"\)$/m')->to('source=("'.basename($tarball).'")')); $t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^source=\("arsse-[^"]+"\)$/m')->to('source=("'.basename($tarball).'")'));
// save the Debian-format changelog }
$t->addTask($this->taskWriteToFile($dir."dist/debian/changelog")->text($debianChangelog)); // save commit description to VERSION file for reference
$t->addTask($this->taskWriteToFile($dir."VERSION")->text($version));
// perform Composer installation in the temp location with dev dependencies // perform Composer installation in the temp location with dev dependencies
$t->addTask($this->taskComposerInstall()->arg("-q")->dir($dir)); $t->addTask($this->taskComposerInstall()->arg("-q")->dir($dir));
if (file_exists($dir."manpages")) {
// generate manpages // generate manpages
$t->addTask($this->taskExec("./robo manpage")->dir($dir)); $t->addTask($this->taskExec("./robo manpage")->dir($dir));
}
if (file_exists($dir."docs")) {
// generate the HTML manual // generate the HTML manual
$t->addTask($this->taskExec("./robo manual -q")->dir($dir)); $t->addTask($this->taskExec("./robo manual -q")->dir($dir));
}
// perform Composer installation in the temp location for final output // perform Composer installation in the temp location for final output
$t->addTask($this->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts")->arg("-q")); $t->addTask($this->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts")->arg("-q"));
// delete unwanted files // delete unwanted files
@ -663,15 +671,6 @@ class RoboFile extends \Robo\Tasks {
} else { } else {
throw new \Exception("Number of priorities defined in Debian control file does not match number of packages"); throw new \Exception("Number of priorities defined in Debian control file does not match number of packages");
} }
// read the package priorities from the control file
if (preg_match_all('/^Priority:\s*(\S+)/m', $control, $m) || sizeof($m[1]) != sizeof($binary)) {
$priority = [];
foreach ($m[1] as $pkg) {
$priority[] = $pkg;
}
} else {
throw new \Exception("Number of priorities defined in Debian control file does not match number of packages");
}
// read simple metadata from the control file // read simple metadata from the control file
$metadata = []; $metadata = [];
foreach (["Source", "Maintainer", "Homepage", "Standards-Version", "Vcs-Browser", "Vcs-Git"] as $meta) { foreach (["Source", "Maintainer", "Homepage", "Standards-Version", "Vcs-Browser", "Vcs-Git"] as $meta) {
@ -683,7 +682,6 @@ class RoboFile extends \Robo\Tasks {
} }
// read build dependencies from control file // read build dependencies from control file
if (preg_match('/(?:^|\n)Build-Depends:\s*((?:[^\n]|\n(?= ))+)/s', $control, $m)) { if (preg_match('/(?:^|\n)Build-Depends:\s*((?:[^\n]|\n(?= ))+)/s', $control, $m)) {
$this->say(var_export($m));
$buildDepends = preg_replace('/\s/', "", $m[1]); $buildDepends = preg_replace('/\s/', "", $m[1]);
} else { } else {
$buildDepends = ""; $buildDepends = "";