You are not logged in.

#1 2021-07-02 03:21:56

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

[SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

Hi folks,

These days (2021, yay!) `pkgfile` was mostly replaced with `pacman -F`.

Source: https://wiki.archlinux.org/title/Pkgfile, https://wiki.archlinux.org/title/Pacman … cific_file

The wiki page for pacman gives good advice:

Tip: You can set a cron job or a systemd timer to sync the files database regularly.

That's exactly what I am looking for. I was going to write my own unit file but then I figured someone else must probably have done that already. And this functionality seems useful enough to have its own PKGBUILD.

Note that pkgfile already comes with its own systemd unit + timer. In an ideal world, I would expect pacman to also come with its own service + timer embedded in its package, but that's not the case today (`pacman -Ql pacman | grep timer` returns nothing).

Doing the baby steps here:

1) Let's consider a separate package that ships a service + time first. Are you aware of any PKGBUILD that does so already?! I tried to search for "pacman sync" but I see no good results (https://aur.archlinux.org/packages/pacman-sync/ is something completely different). If there's no package, I'll probably create one myself, but curious if anyone did that already before I try to reinvent the wheel.

2) Is this something that could eventually make its way to upstream pacman? I will probably file a FR in the bug tracker, but while I'm in the forums, thought I'd reuse this thread to inquire that as well. Worst case, Allan shows up here and says "no way, never happening" tongue

Last edited by thiagowfx (2021-07-11 17:50:43)

Offline

#2 2021-07-02 03:37:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 29,741
Website

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

1. pacman-contrib ships a service/timer for paccache.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Online

#3 2021-07-02 12:56:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,894
Website

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

thiagowfx wrote:

And this functionality seems useful enough to have its own PKGBUILD.

It seems pretty silly to me for a couple dozen lines of a PKGBUILD to distrubute 4-5 lines of service file / timer.  Just create the service file and timer.  There's really nothing to these.

thiagowfx wrote:

If there's no package, I'll probably create one myself...

Is this something that could eventually make its way to upstream pacman? I will probably file a FR in the bug tracker

For the reason above, I'd suggest not making a package for this.  But a PR against pacman or pacman-contrib sounds like a very good idea, and I'd suspect it might be well received.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2021-07-03 05:02:03

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,080
Website

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

Trilby wrote:

But a PR against pacman or pacman-contrib sounds like a very good idea, and I'd suspect it might be well received.

I'd request in pacman-contrib.  It will not be accepted in pacman.

Offline

#5 2021-07-04 04:15:25

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

Agreed. Just sent a patch to the current maintainers.

Offline

#6 2021-07-05 02:15:40

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

Note that pkgfile is faster and more efficient... it also does not hold a database lock (it uniquely uses its own cache dir), whereas pacman -Fy and pacman -Syu do in fact hold the same database lock so if you happen to be running -Fy in the background it will make -Syu error out and report another instance of pacman is currently running.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2021-07-11 01:40:57

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

eschwartz wrote:

Note that pkgfile is faster and more efficient...

Do you happen to know what is the rationale of `pacman -F` then? When there are two ways of doing the same thing, I tend to prefer the one that is more native. In this case, if there's built-in functionality in pacman that does pkgfile-file funcionality, there's little reason to use pkgfile in the first place - from a simplicity perspective. The performance impact is negligible in this use case.

eschwartz wrote:

it also does not hold a database lock (it uniquely uses its own cache dir)

Good point, however, realistically, for a unit file that only syncs once a week, and whose execution only lasts a few seconds, the chances of a collision are relatively small.

thiagowfx wrote:

Agreed. Just sent a patch to the current maintainers.

Cycling back here, what is the etiquette to send patches / pull requests*? The project is hosted on gitlab, but currently only TUs/Devs have access to Gitlab AFAIK.

I originally sent an email (via git send-email) to the 2 current maintainers of the PKGBUILD, waited for a week, but got no response. Today I just sent the very same patch to the pacman-contrib mailing list (I wasn't aware there was a mailing list for it), but it's pending moderator approval.

I will wait another week or so.

* I should probably open a new thread to ask this...I searched the wiki but didn't find much info on that.

Offline

#8 2021-07-11 02:41:12

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 4,750

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

thiagowfx wrote:
eschwartz wrote:

Note that pkgfile is faster and more efficient...

Do you happen to know what is the rationale of `pacman -F` then? When there are two ways of doing the same thing, I tend to prefer the one that is more native. In this case, if there's built-in functionality in pacman that does pkgfile-file funcionality, there's little reason to use pkgfile in the first place - from a simplicity perspective. The performance impact is negligible in this use case.

pkgfile existed long before pacman gained it's -F functionality.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#9 2021-07-11 02:53:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,894
Website

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

thiagowfx wrote:

what is the etiquette to send patches / pull requests*

If it were me, I'd submit it as a feature request on the bug tracker.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2021-07-11 17:50:21

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Periodically sync `pacman -Fy` with systemd timer - package?

Trilby wrote:

If it were me, I'd submit it as a feature request on the bug tracker.

Fair enough: https://bugs.archlinux.org/index.php?do … k_id=71482

Marking this thread as resolved. Use the FR to continue the discussion if needed.

Offline

Board footer

Powered by FluxBB