Browse Source

Shorten output of packaging task

rpm
J. King 3 years ago
parent
commit
38cb1059b2
  1. 20
      RoboFile.php

20
RoboFile.php

@ -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 = "";
@ -364,9 +361,9 @@ function changelogParse(string $text, string $targetVersion): array {
} }
$out[] = $entry; $out[] = $entry;
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, ">")) {
@ -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"; $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; return $out;
}
} }
Loading…
Cancel
Save