Hi!
First a little context. I'm in the process of packaging bup [1] (review request [2]), a backup system based on the git packfile format.
One of its sub-commands/functionalities is "bup web" [3], a web server for browsing through bup repositories. By default, "bup web" will show the bup repository stored in user's ~/.bup directory. Thus, it seems most appropriate to provide a systemd user instance service which a user can enable and start.
Since the current systemd packaging guidelines [4] don't mention user instance services at all, I've researched this a bit and found that the systemd package ships /usr/lib/rpm/macros.d/macros.systemd file, which contains various "user" macros: - %_userunitdir - %systemd_user_post - %systemd_user_preun - %systemd_user_postun - %systemd_user_postun_with_restart
My naive attempt at using them was to follow [4] and just replace all % systemd_* calls with appropriate %systemd_user_* calls (and %_unitdir with %_userunitdir). The SPEC file can be viewed here: https://github.com/tjanez/bup-package/blob/5f4abed/bup.spec
However, this doesn't work as expected. This is the output of rpmlint:
Rpmlint ------- Checking: bup-0.27-0.3.fc24.x86_64.rpm bup-web-0.27-0.3.fc24.x86_64.rpm bup-0.27-0.3.fc24.src.rpm bup.x86_64: W: spelling-error Summary(en_US) packfile -> pack file, pack-file, packsaddle [... trimmed spelling warnings ...] bup-web.x86_64: W: empty-%postun bup.src: W: spelling-error Summary(en_US) packfile -> pack file, pack-file, packsaddle [... trimmed spelling warnings ...] bup.src: E: specfile-error systemd_post: invalid option -- '-' bup.src: E: specfile-error error: Unknown option - in systemd_post() 3 packages and 0 specfiles checked; 2 errors, 15 warnings.
Rpmlint (installed packages) ---------------------------- bup-web.x86_64: W: empty-%postun 3 packages and 0 specfiles checked; 0 errors, 1 warnings.
I would appreciate help and feedback on this topic.
Thanks and regards, Tadej
[1] https://bup.github.io/ [2] https://bugzilla.redhat.com/show_bug.cgi?id=1222334 [3] http://bup.github.io/man/bup-web.html [4] https://fedoraproject.org/wiki/Packaging:Systemd
Hi Tadej,
On Thursday, 22 October 2015 at 10:03, Tadej Janež wrote:
Hi!
[...]
My naive attempt at using them was to follow [4] and just replace all % systemd_* calls with appropriate %systemd_user_* calls (and %_unitdir with %_userunitdir). The SPEC file can be viewed here: https://github.com/tjanez/bup-package/blob/5f4abed/bup.spec
However, this doesn't work as expected. This is the output of rpmlint:
Rpmlint
Checking: bup-0.27-0.3.fc24.x86_64.rpm bup-web-0.27-0.3.fc24.x86_64.rpm bup-0.27-0.3.fc24.src.rpm bup.x86_64: W: spelling-error Summary(en_US) packfile -> pack file, pack-file, packsaddle [... trimmed spelling warnings ...] bup-web.x86_64: W: empty-%postun bup.src: W: spelling-error Summary(en_US) packfile -> pack file, pack-file, packsaddle [... trimmed spelling warnings ...] bup.src: E: specfile-error systemd_post: invalid option -- '-' bup.src: E: specfile-error error: Unknown option - in systemd_post() 3 packages and 0 specfiles checked; 2 errors, 15 warnings.
I wouldn't worry about rpmlint errors in this case. As you said yourself, there are not specific guidelines for packaging user instance services, so you've just entered unknown territory, so rpmlint errors related to that might be expected.
Does the user instance service work as expected? If yes, then we would very much appreciate it if you documented your efforts in form of an update to the systemd packaging guidelines and submitted it in fpc trac (https://fedorahosted.org/fpc/). Filing a bug against rpmlint to support this way of service packaging is of course also a good idea.
[...]
Regards, Dominik
Hi Dominik,
On Thu, 2015-10-22 at 10:27 +0200, Dominik 'Rathann' Mierzejewski wrote:
On Thursday, 22 October 2015 at 10:03, Tadej Janež wrote:
Hi!
[...]
My naive attempt at using them was to follow [4] and just replace all % systemd_* calls with appropriate %systemd_user_* calls (and %_unitdir with %_userunitdir). The SPEC file can be viewed here: https://github.com/tjanez/bup-package/blob/5f4abed/bup.spec
However, this doesn't work as expected. This is the output of rpmlint:
Rpmlint
Checking: bup-0.27-0.3.fc24.x86_64.rpm bup-web-0.27-0.3.fc24.x86_64.rpm bup-0.27-0.3.fc24.src.rpm bup.x86_64: W: spelling-error Summary(en_US) packfile -> pack file, pack-file, packsaddle [... trimmed spelling warnings ...] bup-web.x86_64: W: empty-%postun bup.src: W: spelling-error Summary(en_US) packfile -> pack file, pack-file, packsaddle [... trimmed spelling warnings ...] bup.src: E: specfile-error systemd_post: invalid option -- '-' bup.src: E: specfile-error error: Unknown option - in systemd_post() 3 packages and 0 specfiles checked; 2 errors, 15 warnings.
I wouldn't worry about rpmlint errors in this case. As you said yourself, there are not specific guidelines for packaging user instance services, so you've just entered unknown territory, so rpmlint errors related to that might be expected.
I understand, thanks for the explanation!
Does the user instance service work as expected? If yes, then we would very much appreciate it if you documented your efforts in form of an update to the systemd packaging guidelines and submitted it in fpc trac (https://fedorahosted.org/fpc/). Filing a bug against rpmlint to support this way of service packaging is of course also a good idea.
Sure, I'll be happy to propose an update to the systemd packaging guidelines to the FPC.
But first I would like to ask for some help regarding these systemd macros.
The %systemd_user_post macro is defined as: %systemd_user_post() %systemd_post --user --global %{?*}
And the %systemd_post macro is defined as: %systemd_post() \ if [ $1 -eq 1 ] ; then \ # Initial installation \ systemctl preset %{?*} >/dev/null 2>&1 || : \ fi \ %{nil}
Calling %systemd_user_post gives the following error: [vagrant@localhost ~]$ rpm --eval '%systemd_user_post bup-web' systemd_post: invalid option -- '-' error: Unknown option - in systemd_post()
if [ $1 -eq 1 ] ; then # Initial installation systemctl preset bup-web >/dev/null 2>&1 || : fi
It appears to be a problem with the %systemd_post macro since calling it without parameters (just with the 'bup-web' argument) works: [vagrant@localhost ~]$ rpm --eval '%systemd_post bup-web'
if [ $1 -eq 1 ] ; then # Initial installation systemctl preset bup-web >/dev/null 2>&1 || : fi
However, if I try to pass some parameters (besides arguments) to it, it returns an error: [vagrant@localhost ~]$ rpm --eval '%systemd_post --user bup-web' systemd_post: invalid option -- '-' error: Unknown option - in systemd_post()
if [ $1 -eq 1 ] ; then # Initial installation systemctl preset >/dev/null 2>&1 || : fi
Any ideas what's going on here and how to make it work?
Thanks and regards, Tadej
Hi!
On Sun, 2015-10-25 at 09:21 +0100, Tadej Janež wrote:
But first I would like to ask for some help regarding these systemd macros.
[...]
Calling %systemd_user_post gives the following error: [vagrant@localhost ~]$ rpm --eval '%systemd_user_post bup-web' systemd_post: invalid option -- '-' error: Unknown option - in systemd_post()
if [ $1 -eq 1 ] ; then # Initial installation systemctl preset bup-web >/dev/null 2>&1 || : fi
[...]
Any ideas what's going on here and how to make it work?
FWIW, I've followed this up on the upstream rpm mailing list: http://lists.rpm.org/pipermail/rpm-list/2015-November/001798.html
The resulting fix has been merged into systemd: https://github.com/systemd/systemd/commit/e67ba783696f21782ad5c2ba00515d3870...
Regards, Tadej
packaging@lists.fedoraproject.org