[pacman-dev] [PATCH] libalpm/sync.c: restrict alpm_sync_newversion by USAGE_UPGRADE

Eli Schwartz eschwartz at archlinux.org
Wed Jul 25 03:58:15 UTC 2018

On 07/24/2018 09:23 PM, Morgan Adamiec wrote:
> On Tue, 24 Jul 2018 at 20:40, Andrew Gregory <andrew.gregory.8 at gmail.com> wrote:
>> Based on how it's used, I'd say it should be SEARCH; it's being used
>> as a filter for -Q and no upgrade transaction is being performed, or
>> even prepared.
>> Really, though, I'd say this is a great example as to why usages
>> should have been implemented in the front-end or limited to only the
>> highest-level library functions.  Usage is contextual, how is libalpm
>> supposed to know how such a basic function is being used?  pacman may
>> only use it as a filter for -Q, but some other front-end could use it
>> to actually prepare an upgrade.
> The thing is pacman with not let you use -s with -u: error: invalid
> option: '--search' and '--upgrade' may not be used together. By that
> logic you could argue it is not a search at all.

It has nothing to do with "upgrades", -S means different things
depending on whether you just give it package names, a bunch of inferred
package names via -u, or whatever.

-Us doesn't work either. Nor does -Ssw.

Likewise this low-level function I guess is not called just by pacman
-Su ...

> Front ends aside the function is called alpm_sync_newversion, it makes
> no mention to searching.

It is a function to find packages from sync repositories (in contrast to
the "local" repository) that have new versions. I think it's obvious
this function does not handle the actual syncing...

Anyway. Seems to me the name is a reference to the local/remote nature
of the repo, not its Usage field.

> Slightly off topic of the original patch. Playing around more I've
> come to find that Upgrade implies Install. Is that an oversight or is
> it intended?

It implies this where? Shouldn't anything using it be
checking/specifying both bitmasks?

Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20180724/560f7a66/attachment-0001.asc>

More information about the pacman-dev mailing list