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

Shorten output of packaging task

This commit is contained in:
J. King 2021-05-20 23:53:25 -04:00
parent 16174f11b6
commit 38cb1059b2

View file

@ -173,7 +173,7 @@ class RoboFile extends \Robo\Tasks {
// name the generic release tarball // name the generic release tarball
$tarball = "arsse-$version.tar.gz"; $tarball = "arsse-$version.tar.gz";
// generate the Debian changelog; this also validates our original changelog // generate the Debian changelog; this also validates our original changelog
$debianChangelog = changelogDebian(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 use by packaging // save commit description to VERSION file for use by packaging
$t->addTask($this->taskWriteToFile($dir."VERSION")->text($version)); $t->addTask($this->taskWriteToFile($dir."VERSION")->text($version));
// save the Debian changelog // save the Debian changelog
@ -185,9 +185,11 @@ class RoboFile extends \Robo\Tasks {
// 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));
// generate the manual // generate the manual
$t->addTask($this->taskExec(escapeshellarg($dir."robo")." manual")->dir($dir)); $t->addCode(function() {
return $this->manual(["-q"]);
});
// 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")); $t->addTask($this->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts")->arg("-q"));
// delete unwanted files // delete unwanted files
$t->addTask($this->taskFilesystemStack()->remove([ $t->addTask($this->taskFilesystemStack()->remove([
$dir.".git", $dir.".git",
@ -285,12 +287,7 @@ class RoboFile extends \Robo\Tasks {
return $t->run(); return $t->run();
} }
public function changelog() { protected function changelogParse(string $text, string $targetVersion): array {
echo changelogDebian(changelogParse(file_get_contents("CHANGELOG"), "0.9.1-r26"), "0.9.1-r26");
}
}
function changelogParse(string $text, string $targetVersion): array {
$lines = preg_split('/\r?\n/', $text); $lines = preg_split('/\r?\n/', $text);
$version = ""; $version = "";
$section = ""; $section = "";
@ -366,7 +363,7 @@ function changelogParse(string $text, string $targetVersion): array {
return $out; return $out;
} }
function changelogDebian(array $log, string $targetVersion): string { protected function changelogDebian(array $log, string $targetVersion): string {
$latest = $log[0]['version']; $latest = $log[0]['version'];
$baseVersion = preg_replace('/^(\d+(?:\.\d+)*).*/', "$1", $targetVersion); $baseVersion = preg_replace('/^(\d+(?:\.\d+)*).*/', "$1", $targetVersion);
if ($baseVersion !== $targetVersion && version_compare($latest, $baseVersion, ">")) { if ($baseVersion !== $targetVersion && version_compare($latest, $baseVersion, ">")) {
@ -401,3 +398,4 @@ function changelogDebian(array $log, string $targetVersion): string {
} }
return $out; return $out;
} }
}