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

Message ID 20210711012306.13212-1-tbperrotta@gmail.com
State Deferred
Headers show
Series Add pacman-syncdb: systemd service and timer for `pacman -Fy`. | expand

Commit Message

tbperrotta--- via pacman-contrib July 11, 2021, 1:23 a.m. UTC
From: Thiago Perrotta <tbperrotta@gmail.com>

`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
---
 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 July 28, 2021, 12:02 a.m. UTC | #1
Thank you!


Please resubmit this with a signoff. You could add one with:

`git commit --amend --reuse-message=HEAD --signoff`

https://gitlab.archlinux.org/pacman/pacman-contrib/-/blob/master/doc/submitting-patches.txt#L27-32


On 7/10/21 9:23 PM, tbperrotta--- via pacman-contrib wrote:
> From: Thiago Perrotta <tbperrotta@gmail.com>
>
> `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
> ---
>   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 bd0daf5..a3fd982 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..a249045
> --- /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
> +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

Patch

diff --git a/CHANGES.md b/CHANGES.md
index bd0daf5..a3fd982 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..a249045
--- /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
+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