[v2] Add pacman-syncdb: systemd service and timer for `pacman -Fy`.

Message ID 20210801003249.28970-1-tbperrotta@gmail.com
State Accepted
Headers show
Series [v2] Add pacman-syncdb: systemd service and timer for `pacman -Fy`. | expand

Commit Message

Thiago Perrotta Aug. 1, 2021, 12:32 a.m. UTC
`pacman -Fy` is a modern replacement for `pkgfile`[1].

This service/timer makes `pacman -Fy` have feature parity with
`pkgfile`.

The unit files were based on both pkgfile and paccache, for consistency
with the existing ecosystem.

Context: https://bbs.archlinux.org/viewtopic.php?pid=1981076

[1]: https://wiki.archlinux.org/title/Pacman#Search_for_a_package_that_contains_a_specific_file

Signed-off-by: Thiago Perrotta <tbperrotta@gmail.com>
---
V2:

- Added Signed-off-by byline
- Added nss-lookup.target to After= as suggested by @nl6720

 CHANGES.md                   |  1 +
 src/Makefile.am              |  8 ++++++--
 src/pacman-syncdb.service.in | 12 ++++++++++++
 src/pacman-syncdb.timer      | 10 ++++++++++
 4 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 src/pacman-syncdb.service.in
 create mode 100644 src/pacman-syncdb.timer

Comments

Daniel M. Capella Aug. 2, 2021, 9:35 p.m. UTC | #1
On July 31, 2021 8:32:49 PM EDT, Thiago Perrotta via pacman-contrib <pacman-contrib@lists.archlinux.org> wrote:
> `pacman -Fy` is a modern replacement for `pkgfile`[1].
> 
> This service/timer makes `pacman -Fy` have feature parity with
> `pkgfile`.
> 
> The unit files were based on both pkgfile and paccache, for consistency
> with the existing ecosystem.
> 
> Context: https://bbs.archlinux.org/viewtopic.php?pid=1981076
> 
> [1]: https://wiki.archlinux.org/title/Pacman#Search_for_a_package_that_contains_a_specific_file
> 
> Signed-off-by: Thiago Perrotta <tbperrotta@gmail.com>
> ---
> V2:
> 
> - Added Signed-off-by byline
> - Added nss-lookup.target to After= as suggested by @nl6720
> 
>  CHANGES.md                   |  1 +
>  src/Makefile.am              |  8 ++++++--
>  src/pacman-syncdb.service.in | 12 ++++++++++++
>  src/pacman-syncdb.timer      | 10 ++++++++++
>  4 files changed, 29 insertions(+), 2 deletions(-)
>  create mode 100644 src/pacman-syncdb.service.in
>  create mode 100644 src/pacman-syncdb.timer
> 
> diff --git a/CHANGES.md b/CHANGES.md
> index 80f02bb..96a441b 100644
> --- a/CHANGES.md
> +++ b/CHANGES.md
> @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
>  
>  ## [Unreleased]
>  ### Added
> +- pacman-syncdb: systemd service and timer for `pacman -Fy` (https://bbs.archlinux.org/viewtopic.php?pid=1981076)
>  
>  ### Changed
>  
> diff --git a/src/Makefile.am b/src/Makefile.am
> index eef0590..cbc8bd0 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -30,7 +30,8 @@ vim_syntax__DATA = \
>  systemd_dir = ${libdir}/systemd/system
>  
>  systemd__DATA = \
> -	paccache.service paccache.timer
> +	paccache.service paccache.timer \
> +	pacman-syncdb.service pacman-syncdb.timer
>  
>  BASHSCRIPTS = \
>  	checkupdates \
> @@ -50,7 +51,8 @@ OURSCRIPTS = \
>  	$(PERLSCRIPTS)
>  
>  OURFILES = \
> -	paccache.service
> +	paccache.service \
> +	pacman-syncdb.service
>  
>  EXTRA_DIST = \
>  	checkupdates.sh.in \
> @@ -60,6 +62,8 @@ EXTRA_DIST = \
>  	pacdiff.sh.in \
>  	paclist.sh.in \
>  	paclog-pkglist.sh.in \
> +	pacman-syncdb.service.in \
> +	pacman-syncdb.timer \
>  	pacscripts.sh.in \
>  	pacsearch.pl.in \
>  	pacsort.c \
> diff --git a/src/pacman-syncdb.service.in b/src/pacman-syncdb.service.in
> new file mode 100644
> index 0000000..26cbe6d
> --- /dev/null
> +++ b/src/pacman-syncdb.service.in
> @@ -0,0 +1,12 @@
> +[Unit]
> +Description=Download pacman fresh files databases from the server
> +RequiresMountsFor="/var/lib/pacman/sync"
> +After=network-online.target nss-lookup.target
> +Wants=network-online.target
> +
> +[Service]
> +Type=oneshot
> +ExecStart=@bindir@/pacman -Fy
> +Nice=19
> +StandardOutput=null
> +StandardError=journal
> diff --git a/src/pacman-syncdb.timer b/src/pacman-syncdb.timer
> new file mode 100644
> index 0000000..2562443
> --- /dev/null
> +++ b/src/pacman-syncdb.timer
> @@ -0,0 +1,10 @@
> +[Unit]
> +Description=Download pacman fresh files databases from the server weekly
> +
> +[Timer]
> +OnCalendar=weekly
> +AccuracySec=1h
> +Persistent=true
> +
> +[Install]
> +WantedBy=timers.target

Pushed, thank you!

--
Best,
Daniel <https://danielcapella.com>
morganamilo Aug. 2, 2021, 9:58 p.m. UTC | #2
On 02/08/2021 22:35, Daniel M. Capella via pacman-contrib wrote:
> On July 31, 2021 8:32:49 PM EDT, Thiago Perrotta via pacman-contrib <pacman-contrib@lists.archlinux.org> wrote:
>> `pacman -Fy` is a modern replacement for `pkgfile`[1].
>>
>> This service/timer makes `pacman -Fy` have feature parity with
>> `pkgfile`.
>>
>> The unit files were based on both pkgfile and paccache, for consistency
>> with the existing ecosystem.
>>
>> Context: https://bbs.archlinux.org/viewtopic.php?pid=1981076
>>
>> [1]: https://wiki.archlinux.org/title/Pacman#Search_for_a_package_that_contains_a_specific_file
>>
>> Signed-off-by: Thiago Perrotta <tbperrotta@gmail.com>
>> ---
>> V2:
>>
>> - Added Signed-off-by byline
>> - Added nss-lookup.target to After= as suggested by @nl6720
>>
>>  CHANGES.md                   |  1 +
>>  src/Makefile.am              |  8 ++++++--
>>  src/pacman-syncdb.service.in | 12 ++++++++++++
>>  src/pacman-syncdb.timer      | 10 ++++++++++
>>  4 files changed, 29 insertions(+), 2 deletions(-)
>>  create mode 100644 src/pacman-syncdb.service.in
>>  create mode 100644 src/pacman-syncdb.timer
>>
>> diff --git a/CHANGES.md b/CHANGES.md
>> index 80f02bb..96a441b 100644
>> --- a/CHANGES.md
>> +++ b/CHANGES.md
>> @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
>>  
>>  ## [Unreleased]
>>  ### Added
>> +- pacman-syncdb: systemd service and timer for `pacman -Fy` (https://bbs.archlinux.org/viewtopic.php?pid=1981076)
>>  
>>  ### Changed
>>  
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index eef0590..cbc8bd0 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -30,7 +30,8 @@ vim_syntax__DATA = \
>>  systemd_dir = ${libdir}/systemd/system
>>  
>>  systemd__DATA = \
>> -	paccache.service paccache.timer
>> +	paccache.service paccache.timer \
>> +	pacman-syncdb.service pacman-syncdb.timer
>>  
>>  BASHSCRIPTS = \
>>  	checkupdates \
>> @@ -50,7 +51,8 @@ OURSCRIPTS = \
>>  	$(PERLSCRIPTS)
>>  
>>  OURFILES = \
>> -	paccache.service
>> +	paccache.service \
>> +	pacman-syncdb.service
>>  
>>  EXTRA_DIST = \
>>  	checkupdates.sh.in \
>> @@ -60,6 +62,8 @@ EXTRA_DIST = \
>>  	pacdiff.sh.in \
>>  	paclist.sh.in \
>>  	paclog-pkglist.sh.in \
>> +	pacman-syncdb.service.in \
>> +	pacman-syncdb.timer \
>>  	pacscripts.sh.in \
>>  	pacsearch.pl.in \
>>  	pacsort.c \
>> diff --git a/src/pacman-syncdb.service.in b/src/pacman-syncdb.service.in
>> new file mode 100644
>> index 0000000..26cbe6d
>> --- /dev/null
>> +++ b/src/pacman-syncdb.service.in
>> @@ -0,0 +1,12 @@
>> +[Unit]
>> +Description=Download pacman fresh files databases from the server
>> +RequiresMountsFor="/var/lib/pacman/sync"
>> +After=network-online.target nss-lookup.target
>> +Wants=network-online.target
>> +
>> +[Service]
>> +Type=oneshot
>> +ExecStart=@bindir@/pacman -Fy
>> +Nice=19
>> +StandardOutput=null
>> +StandardError=journal
>> diff --git a/src/pacman-syncdb.timer b/src/pacman-syncdb.timer
>> new file mode 100644
>> index 0000000..2562443
>> --- /dev/null
>> +++ b/src/pacman-syncdb.timer
>> @@ -0,0 +1,10 @@
>> +[Unit]
>> +Description=Download pacman fresh files databases from the server weekly
>> +
>> +[Timer]
>> +OnCalendar=weekly
>> +AccuracySec=1h
>> +Persistent=true
>> +
>> +[Install]
>> +WantedBy=timers.target
> 
> Pushed, thank you!
> 
> --
> Best,
> Daniel <https://danielcapella.com>
> 

May be a bit late now but the name of the service really should be
pacman-filesdb instead of pacman-syncdb.

Also the description is a little broken and could be something simpler
like "Refresh pacman files database".
Daniel M. Capella Aug. 3, 2021, 3:34 a.m. UTC | #3
On 8/2/21 5:58 PM, Morgan Adamiec via pacman-contrib wrote:
>
> On 02/08/2021 22:35, Daniel M. Capella via pacman-contrib wrote:
>> On July 31, 2021 8:32:49 PM EDT, Thiago Perrotta via pacman-contrib <pacman-contrib@lists.archlinux.org> wrote:
>>> `pacman -Fy` is a modern replacement for `pkgfile`[1].
>>>
>>> This service/timer makes `pacman -Fy` have feature parity with
>>> `pkgfile`.
>>>
>>> The unit files were based on both pkgfile and paccache, for consistency
>>> with the existing ecosystem.
>>>
>>> Context: https://bbs.archlinux.org/viewtopic.php?pid=1981076
>>>
>>> [1]: https://wiki.archlinux.org/title/Pacman#Search_for_a_package_that_contains_a_specific_file
>>>
>>> Signed-off-by: Thiago Perrotta <tbperrotta@gmail.com>
>>> ---
>>> V2:
>>>
>>> - Added Signed-off-by byline
>>> - Added nss-lookup.target to After= as suggested by @nl6720
>>>
>>>   CHANGES.md                   |  1 +
>>>   src/Makefile.am              |  8 ++++++--
>>>   src/pacman-syncdb.service.in | 12 ++++++++++++
>>>   src/pacman-syncdb.timer      | 10 ++++++++++
>>>   4 files changed, 29 insertions(+), 2 deletions(-)
>>>   create mode 100644 src/pacman-syncdb.service.in
>>>   create mode 100644 src/pacman-syncdb.timer
>>>
>>> diff --git a/CHANGES.md b/CHANGES.md
>>> index 80f02bb..96a441b 100644
>>> --- a/CHANGES.md
>>> +++ b/CHANGES.md
>>> @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
>>>   
>>>   ## [Unreleased]
>>>   ### Added
>>> +- pacman-syncdb: systemd service and timer for `pacman -Fy` (https://bbs.archlinux.org/viewtopic.php?pid=1981076)
>>>   
>>>   ### Changed
>>>   
>>> diff --git a/src/Makefile.am b/src/Makefile.am
>>> index eef0590..cbc8bd0 100644
>>> --- a/src/Makefile.am
>>> +++ b/src/Makefile.am
>>> @@ -30,7 +30,8 @@ vim_syntax__DATA = \
>>>   systemd_dir = ${libdir}/systemd/system
>>>   
>>>   systemd__DATA = \
>>> -	paccache.service paccache.timer
>>> +	paccache.service paccache.timer \
>>> +	pacman-syncdb.service pacman-syncdb.timer
>>>   
>>>   BASHSCRIPTS = \
>>>   	checkupdates \
>>> @@ -50,7 +51,8 @@ OURSCRIPTS = \
>>>   	$(PERLSCRIPTS)
>>>   
>>>   OURFILES = \
>>> -	paccache.service
>>> +	paccache.service \
>>> +	pacman-syncdb.service
>>>   
>>>   EXTRA_DIST = \
>>>   	checkupdates.sh.in \
>>> @@ -60,6 +62,8 @@ EXTRA_DIST = \
>>>   	pacdiff.sh.in \
>>>   	paclist.sh.in \
>>>   	paclog-pkglist.sh.in \
>>> +	pacman-syncdb.service.in \
>>> +	pacman-syncdb.timer \
>>>   	pacscripts.sh.in \
>>>   	pacsearch.pl.in \
>>>   	pacsort.c \
>>> diff --git a/src/pacman-syncdb.service.in b/src/pacman-syncdb.service.in
>>> new file mode 100644
>>> index 0000000..26cbe6d
>>> --- /dev/null
>>> +++ b/src/pacman-syncdb.service.in
>>> @@ -0,0 +1,12 @@
>>> +[Unit]
>>> +Description=Download pacman fresh files databases from the server
>>> +RequiresMountsFor="/var/lib/pacman/sync"
>>> +After=network-online.target nss-lookup.target
>>> +Wants=network-online.target
>>> +
>>> +[Service]
>>> +Type=oneshot
>>> +ExecStart=@bindir@/pacman -Fy
>>> +Nice=19
>>> +StandardOutput=null
>>> +StandardError=journal
>>> diff --git a/src/pacman-syncdb.timer b/src/pacman-syncdb.timer
>>> new file mode 100644
>>> index 0000000..2562443
>>> --- /dev/null
>>> +++ b/src/pacman-syncdb.timer
>>> @@ -0,0 +1,10 @@
>>> +[Unit]
>>> +Description=Download pacman fresh files databases from the server weekly
>>> +
>>> +[Timer]
>>> +OnCalendar=weekly
>>> +AccuracySec=1h
>>> +Persistent=true
>>> +
>>> +[Install]
>>> +WantedBy=timers.target
>> Pushed, thank you!
>>
>> --
>> Best,
>> Daniel <https://danielcapella.com>
>>
> May be a bit late now but the name of the service really should be
> pacman-filesdb instead of pacman-syncdb.
>
> Also the description is a little broken and could be something simpler
> like "Refresh pacman files database".


Patch sent:

https://lists.archlinux.org/pipermail/pacman-contrib/2021-August/000383.html

Patch

diff --git a/CHANGES.md b/CHANGES.md
index 80f02bb..96a441b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 ## [Unreleased]
 ### Added
+- pacman-syncdb: systemd service and timer for `pacman -Fy` (https://bbs.archlinux.org/viewtopic.php?pid=1981076)
 
 ### Changed
 
diff --git a/src/Makefile.am b/src/Makefile.am
index eef0590..cbc8bd0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,7 +30,8 @@  vim_syntax__DATA = \
 systemd_dir = ${libdir}/systemd/system
 
 systemd__DATA = \
-	paccache.service paccache.timer
+	paccache.service paccache.timer \
+	pacman-syncdb.service pacman-syncdb.timer
 
 BASHSCRIPTS = \
 	checkupdates \
@@ -50,7 +51,8 @@  OURSCRIPTS = \
 	$(PERLSCRIPTS)
 
 OURFILES = \
-	paccache.service
+	paccache.service \
+	pacman-syncdb.service
 
 EXTRA_DIST = \
 	checkupdates.sh.in \
@@ -60,6 +62,8 @@  EXTRA_DIST = \
 	pacdiff.sh.in \
 	paclist.sh.in \
 	paclog-pkglist.sh.in \
+	pacman-syncdb.service.in \
+	pacman-syncdb.timer \
 	pacscripts.sh.in \
 	pacsearch.pl.in \
 	pacsort.c \
diff --git a/src/pacman-syncdb.service.in b/src/pacman-syncdb.service.in
new file mode 100644
index 0000000..26cbe6d
--- /dev/null
+++ b/src/pacman-syncdb.service.in
@@ -0,0 +1,12 @@ 
+[Unit]
+Description=Download pacman fresh files databases from the server
+RequiresMountsFor="/var/lib/pacman/sync"
+After=network-online.target nss-lookup.target
+Wants=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=@bindir@/pacman -Fy
+Nice=19
+StandardOutput=null
+StandardError=journal
diff --git a/src/pacman-syncdb.timer b/src/pacman-syncdb.timer
new file mode 100644
index 0000000..2562443
--- /dev/null
+++ b/src/pacman-syncdb.timer
@@ -0,0 +1,10 @@ 
+[Unit]
+Description=Download pacman fresh files databases from the server weekly
+
+[Timer]
+OnCalendar=weekly
+AccuracySec=1h
+Persistent=true
+
+[Install]
+WantedBy=timers.target