Compare commits

...

27 Commits
master ... rpm

Author SHA1 Message Date
J. King 70b70b8af9 Merge branch 'master' into rpm 2 years ago
J. King e2644b12b9 Add example to Nginx vhosts in spec file 3 years ago
J. King d48639df00 Add configuration file and symlink to RPM package 3 years ago
J. King 57e32f4c6b Fix up mmost configuration files in spec file 3 years ago
J. King 3b4cf605d5 Remove last traces of pbuilder 3 years ago
J. King 00842e4902 Spec file tweaks 3 years ago
J. King bcde7d173b Fix PHP-FPM config package in spec file 3 years ago
J. King 892c4c668d Check for RPM keys before producing RPM packages 3 years ago
J. King 530296e104 Spec file clean-up 3 years ago
J. King 9cc741b72f Rough in RPM key management requirements 3 years ago
J. King eddb126ec8 Add PHP-FPM configuration to spec file 3 years ago
J. King bc93dca240 Integrate RPM packaging into tasks 3 years ago
J. King 45d419f82f Move output out of build-root when built 3 years ago
J. King 62aca930f8 Build debian packages with OBS 3 years ago
J. King 10265561d8 Prototype function for RPM changelog 3 years ago
J. King dfac632747 Remove empty packages from spec 3 years ago
J. King d34f06d3c3 Add user/group to spec, shore up systemd scripts 3 years ago
J. King f3beb17727 RPM spec fixes 3 years ago
J. King 9c2a84cc19 Improve general packaging workflow 3 years ago
J. King 10d4d96803 Merge branch 'master' into rpm 3 years ago
J. King e833155115 Add systemd unit to spec file 3 years ago
J. King a7a75b9c13 Start filling in RPM package 3 years ago
J. King 4803d20328 Add descriptions for subpackages 3 years ago
J. King c49806b5b8 Don't require/recommend Web server configuration 3 years ago
J. King 160777b27b Refine spec file slightly 3 years ago
J. King e1bd3b0217 Define spec subpackages 3 years ago
J. King 7ace0759b9 Start on RPM spec file 3 years ago
  1. 4
      .gitignore
  2. 283
      RoboFile.php
  3. 40
      dist/debian/pbuilder.sh
  4. 4
      dist/debian/rules
  5. 189
      dist/rpm/arsse.spec
  6. 24
      release/settings.default.php

4
.gitignore

@ -1,6 +1,5 @@
# Temporary files
/release/
/documentation/
/manual/
/tests/coverage/
@ -12,6 +11,9 @@
/config.php
/.php_cs.cache
/tests/.phpunit.result.cache
/release/*
!/release/settings.default.php
# Dependencies

283
RoboFile.php

@ -171,6 +171,62 @@ class RoboFile extends \Robo\Tasks {
return true;
}
/** Packages a given commit of the software and produces all relevant release files
*
* The commit to package may be any Git tree-ish identifier: a tag, a branch,
* or any commit hash. If none is provided on the command line, Robo will prompt
* for a commit to package; the default is "HEAD".
*
* In addition to the release tarball, a Debian source package, Arch PKGBUILD,
* and RPM spec file are output as well. These are suitable for use with Open
* Build Service instances and with slight modification the Arch User Repository.
* Use for Launchpad PPAs has not been tested.
*/
public function package(string $commit = null): Result {
if (!$this->toolExists("git")) {
throw new \Exception("Git is required in PATH to produce packages");
}
[$commit, $version] = $this->commitVersion($commit);
$tarball = BASE."release/$version/arsse-$version.tar.gz";
// build the generic release tarball
$result = $this->taskExec(BASE."robo package:generic $commit")->run();
if (!$result->wasSuccessful()) {
return $result;
}
// if the generic tarball could be built, try to produce Arch, Debian, and RPM files; these might legitimately not exist in old releases
// start by getting the list of files from the tarball
$archive = new \Archive_Tar($tarball);
$filelist = array_flip(array_column($archive->listContent(), "filename"));
// start a collection
$t = $this->collectionBuilder();
// Produce an Arch PKGBUILD if appropriate
if (isset($filelist['arsse/dist/arch/PKGBUILD'])) {
$t->addCode(function() use ($tarball, $archive) {
$dir = dirname($tarball).\DIRECTORY_SEPARATOR;
$archive->extractList("arsse/dist/arch/PKGBUILD", $dir, "arsse/dist/arch/", false);
// update the tarball's checksum
$sums = [
'md5' => hash_file("md5", $tarball),
];
return $this->taskReplaceInFile($dir."PKGBUILD")->regex('/^md5sums=\("SKIP"\)$/m')->to('md5sums=("'.$sums['md5'].'")')->run();
});
}
// Produce a Debian source package if appropriate
if (isset($filelist['arsse/dist/debian/control']) && isset($filelist['arsse/dist/debian/source/format'])) {
$t->addTask($this->taskExec(BASE."robo package:debsrc $commit"));
}
// Produce an RPM spec file if appropriate
if (isset($filelist['arsse/dist/rpm/arsse.spec'])) {
$t->addCode(function() use ($tarball, $archive) {
$dir = dirname($tarball).\DIRECTORY_SEPARATOR;
$archive->extractList("arsse/dist/rpm/arsse.spec", $dir, "arsse/dist/rpm/", false);
// perform a do-nothing filesystem operation since we need a Robo task result
return $this->taskFilesystemStack()->chmod($dir."arsse.spec", 0644)->run();
});
}
return $t->run();
}
/** Packages a given commit of the software into a release tarball
*
* The commit to package may be any Git tree-ish identifier: a tag, a branch,
@ -187,7 +243,10 @@ class RoboFile extends \Robo\Tasks {
}
// establish which commit to package
[$commit, $version] = $this->commitVersion($commit);
$archVersion = preg_replace('/^([^-]+)-(\d+)-(\w+)$/', "$1.r$2.$3", $version);
preg_match('/^([^-]+)(?:-(\d+)-(\w+))?$/', $version, $m);
$archVersion = $m[1].($m[2] ? ".r$m[2].$m[3]" : "");
$baseVersion = $m[1];
$release = $m[2];
// name the generic release tarball
$tarball = BASE."release/$version/arsse-$version.tar.gz";
// start a collection
@ -200,22 +259,37 @@ class RoboFile extends \Robo\Tasks {
return $result;
}
try {
if (file_exists($dir."dist/debian")) {
// generate the Debian changelog; this also validates our original changelog
$debianChangelog = $this->changelogDebian($this->changelogParse(file_get_contents($dir."CHANGELOG"), $version), $version);
// save the Debian-format changelog
$t->addTask($this->taskWriteToFile($dir."dist/debian/changelog")->text($debianChangelog));
}
// Perform Arch-specific tasks
if (file_exists($dir."dist/arch")) {
// patch the Arch PKGBUILD file with the correct version string
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^pkgver=.*$/m')->to("pkgver=$archVersion"));
// patch the Arch PKGBUILD file with the correct source file
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^source=\("arsse-[^"]+"\)$/m')->to('source=("'.basename($tarball).'")'));
// perform Debian-specific tasks
if (file_exists($dir."dist/debian")) {
// generate the Debian changelog; this also validates our original changelog
$changelog = $this->changelogParse(file_get_contents($dir."CHANGELOG"), $version);
$debianChangelog = $this->changelogDebian($changelog, $version);
// save the Debian-format changelog
$t->addTask($this->taskWriteToFile($dir."dist/debian/changelog")->text($debianChangelog));
// perform RPM-specific tasks
if (file_exists($dir."dist/rpm")) {
// patch the spec file with the correct version and release
$t->addTask($this->taskReplaceInFile($dir."dist/rpm/arsse.spec")->regex('/^Version: .*$/m')->to("Version: $baseVersion"));
$t->addTask($this->taskReplaceInFile($dir."dist/rpm/arsse.spec")->regex('/^Release: .*$/m')->to("Release: $release"));
// patch the spec file with the correct tarball name
$t->addTask($this->taskReplaceInFile($dir."dist/rpm/arsse.spec")->regex('/^Source0: .*$/m')->to("Source0: arsse-$version.tar.gz"));
// append the RPM changelog to the spec file
$t->addTask($this->taskWriteToFile($dir."dist/rpm/arsse.spec")->append(true)->text("\n\n%changelog\n".$this->changelogRPM($changelog, $version)));
}
}
}
// save commit description to VERSION file for reference
$t->addTask($this->taskWriteToFile($dir."VERSION")->text($version));
// perform Composer installation in the temp location with dev dependencies
$t->addTask($this->taskComposerInstall()->arg("-q")->dir($dir));
if (file_exists($dir."docs") || file_exists($dir."manpages")) {
// perform Composer installation in the temp location with dev dependencies to include Robo and Daux
$t->addTask($this->taskExec("composer install")->arg("-q")->dir($dir));
}
if (file_exists($dir."manpages")) {
// generate manpages
$t->addTask($this->taskExec("./robo manpage")->dir($dir));
@ -225,7 +299,7 @@ class RoboFile extends \Robo\Tasks {
$t->addTask($this->taskExec("./robo manual -q")->dir($dir));
}
// perform Composer installation in the temp location for final output
$t->addTask($this->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts")->arg("-q"));
$t->addTask($this->taskExec("composer install")->dir($dir)->arg("--no-dev")->arg("-o")->arg("--no-scripts")->arg("-q"));
// delete unwanted files
$t->addTask($this->taskFilesystemStack()->remove([
$dir.".git",
@ -277,79 +351,6 @@ class RoboFile extends \Robo\Tasks {
return $result;
}
/** Packages a given commit of the software into an Arch package
*
* The commit to package may be any Git tree-ish identifier: a tag, a branch,
* or any commit hash. If none is provided on the command line, Robo will prompt
* for a commit to package; the default is "HEAD".
*
* The Arch base-devel group should be installed for this.
*/
public function packageArch(string $commit = null): Result {
if (!$this->toolExists("git", "makepkg", "updpkgsums")) {
throw new \Exception("Git, makepkg, and updpkgsums are required in PATH to produce Arch packages");
}
// establish which commit to package
[$commit, $version] = $this->commitVersion($commit);
$tarball = BASE."release/$version/arsse-$version.tar.gz";
$dir = dirname($tarball).\DIRECTORY_SEPARATOR;
// start a collection
$t = $this->collectionBuilder();
// build the generic release tarball if it doesn't exist
if (!file_exists($tarball)) {
$t->addTask($this->taskExec(BASE."robo package:generic $commit"));
}
// extract the PKGBUILD from the tarball
$t->addCode(function() use ($tarball, $dir) {
// because Robo doesn't support extracting a single file we have to do it ourselves
(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
return $this->taskFilesystemStack()->chmod($dir."PKGBUILD", 0644)->run();
})->completion($this->taskFilesystemStack()->remove($dir."PKGBUILD"));
// build the package
$t->addTask($this->taskExec("makepkg -Ccf")->dir($dir));
return $t->run();
}
/** Packages a given commit of the software a binary Debian package
*
* The commit to package may be any Git tree-ish identifier: a tag, a branch,
* or any commit hash. If none is provided on the command line, Robo will prompt
* for a commit to package; the default is "HEAD".
*
* The pbuilder tool should be installed for this.
*/
public function packageDeb(string $commit = null): Result {
if (!$this->toolExists("git", "sudo", "pbuilder")) {
throw new \Exception("Git, sudo, and pbuilder are required in PATH to produce Debian packages");
}
// establish which commit to package
[$commit, $version] = $this->commitVersion($commit);
$tarball = BASE."release/$version/arsse-$version.tar.gz";
// define some more variables
$tgz = BASE."release/pbuilder-arsse.tgz";
$bind = dirname($tarball);
$script = BASE."dist/debian/pbuilder.sh";
$user = trim(`id -un`);
$group = trim(`id -gn`);
// start a task collection
$t = $this->collectionBuilder();
// check that the pbuilder base exists and create it if it does not
if (!file_exists($tgz)) {
$t->addTask($this->taskFilesystemStack()->mkdir(BASE."release"));
$t->addTask($this->taskExec('sudo pbuilder create --basetgz '.escapeshellarg($tgz).' --mirror http://ftp.ca.debian.org/debian/ --extrapackages "debhelper devscripts lintian"'));
}
// build the generic release tarball if it doesn't exist
if (!file_exists($tarball)) {
$t->addTask($this->taskExec(BASE."robo package:generic $commit"));
}
// build the packages
$t->addTask($this->taskExec('sudo pbuilder execute --basetgz '.escapeshellarg($tgz).' --bindmounts '.escapeshellarg($bind).' -- '.escapeshellarg($script).' '.escapeshellarg("$bind/".basename($tarball))));
// take ownership of the output files
$t->addTask($this->taskExec("sudo chown -R $user:$group ".escapeshellarg($bind)));
return $t->run();
}
/** Packages a release tarball into a Debian source package
*
* The commit to package may be any Git tree-ish identifier: a tag, a branch,
@ -381,7 +382,7 @@ class RoboFile extends \Robo\Tasks {
// re-pack the tarball using a specific name special to Debian
$t->addTask($this->taskPack($dir."arsse_$baseVersion.orig.tar.gz")->addDir("arsse-$baseVersion", $base));
// pack the debian tarball
$t->addTask($this->taskPack($dir."arsse_$debVersion.debian.tar.gz")->addDir("debian", $base."dist"));
$t->addTask($this->taskPack($dir."arsse_$debVersion.debian.tar.gz")->addDir("debian", $base."dist/debian"));
// generate the DSC file
$t->addCode(function() use ($t, $debVersion, $baseVersion, $dir, $base) {
try {
@ -393,49 +394,73 @@ class RoboFile extends \Robo\Tasks {
return $this->taskWriteToFile($dir."arsse_$debVersion.dsc")->text($dsc)->run();
});
// delete any existing files
$t->AddTask($this->taskFilesystemStack()->remove(BASE."release/$version/arsse_$baseVersion.orig.tar.gz")->remove(BASE."release/$version/arsse_$debVersion.debian.tar.gz")->remove(BASE."release/$version/arsse_$debVersion.dsc"));
$t->AddTask($this->taskFilesystemStack()->remove([BASE."release/$version/arsse_$baseVersion.orig.tar.gz", BASE."release/$version/arsse_$debVersion.debian.tar.gz", BASE."release/$version/arsse_$debVersion.dsc"]));
// copy the new files over
$t->addTask($this->taskFilesystemStack()->copy($dir."arsse_$baseVersion.orig.tar.gz", BASE."release/$version/arsse_$baseVersion.orig.tar.gz")->copy($dir."arsse_$debVersion.debian.tar.gz", BASE."release/$version/arsse_$debVersion.debian.tar.gz")->copy($dir."arsse_$debVersion.dsc", BASE."release/$version/arsse_$debVersion.dsc"));
return $t->run();
}
/** Generates all possible package types for a given commit of the software
/** Generates all possible binary package types for a given commit of the software
*
* The commit to package may be any Git tree-ish identifier: a tag, a branch,
* or any commit hash. If none is provided on the command line, Robo will prompt
* for a commit to package; the default is "HEAD".
*
* Generic release tarballs will always be generated, but distribution-specific
* packages are skipped when the required tools are not available
*/
public function package(string $commit = null): Result {
if (!$this->toolExists("git")) {
throw new \Exception("Git is required in PATH to produce packages");
public function packageBin(string $commit = null, string $target = null): Result {
if (!$this->toolExists("git", "build", "sudo")) {
throw new \Exception("Git and OBS-Build are required in PATH to produce packages");
}
[$commit,] = $this->commitVersion($commit);
// determine whether the distribution-specific packages can be built
$dist = [
'Arch' => $this->toolExists("git", "makepkg", "updpkgsums"),
'Deb' => $this->toolExists("git", "sudo", "pbuilder"),
];
// start a collection
$t = $this->collectionBuilder();
// build the generic release tarball
$t->addTask($this->taskExec(BASE."robo package:generic $commit"));
// build other packages
foreach ($dist as $distro => $run) {
if ($run) {
$subcmd = strtolower($distro);
$t->addTask($this->taskExec(BASE."robo package:$subcmd $commit"));
[$commit, $version] = $this->commitVersion($commit);
$tarball = BASE."release/$version/arsse-$version.tar.gz";
$dir = dirname($tarball).\DIRECTORY_SEPARATOR;
// build the generic release tarball and related files if the tarball doesn't exist
if (!file_exists($tarball)) {
$result = $this->taskExec(BASE."robo package $commit")->run();
if (!$result->wasSuccessful()) {
return $result;
}
}
$out = $t->run();
// note any packages which were not built
foreach ($dist as $distro => $run) {
if (!$run) {
$this->say("Packages for $distro skipped");
// import settings
$settings = (@include BASE."release/settings.default.php");
$t = $this->collectionBuilder();
foreach ($settings as $target => $s) {
// glob the recipe and use the first one found
$recipe = glob($dir.$s['recipe']);
if (!$recipe) {
$this->yell("Build target '$target' skipped: recipe file not available");
continue;
}
if ($s['keys']) {
if (!$this->toolExists("rpm", "rpmkeys")) {
$this->yell("Build target '$target' skipped: RPM tools not available");
continue;
}
$installed = explode("\n", trim(`rpm -qa "gpg-pubkey*"`));
$missing = array_diff($s['keys'], $installed);
if ($missing) {
$this->yell("Build target '$target' skipped: the following RPM verificcation keys are not installed:\n".implode("\n", $missing));
continue;
}
}
$recipe = escapeshellarg($recipe[0]);
$dist = "--dist ".escapeshellarg($s['dist']);
$repo = implode(" ", array_map(function($repo) {
return "--repo ".escapeshellarg($repo);
}, $s['repos']));
// perform the build
$t->addTask($this->taskExec("sudo build --clean $dist $repo $recipe"));
// move the output files alongside the tarball
$t->addCode(function() use ($dir, $s, $target) {
$dir = $dir.$target.\DIRECTORY_SEPARATOR;
$stack = $this->taskFilesystemStack()->mkdir($dir);
foreach (glob("/var/tmp/build-root".$s['output']) as $f) {
$name = basename($f);
$stack->remove($dir.$name)->rename($f, $dir.$name);
}
return $stack->run();
});
}
return $out;
return $t->run();
}
/** Generates static manual pages in the "manual" directory
@ -584,6 +609,38 @@ class RoboFile extends \Robo\Tasks {
return $out;
}
protected function changelogRPM(array $log, string $targetVersion): string {
$latest = $log[0]['version'];
$baseVersion = preg_replace('/^(\d+(?:\.\d+)*).*/', "$1", $targetVersion);
if ($baseVersion !== $targetVersion && version_compare($latest, $baseVersion, ">")) {
// if the changelog contains an entry for a future version, change its version number to match the target version instead of using the future version
$log[0]['version'] = $targetVersion;
} elseif ($baseVersion !== $targetVersion) {
// otherwise synthesize a changelog entry for the changes since the last tag
array_unshift($log, ['version' => $targetVersion, 'date' => date("Y-m-d"), 'features' => [], 'fixes' => [], 'changes' => ["Unspecified changes"]]);
}
$out = "";
foreach ($log as $entry) {
$out .= "* ";
$out .= DateTimeImmutable::createFromFormat("!Y-m-d", $entry['date'], new \DateTimeZone("UTC"))->format("D M d Y");
$out .= " ";
$out .= "J. King <jking@jkingweb.ca>";
$out .= " ";
$out .= "{$entry['version']}\n";
foreach ($entry['features'] as $item) {
$out .= "- ".trim(preg_replace("/^/m", " ", $item))."\n";
}
foreach ($entry['fixes'] as $item) {
$out .= "- ".trim(preg_replace("/^/m", " ", $item))."\n";
}
foreach ($entry['changes'] as $item) {
$out .= "- ".trim(preg_replace("/^/m", " ", $item))."\n";
}
$out .= "\n";
}
return trim($out)."\n";
}
protected function changelogDebian(array $log, string $targetVersion): string {
$latest = $log[0]['version'];
$baseVersion = preg_replace('/^(\d+(?:\.\d+)*).*/', "$1", $targetVersion);

40
dist/debian/pbuilder.sh

@ -1,40 +0,0 @@
#! /bin/bash -e
###
# This script is fed to pbuilder to build Debian packages. The base tarball
# should be created with a command similar to the following:
#
# sudo pbuilder create --basetgz pbuilder-arsse.tgz --mirror http://ftp.ca.debian.org/debian/ --extrapackages "debhelper devscripts lintian"
#
# Thereafter pbuilder can be used to build packages with this command:
#
# sudo pbuilder execute --basetgz pbuilder-arsse.tgz --bindmounts `basedir "/path/to/release/tarball"` -- pbuilder.sh "/path/to/release/tarball"
#
# This somewhat roundabout procedure is used because the pbuilder debuild
# command does not seem to work in Arch Linux, nor does pdebuild. Doing
# as much as possible within the chroot itself works around these problems.
###
# create a temporary directory
tmp=`mktemp -d`
# define various variables
here=`dirname "$1"`
tarball=`basename "$1"`
version=`echo "$tarball" | grep -oP '\d+(?:\.\d+)*' | head -1`
out="$here/debian"
in="$tmp/arsse-$version"
# create necessary directories
mkdir -p "$in" "$out"
# extract the release tarball
tar -C "$in" -xf "$1" --strip-components=1
# repackage the release tarball into a Debian "orig" tarball
tar -C "$tmp" -czf "$tmp/arsse_$version.orig.tar.gz" "arsse-$version"
# copy the "dist/debian" directory down the tree where Debian expects it
cp -r "$in/dist/debian" "$in/debian"
# build the package
cd "$in"
debuild -us -uc
# move the resultant files to their final destination
find "$tmp" -maxdepth 1 -type f -exec mv '{}' "$out" \;

4
dist/debian/rules

@ -5,7 +5,7 @@ DH_VERBOSE = 1
%:
dh $@
execute_before_dh_install:
override_dh_install:
# Adapt the systemd service for Debian: this involves using only the "arsse-fetch" unit (renamed to "arsse"), removing the "PartOf" directive, and changing the user and group to "www-data"
cp dist/systemd/arsse-fetch.service debian/arsse.service
sed -i -se 's/^PartOf=.*//' debian/arsse.service
@ -24,3 +24,5 @@ execute_before_dh_install:
# Change PHP-FPM socket paths
cp -r dist/apache dist/nginx debian
sed -i -se 's/arsse\.sock/php-fpm.sock/' debian/apache/arsse.conf debian/nginx/arsse.conf
# Execute dh_install as normal
dh_install

189
dist/rpm/arsse.spec

@ -0,0 +1,189 @@
Name: arsse
Version: 0.10.0
Release: 0
Summary: Multi-protocol RSS/Atom newsfeed synchronization server
License: MIT
Group: Productivity/Networking/Web/Utilities
URL: https://thearsse.com/
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
%define minphpver 7.1
%define arssepath %{_datadir}/php/arsse
%define socketpath %{_rundir}/php-fpm/arsse.sock
Requires: php >= %{minphpver}
Requires: php-intl php-dom php-posix php-pcntl
Requires: php-simplexml php-iconv
# This is usually compiled in
Requires: php-filter
# The below extensions are part of the PHP core in recent versions
Requires: php-hash php-json
# A database option is required
Requires: (php-sqlite or php-pgsql)
# User and Group
Requires: user(arsse) group(arsse)
%systemd_requires
Recommends: php-sqlite
Suggests: php-curl
Suggests: (php-pgsql if postgresql-server)
Obsoletes: arsse < %{version}
BuildRequires: systemd-rpm-macros
BuildRequires: apache-rpm-macros
BuildRequires: sysuser-tools
%description
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.
%package config-fpm
Summary: PHP-FPM process pool configuration for The Arsse
Group: Productivity/Networking/Web/Utilities
Requires: php-fpm >= %{minphpver}
Requires: %{name} = %{version}-%{release}
Provides: arsse-config-fpm = %{version}
Obsoletes: arsse-config-fpm < %{version}
Supplements: packageand(php-fpm:arsse)
%description config-fpm
PHP-FPM process pool configuration for The Arsse
%package config-nginx-fpm
Summary: Nginx Web server configuration for The Arsse using PHP-FPM
Group: Productivity/Networking/Web/Utilities
Requires: arsse-fpm
Requires: nginx
Requires: %{name} = %{version}-%{release}
Provides: arsse-config-nginx-fpm = %{version}
Obsoletes: arsse-config-nginx-fpm < %{version}
Supplements: packageand(apache2:arsse)
%description config-nginx-fpm
Nginx Web server configuration for The Arsse using PHP-FPM. Using Ngix is
generally preferred as it receives more testing.
%package config-apache-fpm
Summary: Apache Web server configuration for The Arsse using PHP-FPM
Group: Productivity/Networking/Web/Utilities
Requires: arsse-fpm
Requires: %{name} = %{version}-%{release}
Requires: apache2 >= 2.4
Provides: arsse-config-apache-fpm = %{version}
Obsoletes: arsse-config-apache-fpm < %{version}
Supplements: packageand(apache2:arsse)
%description config-apache-fpm
Apache Web server configuration for The Arsse using PHP-FPM. Using Ngix is
generally preferred as it receives more testing.
%package -n system-user-arsse
Summary: System user and group arsse
Group: System/Fhs
%{sysusers_requires}
%description -n system-user-arsse
This package provides the system account and group 'arsse'.
%prep
%setup -q -n %{name}
# Patch the executable so it does not use env as the interpreter; RPMLint complains about this
sed -i -s 's|/usr/bin/env php|{_bindir}/php|' dist/arsse
# Remove stray executable
rm -f vendor/nicolus/picofeed/picofeed
# Patch the systemd unit file to remove the binding to the PHP-FPM service
sed -i -s 's|^PartOf=.*||' dist/systemd/arsse-fetch.service
# Patch PHP-FPM pool and Web server configuration with correct socket path
sed -i -s 's|/var/run/php/arsse\.sock|%{socketpath}|' dist/php-fpm.conf dist/nginx/* dist/apache/*
# Patch various files to adjust installation path
sed -i -s 's|/usr/share/arsse/|%{arssepath}/|' dist/arsse dist/nginx/* dist/apache/* dist/tmpfiles.conf
sed -i -s 's|/usr/share/arsse|%{arssepath}|' dist/systemd/arsse-fetch.service
# Patch configuration files to adjust other paths (they're probably already correct)
sed -i -s 's|/etc/arsse/|%{_sysconfdir}/arsse/|' dist/nginx/* dist/apache/* dist/tmpfiles.conf
sed -i -s 's|/usr/bin/|%{_bindir}/|' dist/systemd/arsse-fetch.service
sed -i -s 's|/var/lib|%{_sharedstatedir}|' dist/systemd/arsse-fetch.service dist/tmpfiles.conf dist/config.php
# Patch Web server configuration to use unique hostname; "news" is recommended, but might conflict with other example configuration
sed -i -s 's|news.example.com|arsse.example.com|' dist/nginx/* dist/apache/*
# Comment out any TLS-related configuration in Nginx example
sed -i -s 's|^\([ \t]*\)ssl_|\1#ssl_|' dist/nginx/example.conf
sed -i -s 's|^\([ \t]*\)\(listen \(\[::\]:\)\?443\)|\1#\2|' dist/nginx/example.conf
%build
%sysusers_generate_pre dist/sysuser.conf arsse system-user-arsse.conf
%install
mkdir -p "%{buildroot}%{_mandir}" "%{buildroot}%{_unitdir}" "%{buildroot}%{_sysusersdir}" "%{buildroot}%{_tmpfilesdir}" "%{buildroot}%{_bindir}"
mkdir -p "%{buildroot}%{_sysconfdir}/nginx/vhosts.d" "%{buildroot}%{_sysconfdir}/php7/fpm/php-fpm.d/" "%{buildroot}%{_sysconfdir}/php8/fpm/php-fpm.d/"
mkdir -p "%{buildroot}%{arssepath}" "%{buildroot}%{_sysconfdir}/arsse" "%{buildroot}%{_sysconfdir}/arsse/nginx" "%{buildroot}%{_sysconfdir}/arsse/apache"
cp -r lib locale sql vendor www CHANGELOG UPGRADING README.md arsse.php "%{buildroot}%{arssepath}"
cp -r dist/man/* "%{buildroot}%{_mandir}"
cp dist/systemd/arsse-fetch.service "%{buildroot}%{_unitdir}/arsse.service"
install dist/php-fpm.conf "%{buildroot}%{_sysconfdir}/php7/fpm/php-fpm.d/arsse.conf"
install dist/php-fpm.conf "%{buildroot}%{_sysconfdir}/php8/fpm/php-fpm.d/arsse.conf"
install dist/nginx/arsse*.conf "%{buildroot}%{_sysconfdir}/arsse/nginx"
install dist/nginx/example.conf "%{buildroot}%{_sysconfdir}/nginx/vhosts.d/arsse.conf"
install dist/apache/arsse* "%{buildroot}%{_sysconfdir}/arsse/apache"
install dist/sysuser.conf "%{buildroot}%{_sysusersdir}/system-user-arsse.conf"
install dist/tmpfiles.conf "%{buildroot}%{_tmpfilesdir}/arsse.conf"
install config.defaults.php "%{buildroot}%{_sysconfdir}/arsse"
install -m 640 dist/config.php "%{buildroot}%{_sysconfdir}/arsse/config.php"
install -m 755 dist/arsse "%{buildroot}%{_bindir}/arsse"
%files
%dir %{_datadir}/php
%dir %{_sysconfdir}/arsse
%{arssepath}
%{_sysconfdir}/arsse/config.php
%{_sysconfdir}/arsse/config.defaults.php
%{_mandir}/man*/arsse.*
%{_unitdir}/arsse.service
%{_tmpfilesdir}/arsse.conf
%attr(755, root, root) %{_bindir}/arsse
%license LICENSE AUTHORS
%doc manual/*
%files config-fpm
%dir %{_sysconfdir}/php7
%dir %{_sysconfdir}/php8
%dir %{_sysconfdir}/php7/fpm
%dir %{_sysconfdir}/php8/fpm
%dir %{_sysconfdir}/php7/fpm/php-fpm.d
%dir %{_sysconfdir}/php8/fpm/php-fpm.d
%{_sysconfdir}/php7/fpm/php-fpm.d/arsse.conf
%{_sysconfdir}/php8/fpm/php-fpm.d/arsse.conf
%files config-nginx-fpm
%dir %{_sysconfdir}/arsse
%dir %{_sysconfdir}/arsse/nginx
%dir %{_sysconfdir}/nginx
%dir %{_sysconfdir}/nginx/vhosts.d
%{_sysconfdir}/arsse/nginx/*
%config(noreplace) %{_sysconfdir}/nginx/vhosts.d/arsse.conf
%files config-apache-fpm
%dir %{_sysconfdir}/arsse
%dir %{_sysconfdir}/arsse/apache
%{_sysconfdir}/arsse/apache/arsse*
%files -n system-user-arsse
%{_sysusersdir}/system-user-arsse.conf
%pre
%service_add_pre arsse.service arsse.service
%post
%tmpfiles_create "%{_tmpfilesdir}/arsse.conf"
%service_add_post arsse.service arsse.service
%preun
%service_del_preun arsse.service
%postun
%service_del_postun arsse.service
%service_del_postun_without_restart arsse.service
%pre -n system-user-arsse -f arsse.pre

24
release/settings.default.php

@ -0,0 +1,24 @@
<?php
return [
'arch' => [
'dist' => "arch",
'recipe' => "PKGBUILD",
'repos' => ["http://mirror.csclub.uwaterloo.ca/archlinux/core/os/x86_64/", "http://mirror.csclub.uwaterloo.ca/archlinux/extra/os/x86_64/"],
'keys' => [],
'output' => "/usr/src/packages/ARCHPKGS/*.pkg.tar.zst",
],
'debian' => [
'dist' => "debian10",
'recipe' => "*.dsc",
'repos' => ["http://ftp.ca.debian.org/debian/?dist=buster&component=main"],
'keys' => [],
'output' => "/usr/src/packages/DEBS/*.deb",
],
'suse' => [
'dist' => "sl15.3",
'recipe' => "arsse.spec",
'repos' => ["http://mirror.csclub.uwaterloo.ca/opensuse/distribution/leap/15.3/repo/oss/"],
'keys' => ["gpg-pubkey-39db7c82-5f68629b", "gpg-pubkey-65176565-5d94a381", "gpg-pubkey-307e3d54-5aaa90a5", "gpg-pubkey-3dbdc284-53674dd4"],
'output' => "/home/abuild/rpmbuild/RPMS/noarch/*.rpm",
],
];
Loading…
Cancel
Save