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

Enhancements to Debian files

This commit is contained in:
J. KIng 2021-05-21 21:11:22 -04:00
parent b7909d7cd3
commit e653fb3f73
4 changed files with 63 additions and 16 deletions

View file

@ -248,20 +248,28 @@ class RoboFile extends \Robo\Tasks {
/** Packages a release tarball into a Debian package */
public function packageDeb(string $tarball): Result {
// determine the "upstream" (tagged) version
if (preg_match('/^arsse-(\d+(?:\.\d+)*)/', basename($tarball, $m))) {
$version = $m[1];
$base = $dir."arsse-$version";
} else {
throw new \Exception("Tarball is not named correctly");
}
$t = $this->collectionBuilder();
$dir = $t->tmpDir().\DIRECTORY_SEPARATOR;
// name the "orig" tarball
$orig = $dir.str_replace(".tar.gz", ".orig.tar.gz", str_replace("arsse-", "arsse_", basename($tarball)));
$dir = $t->workDir("~/temp2").\DIRECTORY_SEPARATOR;
// copy the tarball
$t->addTask($this->taskFilesystemStack()->copy($tarball, $orig));
// extract the tarball and keep all "dist files"
// extract the tarball
$t->addCode(function() use ($tarball, $dir) {
// because Robo doesn't support extracting a single file we have to do it ourselves
// Robo's extract task is broken, so we do it manually
(new \Archive_Tar($tarball))->extract($dir, false);
// perform a do-nothing filesystem operation since we need a Robo task result
return $this->taskFilesystemStack()->rename($dir."arsse", $dir."src")->run();
// "temp.orig" is a special directory name to Debian's "quilt" format
return $this->taskFilesystemStack()->rename($dir."arsse", $dir."temp.orig")->run();
});
$t->addTask($this->taskFilesystemStack()->mirror($dir."src/dist", $dir));
// create a directory with the package name and "upstream" version; this is also special to Debian
$t->addTask($this->taskFilesystemStack()->mkdir($base));
// copy relevant files to the directory
$t->addTask($this->taskFilesystemStack()->mirror($dir."temp.orig/dist", $base));
$t->addTask($this->taskExec("deber")->dir($dir));
return $t->run();
}
@ -398,26 +406,30 @@ class RoboFile extends \Robo\Tasks {
}
$out = "";
foreach ($log as $entry) {
$out .= "arsse (".$entry['version']."-1) unstable; urgency=low\n";
// normalize the version string
preg_match('/^(\d+(?:\.\d+)*)(?:-(\d+)-.+)?$/', $entry['version'], $m);
$version = $m[1]."-".($m[2] ?: "1");
// output the entry
$out .= "arsse ($version) UNRELEASED; urgency=low\n";
if ($entry['features']) {
$out .= "\n [ New features ]\n";
$out .= "\n";
foreach ($entry['features'] as $item) {
$out .= " * ".trim(preg_replace("/^/m", " ", $item))."\n";
}
}
if ($entry['fixes']) {
$out .= "\n [ Bug fixes ]\n";
$out .= "\n";
foreach ($entry['fixes'] as $item) {
$out .= " * ".trim(preg_replace("/^/m", " ", $item))."\n";
}
}
if ($entry['changes']) {
$out .= "\n [ Other changes ]\n";
$out .= "\n";
foreach ($entry['changes'] as $item) {
$out .= " * ".trim(preg_replace("/^/m", " ", $item))."\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";
$out .= "\n -- The Arsse team <no-contact@code.mensbeam.com> ".\DateTimeImmutable::createFromFormat("Y-m-d", $entry['date'], new \DateTimeZone("UTC"))->format("D, d M Y")." 00:00:00 +0000\n\n";
}
return $out;
}

33
dist/debian/copyright vendored Normal file
View file

@ -0,0 +1,33 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: arsse
Upstream-Contact: J. King <jking@jkingweb.ca>
Source: https://code.mensbeam.com/MensBeam/arsse/
Files: *
Copyright: 2017 J. King <jking@jkingweb.ca>
2017 Dustin Wilson <dustin@dustinwilson.com>
License: Expat
License: Expat
Copyright (c) 2017 J. King, Dustin Wilson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

1
dist/debian/rules vendored
View file

@ -4,3 +4,4 @@ DH_VERBOSE = 1
%:
dh $@

1
dist/debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (quilt)