1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +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
$tarball = "arsse-$version.tar.gz";
// 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
$t->addTask($this->taskWriteToFile($dir."VERSION")->text($version));
// save the Debian changelog
@ -185,9 +185,11 @@ class RoboFile extends \Robo\Tasks {
// perform Composer installation in the temp location with dev dependencies
$t->addTask($this->taskComposerInstall()->arg("-q")->dir($dir));
// 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
$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
$t->addTask($this->taskFilesystemStack()->remove([
$dir.".git",
@ -285,12 +287,7 @@ class RoboFile extends \Robo\Tasks {
return $t->run();
}
public function changelog() {
echo changelogDebian(changelogParse(file_get_contents("CHANGELOG"), "0.9.1-r26"), "0.9.1-r26");
}
}
function changelogParse(string $text, string $targetVersion): array {
protected function changelogParse(string $text, string $targetVersion): array {
$lines = preg_split('/\r?\n/', $text);
$version = "";
$section = "";
@ -364,9 +361,9 @@ function changelogParse(string $text, string $targetVersion): array {
}
$out[] = $entry;
return $out;
}
}
function changelogDebian(array $log, string $targetVersion): string {
protected function changelogDebian(array $log, string $targetVersion): string {
$latest = $log[0]['version'];
$baseVersion = preg_replace('/^(\d+(?:\.\d+)*).*/', "$1", $targetVersion);
if ($baseVersion !== $targetVersion && version_compare($latest, $baseVersion, ">")) {
@ -400,4 +397,5 @@ function changelogDebian(array $log, string $targetVersion): string {
$out .= "\n -- The Arsse team <no-contact@invalid> ".\DateTimeImmutable::createFromFormat("Y-m-d", $entry['date'], new \DateTimeZone("UTC"))->format("D, d M Y")." 00:00:00 +0000\n\n";
}
return $out;
}
}