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

Prototype Debian control file and other changes

This commit is contained in:
J. King 2021-05-20 17:47:02 -04:00
parent 3f3f449da1
commit 073f6b3c39
3 changed files with 77 additions and 22 deletions

View file

@ -158,7 +158,7 @@ class RoboFile extends \Robo\Tasks {
public function package(string $version = null): Result { public function package(string $version = null): Result {
// establish which commit to package // establish which commit to package
$version = $version ?? $this->askDefault("Commit to package:", "HEAD"); $version = $version ?? $this->askDefault("Commit to package:", "HEAD");
$archive = BASE."arsse-$version.tar.gz"; $archive = "arsse-$version.tar.gz";
// start a collection // start a collection
$t = $this->collectionBuilder(); $t = $this->collectionBuilder();
// create a temporary directory // create a temporary directory
@ -215,30 +215,20 @@ class RoboFile extends \Robo\Tasks {
return $t->run(); return $t->run();
} }
/** Packages a given commit of the software into an Arch package /** Packages a release tarball into an Arch package */
* public function packageArch(string $tarball): Result {
* The version to package may be any Git tree-ish identifier: a tag, a branch, $dir = dirname($tarball);
* or any commit hash. If none is provided on the command line, Robo will prompt
* for a commit to package; the default is "HEAD".
*/
public function packageArch(string $version = null): Result {
// establish which commit to package
$version = $version ?? $this->askDefault("Commit to package:", "HEAD");
$archive = BASE."arsse-$version.tar.gz";
// start a collection // start a collection
$t = $this->collectionBuilder(); $t = $this->collectionBuilder();
// create a tarball // extract the PKGBUILD from the tarball
$t->addCode(function() use ($version) { $t->addCode(function() use ($tarball, $dir) {
return $this->package($version);
});
// extract the PKGBUILD from the just-created archive and build it
$t->addCode(function() use ($archive) {
// because Robo doesn't support extracting a single file we have to do it ourselves // because Robo doesn't support extracting a single file we have to do it ourselves
(new \Archive_Tar($archive))->extractList("arsse/dist/arch/PKGBUILD", BASE, "arsse/dist/arch/", false); (new \Archive_Tar($tarball))->extractList("arsse/dist/arch/PKGBUILD", $dir,"arsse/dist/arch/", false);
// perform a do-nothing filesystem operation since we need a Robo task result // perform a do-nothing filesystem operation since we need a Robo task result
return $this->taskFilesystemStack()->chmod(BASE."PKGBUILD", 0644)->run(); return $this->taskFilesystemStack()->chmod("PKGBUILD", 0644)->dir($dir)->run();
})->completion($this->taskFilesystemStack()->remove(BASE."PKGBUILD")); })->completion($this->taskFilesystemStack()->remove("PKGBUILD")->dir($dir));
$t->taskExec("makepkg -Ccf")->dir(BASE); // build the package
$t->taskExec("makepkg -Ccf")->dir($dir);
return $t->run(); return $t->run();
} }
@ -285,4 +275,36 @@ class RoboFile extends \Robo\Tasks {
// execute the collection // execute the collection
return $t->run(); return $t->run();
} }
protected function parseChangelog(string $text, string $targetVersion): array {
$baseVersion = preg_replace('/^(\d+(?:\.\d+)*).*/', "$1", $targetVersion);
$lines = preg_split('/[\r\n]+/', trim($text));
$version = "";
$section = "";
$out = [];
$l = 0;
$expected = "version";
for ($a = 0; $a < sizeof($lines);) {
$l = rtrim($lines[$a++]);
Process:
if (in_array($expected, ["version", "section"]) && preg_match('/^Version (\d+(?:\.\d+)*) \(([\d\?]{4}-[\d\?]{2}-[\d\?]{2})\)\s*$/', $l, $m)) {
$version = $m[1];
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $m[2])) {
// uncertain dates are allowed only for the top version, and only if it does not match the target version (otherwise we have forgot to set the correct date before tagging)
if (!$out && $targetVersion !== $version) {
// use today's date; local time is fine
$date = date("Y-m-d");
} else {
throw new \Exception("CHANGELOG: Date at line $a is incomplete");
}
} else {
$date = $m[2];
}
$out[$version] = ['date' => $date, 'features' => [], 'fixes' => [], 'changes' => []];
$expected = "separator";
} elseif ($expected === "separator" && $length = strlen($lines[$a - 2]) && preg_match('/^={'.$length.'}$/', $l)) {
// verify that the next line is blank
}
}
}
} }

3
dist/arch/PKGBUILD vendored
View file

@ -2,7 +2,7 @@ pkgname="arsse"
pkgver=0.9.1 pkgver=0.9.1
pkgrel=1 pkgrel=1
epoch= epoch=
pkgdesc="RSS/Atom newsfeed synchronization server" pkgdesc="Multi-protocol RSS/Atom newsfeed synchronization server"
arch=("any") arch=("any")
url="https://thearsse.com/" url="https://thearsse.com/"
license=("MIT") license=("MIT")
@ -57,4 +57,5 @@ package() {
sed -ise 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" "$pkgdir/usr/lib/systemd/system/"* "$pkgdir/usr/bin/"* sed -ise 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" "$pkgdir/usr/lib/systemd/system/"* "$pkgdir/usr/bin/"*
sed -ise 's/\/var\/run\/php\//\/run\/php-fpm\//' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -ise 's/\/var\/run\/php\//\/run\/php-fpm\//' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -ise 's/www-data/http/' "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -ise 's/www-data/http/' "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -ie 's/^WorkingDirectory=.*$/WorkingDirectory=\/usr\/share\/webapps\/arsse/' -e 's/^ConfigurationDirectory=.*$/ConfigurationDirectory=webapps\/arsse/' "$pkgdir/usr/lib/systemd/system/arsse-fetch.service"
} }

32
dist/debian/control vendored Normal file
View file

@ -0,0 +1,32 @@
Source: arsse
Maintainer: J. King <jking@jkingweb.ca>
Section: contrib/net
Priority: optional
Standards-Version: 4.5.1
Homepage: https://thearsse.com/
Vcs-Browser: https://code.mensbeam.com/MensBeam/arsse/
Vcs-Git: https://code.mensbeam.com/MensBeam/arsse/
Package: arsse
Architecture: all
Section: contrib/net
Priority: optional
Essential: no
Homepage: https://thearsse.com/
Description: Multi-protocol RSS/Atom newsfeed synchronization server
The Arsse bridges the gap between multiple existing newsfeed aggregator
client protocols such as Tiny Tiny RSS, Nextcloud News and Miniflux,
allowing you to use compatible clients for many protocols with a single
server.
Depends: ${misc:Depends},
dbconfig-mysql | dbconfig-pgsql | dbconfig-sqlite3 | dbconfig-no-thanks,
php (>= 7.1.0),
php-cli,
php-intl,
php-json,
php-xml,
php-sqlite3 | php-mysql | php-pgsql
Recommends: apache2 | nginx,
php-fpm,
php-curl,
ca-certificates