You are not logged in.

#1 2017-06-01 23:35:20

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

When to use replaces= in VCS packages

Copied from https://bbs.archlinux.org/viewtopic.php?id=226791

Scimmia wrote:
Lone_Wolf wrote:

replace was designed for obsolete packages, but can be used for other cases.

If A and B packages are functionally equivalent, having B replace A wil make it easy to switch from A to B letting pacman do everything needed.\

Many AUR git packages use replaces this way to make switching from stable package to git version easy.

Using replaces for this is completely and totally wrong. Replaces are for when a package is renamed or something similar. If the package being "replaced" still exists, do NOT uses "replaces.

First, I do think using replaces the way scimmia describes is  a good practice for core / extra/ community packages .

For stable - VCS packages however i've used replaces atleast several years, but scimmias comment makes me wonder if that's correct.

man PKGBUILD indicates that replaces only matters for a sysupgrade, which i think means pacman -Syu .

Situation :

foo is in official repo
foo-git  is in aur .
foo-git provides & conflicts foo

User installs foo-git, so pacman removes foo .

foo has a new version, user runs pacman -Syu .
User doesn't want the new foo to replace their foo-git .
Does foo-git need to have replaces=(foo)  for this to work correctly ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#2 2017-06-01 23:41:10

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,553

Re: When to use replaces= in VCS packages

Lone_Wolf wrote:

Does foo-git need to have replaces=(foo)  for this to work correctly ?

No

Replaces is when pacman asks at the beginning of the transaction if you want to replace one package with another. If you're not using a local repo, you'll see no effect from replaces at all. On the other hand, if you have a binary repo that includes foo-git, you will get prompted every single time to replace foo if you have it installed, even if you don't want foo-git and have never told pacman to install it.

The situation you're talking about with pacman replacing foo-git with foo does not happen; pacman doesn't work that way.

Last edited by Scimmia (2017-06-01 23:42:16)

Offline

#3 2017-06-01 23:41:55

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: When to use replaces= in VCS packages

Lone_Wolf wrote:

foo is in official repo
foo-git  is in aur .
foo-git provides & conflicts foo

User installs foo-git, so pacman removes foo .

foo has a new version, user runs pacman -Syu .
User doesn't want the new foo to replace their foo-git .
Does foo-git need to have replaces=(foo)  for this to work correctly ?

The new version of foo has no impact on user's -Syu as it is  no longer tracked in pacman's database (it was replaced by foo-git).

If the user had installed scrotwm then the first PKGBUILD for spectrwm would include a replaces=scrotwm. It has no intrinsic bearing on VCS packages unless they undergo the same change.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2017-06-02 00:36:00

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

Re: When to use replaces= in VCS packages

replaces is useless for packages outside a repo.

Offline

#5 2017-06-02 00:54:43

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: When to use replaces= in VCS packages

So for people that use pacman -U / makepkg -i / aur helpers replaces= has no effect ?

That's one part made clear then.



Next situation (with foo-git in a repo)

foo-git is in a repo that is listed below official repos in pacman.conf and installed .
(whether it's  a local or unofficial user repo should not matter i think) .

foo has a new version, user runs pacman -Syu .
User doesn't want the new foo to replace their foo-git .
Does foo-git need to have replaces=(foo)  for this to work correctly ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#6 2017-06-02 01:08:54

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

Re: When to use replaces= in VCS packages

I don't get the confusion.  If you don't have a package named "foo" installed, then pacman will never ask you to update to a newer version of "foo" in the repos*.  If you have foo-git installed, a new version of foo is irrelevant.

*an exception would be if the main repo package had "replaces=('foo-git')" - but a main repo package would not list a non-repo package in it's replaces array.

So no, foo-git does not need to replace foo in order for your scenario to "work".  You just need to make sure foo doesn't "replace" foo-git (which would never happen).

There is a case where pacman would try to pull in the repo "foo" package, but this has nothing to do with the "replaces" array.  If you have package baz with a versioned dependency on foo, and the versioned foo depdendency is not satisfied by the provides array of foo-git but is satisfied by the repo foo package, then pacman would try to install foo.  But again, this has nothing to do with the replaces array.


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

Offline

#7 2017-06-02 16:50:34

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

Re: When to use replaces= in VCS packages

Lone_Wolf wrote:

So for people that use pacman -U / makepkg -i / aur helpers replaces= has no effect ?

That's one part made clear then.

Since, as you pointed out in the OP, "replaces" is only considered when doing a --sysupgrade (e.g. pacman -Su) it naturally follows that AUR helpers and makepkg -i won't consider it, since both act as wrappers around... `pacman -U`!

It is of course possible for some AUR helper to build their own independent logic to implement "replaces" and hook it into pacman via pacman -U. But fortunately, no one is stupid enough to do that AFAIK.

That being said, people who use custom repos via e.g. aurutils will be screwed over by idiotic AUR maintainers that make idiotic use of "replaces". If I were to see any AUR packages that do that, I would probably post a nasty comment on the AUR page warning them to stop.

"replaces" is by definition not "provides", why on earth do you think we have both of them anyway?

"provides", means that the package is available as an alternative to the other package, and that either one are permissible to have installed (because they do the same thing).
"replaces" means that the replaced package is bad/evil/old and should not be installed, ever, by anyone, under any circumstances. It means that anyone who sees the new package should be aware that the old package is no longer supposed to exist, and should follow the pacman --sysupgrade migration path from one package to another, and if they opt out of doing so they should continue to receive noisy and irritating messages on every --sysupgrade asking them if they are finally ready to migrate from the old way of getting that software functionality, to the new way.

VCS packages do not "replace" the non-VCS package, as the non-VCS package is still an okay thing for people to want to have. Unless you mean to imply that non-VCS packages are evil as a matter of policy, and you wish to see the Arch Linux project start "replacing" packages with their built-from-VCS-sources alternatives (for that extra hemorrhaging edge).

And until that time, it is nasty and gross for AUR maintainers to claim that VCS packages "replace" their non-VCS analogue.

Next situation (with foo-git in a repo)

foo-git is in a repo that is listed below official repos in pacman.conf and installed .
(whether it's  a local or unofficial user repo should not matter i think) .

foo has a new version, user runs pacman -Syu .
User doesn't want the new foo to replace their foo-git .
Does foo-git need to have replaces=(foo)  for this to work correctly ?

That depends. Does foo also claim that it "replaces" foo-git? If so, I'm not sure which one would win the argument, although I'm also not sure whether it matters.

Without the replaces, "foo" won't replace "foo-git" any more than "bar", "baz", or "explode-my-computer" will. Why on earth should completely random packages attempt to replace my system's packages without any instructions to do so, from anyone on any side of the discussion???

"foo" and "foo-git" are different packages. pacman doesn't know that you and you arbitrary human logic have designated the two as being politically connected.


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

Offline

#8 2017-06-03 14:14:51

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: When to use replaces= in VCS packages

Seems i forgot to include some background how those replaces came to be into some vcs packages.

In july/aug 2015 Armin K aka Krezji announced he'd be disowning all his pacakges, including mesa-git / llvm-svn and their lib32 counterparts.

Those were popular but difficult to maintain. I had maintained a mesa-git radeon specific package for some time and adopted mesa-git .
Luchesar V. ILIEV aka Kerberizer adopted the llvm-svn packages.

The replaces were present in all 4 pkgbases when they were orphaned.

Krezji was not around to answer questions, and I had no experience with replaces= .
Wiki and forum didn't clarify what purpose they may have in these packages.
I checked the other well-maintained mesa-git package by arch linux dev Lord Heavy aka L.Carlier (it's on pkgbuild.com ) and found it also had replaces.

While my own mesa-r*-git packages didn't use replaces, 2 mesa-git packages maintained by people with a lot more packaging experience then me used replaces.
I left them in AUR mesa-git packages and even started putting them in other vcs pacakges i created.

The comment by scimmia in the thread i linked to is the first time the subject of replaces= came up since then.

I've removed them now from all my packages, posted on llvm-svn aur page and in mesa-git thread in arch discussion board to inform Kerberizer and Lord Heavy.

Last edited by Lone_Wolf (2017-06-03 14:15:25)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#9 2017-06-03 14:26:52

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

Re: When to use replaces= in VCS packages

It's possible that in that case it makes some sense to use replaces (I still don't know if that's a good way to do it, but it serves a purpose).

That is for packages in an unofficial [mesa-git] repo that users can add to their pacman.conf.  If the packages were named the same as their official repo counterparts, then replaces would not serve any purpose: the [mesa-git] repo could be listed before [extra] in pacman.conf an the [mesa-git] packages would take precidence.  However these are vcs packages, calling a vcs build of mesa just "mesa" would violate other packaging rules.  As it's a git build, the package should be named mesa-git.  This, then, would not take precidence over [extra]/mesa.

There are two ways around this: 1) instruct users to install mesa-git and other packages from the mesa-git repo, as they list their vanilla counterparts in the conflicts array, pacman would prompt the user to remove [extra]/mesa.  This would work fine.  2) abuse the "replaces" array so that once the [mesa-git] repo is added to the pacman.conf the users system is automagically converted over to the -git packages.

Option 1 seems far preferable to me, but I suspect option 2 is the reason the replaces array was abused in this way.  However, in no case would [mesa-git]/mesa-git be replaced by [extra]/mesa in a system upgrade.


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

Offline

#10 2017-06-04 03:27:51

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

Re: When to use replaces= in VCS packages

I will second what Trilby said, and I guess in the case of lordheavy's repo it is at least something I don't strongly despise tongue although I still think people should explicitly install what they want after enabling the repo.

But I'd also like to point out that just because experienced AUR maintainers do something, doesn't mean it is the "right" thing. Even a Dev/TU doing something (unfortunately) doesn't necessarily mean it is the "right" thing... there are more than enough packages in the official repos that do the wrong thing (for various types of "wrong thing" that people do to PKGBUILDs).


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

Offline

Board footer

Powered by FluxBB