Browse Source

Shorten output of packaging task

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

18
RoboFile.php

@ -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 = "";
@ -366,7 +363,7 @@ function changelogParse(string $text, string $targetVersion): array {
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, ">")) {
@ -401,3 +398,4 @@ function changelogDebian(array $log, string $targetVersion): string {
}
return $out;
}
}
Loading…
Cancel
Save