You are not logged in.

#1 2019-04-10 14:44:26

blochl
Member
Registered: 2018-08-31
Posts: 50

[Solved] Installing a specific package version from a custom repo

Hi,

I have a custom (remote) repo, where I keep own-built packages. I would like to have the ability to install a specific version of a package from there.
I know that `repo-add` deletes the previous version of the same package from the .db file, and that `pacman` does not support specifying a version.
I also know about `pacman -U <URL_TO_PACKAGE>` option.

What I would like to get, is a way to install a specific version of a package from the repo, without the need to specify the whole URL to the specific package name. Sort of `pacman -S package-1.2.3-1`.

Is this possible in some not-too-dirty way?

Last edited by blochl (2019-04-20 07:50:51)

Offline

#2 2019-04-10 14:52:40

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 7,612

Re: [Solved] Installing a specific package version from a custom repo

man pacman wrote:

-S, --sync

    Synchronize packages. Packages are installed directly from the remote repositories, including all dependencies required to run the packages. For example, pacman -S qt will download and install qt and all the packages it depends on. If a package name exists in more than one repository, the repository can be explicitly specified to clarify the package to install: pacman -S testing/qt. You can also specify version requirements: pacman -S "bash>=3.2". Quotes are needed, otherwise the shell interprets ">" as redirection to a file.

Offline

#3 2019-04-10 14:57:28

ayekat
Member
Registered: 2011-01-17
Posts: 1,348
Website

Re: [Solved] Installing a specific package version from a custom repo

blochl wrote:

I know that `repo-add` deletes the previous version of the same package from the .db file, […]

That's not really a limitation of repo-add, but rather of pacman, which cannot properly handle package DBs that contain the same package multiple times (with different versions). I don't know if that is your goal, though.

[…] and that `pacman` does not support specifying a version.

Sure it can:

pacman -S package=1.2.3-1

But what is your real goal? If you just randomly jump between different versions of packages, you might run into broken library dependencies (one of the reasons why partial upgrades are not recommended on Arch).


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#4 2019-04-10 16:16:35

blochl
Member
Registered: 2018-08-31
Posts: 50

Re: [Solved] Installing a specific package version from a custom repo

Wow, cool!!

I remembered that pacman can do it, but then I saw that upon .db update the previous version is removed from the .db, so I thought that I was wrong initially. smile

But what is your real goal? If you just randomly jump between different versions of packages, you might run into broken library dependencies (one of the reasons why partial upgrades are not recommended on Arch).

That's for development purposes, so I know the risks in that. Sometimes I just do want to jump between different versions deterministically. And if I change something not related to my package, I want the build of the VM image to be exactly the same, even if the package is updated in my dev repo meanwhile.

Thanks a LOT for your answers!!

Offline

#5 2019-04-11 12:04:53

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,295

Re: [Solved] Installing a specific package version from a custom repo

An alternative might to be have multiple repos and tell pacman to install packages from one of them.

Hypothetical example :

pacman.conf has entries for stable, test1  , test2 and test3
stable repo is listed first, so pacman will use the packages in that by default .
foobar, barfoo and bigmess are present in all 4 repos in different versions

Say you want to test foobar and bigmess from test1, barfoo from test 2 and solvebigmess from test3 .

pacman -S  test1/foobar test1/bigmess test2/barfoo test3/solvebigmess

Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#6 2019-04-11 15:07:01

blochl
Member
Registered: 2018-08-31
Posts: 50

Re: [Solved] Installing a specific package version from a custom repo

Lone_Wolf wrote:

An alternative might to be have multiple repos and tell pacman to install packages from one of them.

Hypothetical example :

pacman.conf has entries for stable, test1  , test2 and test3
stable repo is listed first, so pacman will use the packages in that by default .
foobar, barfoo and bigmess are present in all 4 repos in different versions

Say you want to test foobar and bigmess from test1, barfoo from test 2 and solvebigmess from test3 .

pacman -S  test1/foobar test1/bigmess test2/barfoo test3/solvebigmess

Yes, thanks, I'm aware of that option. In my case it would cause more mess though. smile

Offline

#7 2019-04-19 07:37:18

blochl
Member
Registered: 2018-08-31
Posts: 50

Re: [Solved] Installing a specific package version from a custom repo

Apparently I marked it "Solved" too soon. smile It doesn't work for me: pacman seems to be able to install only the version which is present in the database (i.e. only one version), even if another version of the same package is in the same directory as the .db file. So how do I specify the version if I have two versions in the same repo?

.                                                                                                                                                    
├── repo.db -> repo.db.tar.gz
├── repo.db.tar.gz
├── repo.db.tar.gz.old
├── repo.files -> repo.files.tar.gz
├── repo.files.tar.gz
├── repo.files.tar.gz.old
├── package-1.2.2-1-x86_64.pkg.tar.xz                                                                                                  
└── package-1.2.3-1-x86_64.pkg.tar.xz

Now, when I do `repo-add repo.db.tar.gz package-1.2.3-1-x86_64.pkg.tar.xz` it removes 1.2.2 from the database. But then when I do `pacman -S package=1.2.2-1` it doesn't find it.

Last edited by blochl (2019-04-19 07:59:11)

Offline

#8 2019-04-19 08:14:26

ayekat
Member
Registered: 2011-01-17
Posts: 1,348
Website

Re: [Solved] Installing a specific package version from a custom repo

blochl wrote:

Now, when I do `repo-add repo.db.tar.gz package-1.2.3-1-x86_64.pkg.tar.xz` it removes 1.2.2 from the database. But then when I do `pacman -S package=1.2.2-1` it doesn't find it.

Yes, if repo-add removes 1.2.2 from the DB, pacman can't find it. That's… kinda expected, no?

ayekat wrote:

[But] that's not really a limitation of repo-add, but rather of pacman, which cannot properly handle package DBs that contain the same package multiple times (with different versions).[…]

You could try to see with the pacman developers if there is any chance of having this fixed (either via feature request or submitted patch); otherwise I think you'll need to use multiple repositories if you want multiple versions of the same package.

--edit: Typically, Arch Linux works around this issue by having multiple packages with a version suffix as part of the package name (see e.g. openssl-1.0). Maybe that's an option?

Last edited by ayekat (2019-04-19 08:16:50)


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#9 2019-04-19 08:31:23

blochl
Member
Registered: 2018-08-31
Posts: 50

Re: [Solved] Installing a specific package version from a custom repo

ayekat wrote:

[…] and that `pacman` does not support specifying a version.

Sure it can:

pacman -S package=1.2.3-1

After that I assumed that pacman just looks for other versions in the same directory where the .db is. Otherwise what is the point of specifying the version, if each repo can contain only one version? sad sad sad

Typically, Arch Linux works around this issue by having multiple packages with a version suffix as part of the package name (see e.g. openssl-1.0). Maybe that's an option?

That's good if you have 2-3 versions. But my real goal ™ is to have reproducible builds of package A, which depends on package B. Package B can have hundreds of versions. Therefore in the PKGBUILD of package A the exact version of package B should be specified, so that when I build package A from a PKGBUILD from a specific commit, I know exactly which dependency it pulls. I can't have a hundred repos, and also not hundred packages with different names which conflict with each other (you can have openssl-1.0 and openssl installed simultaneously, but I don't want package B of different versions to be installed simultaneously).

Offline

#10 2019-04-19 08:48:16

ayekat
Member
Registered: 2011-01-17
Posts: 1,348
Website

Re: [Solved] Installing a specific package version from a custom repo

Just have `packagename-1.2.2` provide `packagename=1.2.2`, and also conflict with `packagename`. This way, there can only be a single package providing `packagename` at a time.

blochl wrote:

After that I assumed that pacman just looks for other versions in the same directory where the .db is. Otherwise what is the point of specifying the version, if each repo can contain only one version?

There may be multiple repositories with multiple versions, so there it would make sense. Usually, though, it's more to make sure that you get the specific version you want or none (e.g. if you want firefox=65.0.1, but the repo has moved on to firefox=66.0.1, it will fail, but at least you won't end up with the wrong version).


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#11 2019-04-19 09:09:51

blochl
Member
Registered: 2018-08-31
Posts: 50

Re: [Solved] Installing a specific package version from a custom repo

ayekat wrote:

Just have `packagename-1.2.2` provide `packagename=1.2.2`, and also conflict with `packagename`. This way, there can only be a single package providing `packagename` at a time.

So you mean that the pkgnames will be "packagename-1.2.2", "packagename-1.2.3", etc..., and they all will contain `provides=("packagename=${pkgver}")`, and `conflicts=(packagename)`?

Last edited by blochl (2019-04-19 10:09:59)

Offline

#12 2019-04-19 11:15:27

blochl
Member
Registered: 2018-08-31
Posts: 50

Re: [Solved] Installing a specific package version from a custom repo

blochl wrote:
ayekat wrote:

Just have `packagename-1.2.2` provide `packagename=1.2.2`, and also conflict with `packagename`. This way, there can only be a single package providing `packagename` at a time.

So you mean that the pkgnames will be "packagename-1.2.2", "packagename-1.2.3", etc..., and they all will contain `provides=("packagename=${pkgver}")`, and `conflicts=(packagename)`?

Tested, and it works as I want!! Thanks, ayekat!

But, there is a problem if I want to automate these builds, and there are conflicts: the default action is not to remove the conflicting package. This thread is related to that: https://bbs.archlinux.org/viewtopic.php?id=233231 . Maybe there is a more elegant solution than piping `yes` to `makepkg`?

Offline

#13 2019-04-19 11:34:46

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,295

Re: [Solved] Installing a specific package version from a custom repo

I can't have a hundred repos, and also not hundred packages with different names which conflict with each other

Maybe a setup similar to the https://wiki.archlinux.org/index.php/Arch_Linux_Archive could make that manageable ?


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#14 2019-04-20 07:50:26

blochl
Member
Registered: 2018-08-31
Posts: 50

Re: [Solved] Installing a specific package version from a custom repo

Lone_Wolf wrote:

I can't have a hundred repos, and also not hundred packages with different names which conflict with each other

Maybe a setup similar to the https://wiki.archlinux.org/index.php/Arch_Linux_Archive could make that manageable ?

Multiple repos (even in an ordered structure as the Arch Linux Archive) is not a fitting solution for me. I don't want to change the repo each time I update a package. Now tested a bit further, and ayekat's solution, with "provides"/"conflicts", works great. Also, while piping `yes` to Pacman for removal of conflicting packages is not very elegant, I can live with it in the build/test environment I'm using it for.

Offline

#15 2019-04-20 08:00:26

ayekat
Member
Registered: 2011-01-17
Posts: 1,348
Website

Re: [Solved] Installing a specific package version from a custom repo

Using clean chroots for building the packages would avoid the constant "wanna replace conflicting package?" dialog marathon (+ the obvious upside itself of having packages built in a clean chroot).


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

Board footer

Powered by FluxBB