You are not logged in.

#1 2020-12-08 02:36:33

MountainX
Member
Registered: 2016-02-08
Posts: 360

How to bump version but NOT let pkg be upgraded?

I need to make some improvements to an installer script for a package (EDIT: my own package along with my own local repository). My pkgver is 1.0.r16-1. I think it is best to bump my pkgrel from 1 to 2 when I make these changes. However, for any devices that already have version 1.0.r16-1 installed, these changes are of no benefit and I prefer not to install the newer package in that case. (The package has something to do with connectivity, and it is a pain to install when working on a remote device due to the loss of connection.)

I was thinking about doing something like this:

pre_upgrade() {
  if [[ $(vercmp "$2" "1.0.r16-1") -eq 0 && $(vercmp "$1" "1.0.r16-2") -eq 0  ]]; then
    echo "No update is needed."
    exit 1
  fi
}

Is that a good approach? I don't actually know if it will work since I have not tested it yet. What is the effect of the "exit 1" statement in the pre_upgrade()? Does the entire pacman update abort?

EDIT: this code does not accomplish my goal. It gives the message and error, but then it proceeds with the upgrade anyway.

:: Processing package changes...
no update is needed
error: command failed to execute correctly
(1/N) upgrading package_abc

Is there a way to skip just this specific package update (with the versions matching) while continuing with all other updates?

EDIT 2: I know I could use a command line option for pacman (IgnorePkg=package_abc), but to check & match the versions will require writing a script. If I am going to do that, it seems better to put the code in the installer.

Last edited by MountainX (2020-12-08 03:34:44)

Offline

#2 2020-12-08 03:31:40

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

Re: How to bump version but NOT let pkg be upgraded?

What package is this?  I gather this is just something you are using yourself and not sharing in the AUR, right?  If that's the case, there is no actual need to bump the pkgrel.  If you explicitly want to ignore the change on most machines, just keep the pkgver and pkgrel the same.


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

Offline

#3 2020-12-08 03:33:39

MountainX
Member
Registered: 2016-02-08
Posts: 360

Re: How to bump version but NOT let pkg be upgraded?

Trilby wrote:

What package is this?  I gather this is just something you are using yourself and not sharing in the AUR, right?  If that's the case, there is no actual need to bump the pkgrel.  If you explicitly want to ignore the change on most machines, just keep the pkgver and pkgrel the same.

It is just for internal use. It is not on the AUR. However, when I do not bump the version number (pkgrel), the prior version stays in my local repository and when I try to install the package for the first time I get "1.0.r16-1" instead of the one with my improved installer.

Offline

#4 2020-12-08 04:25:45

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

Re: How to bump version but NOT let pkg be upgraded?

What do you mean it "stays there"?  It's not going to replace itself.  Rebuild the package and copy it to the repo - you'll overwrite the existing one which will then be used for subsequent installs.


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

Offline

#5 2020-12-08 04:53:24

MountainX
Member
Registered: 2016-02-08
Posts: 360

Re: How to bump version but NOT let pkg be upgraded?

Trilby wrote:

What do you mean it "stays there"?  It's not going to replace itself.  Rebuild the package and copy it to the repo - you'll overwrite the existing one which will then be used for subsequent installs.

It is a tedious manual step to manage my local repos that way. I have to remove the package, signing the repo db, then add the new package & signature and sign the db. (Then I have to repeat that at the other copy of my local repo because without a version change, the propagation doesn't seem to work.) I have done it this way in the past and I do not like it. It was error-prone. My experience was that I had to be sure to remove all the old files manually from more than one place.

I would rather bump the version number, if possible. Then all my existing scripts for managing my packages and repos just work. Everything is clearer too because the package actually did change.

Offline

#6 2020-12-08 15:07:29

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,089
Website

Re: How to bump version but NOT let pkg be upgraded?

This situation is really confusing... Is this package to be used by anyone other than yourself?

I think the best and simplest solution is to just bump the pkgrel from 1 to 2 and have the users (just you?) understand that this can only be installed when they have a good network connection, an opportunity to reboot, or whatever is needed.

If you are worried about the situation where "sure, that's fine for going from pkgrel 1 to 2, but what about when I bump the pkgrel to 3, then 4, then...", then it sounds like you are doing package testing and development on a production server. Instead of doing that, just get it working on one computer, then release the one final good version to your repo.

MountainX wrote:

it is a pain to install when working on a remote device due to the loss of connection

This sounds very strange. It's just installing a package! Are you putting code in a PKGBUILD file that doesn't belong there?

Offline

#7 2020-12-08 16:11:28

null
Member
Registered: 2009-05-06
Posts: 382

Re: How to bump version but NOT let pkg be upgraded?

MountainX wrote:

It is a tedious manual step to manage my local repos that way. I have to remove the package, signing the repo db, then add the new package & signature and sign the db. (Then I have to repeat that at the other copy of my local repo because without a version change, the propagation doesn't seem to work.) I have done it this way in the past and I do not like it. It was error-prone. My experience was that I had to be sure to remove all the old files manually from more than one place.

Just use aurutils?

Last edited by null (2020-12-08 16:12:23)

Offline

#8 2020-12-08 19:22:42

MountainX
Member
Registered: 2016-02-08
Posts: 360

Re: How to bump version but NOT let pkg be upgraded?

null wrote:

Just use aurutils?

I do use aurutils. Have been for a while.

Offline

#9 2020-12-08 19:26:14

MountainX
Member
Registered: 2016-02-08
Posts: 360

Re: How to bump version but NOT let pkg be upgraded?

drcouzelis wrote:
MountainX wrote:

it is a pain to install when working on a remote device due to the loss of connection

This sounds very strange. It's just installing a package! Are you putting code in a PKGBUILD file that doesn't belong there?

It's the package that provides the only connection to the device being updated, and it has security implications.

Offline

#10 2020-12-08 20:11:46

MountainX
Member
Registered: 2016-02-08
Posts: 360

Re: How to bump version but NOT let pkg be upgraded?

What I have gleaned from this thread is that there is apparently no way to make pacman skip the installation of a package based on conditions determined in the pre_upgrade() function. Is that correct and is it the final word?

I don't know anything about the pacman code, but my guess was that using the pre_upgrade() function to skip a listed package is possible... looks like I guessed wrong.

Offline

#11 2020-12-08 20:33:48

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,097

Re: How to bump version but NOT let pkg be upgraded?

The point of an install script is to do things *in addition to* installing the package.

It's never okay to tell pacman internals to remove packages from the transaction list, *after* the transaction started. If you don't want the package to be installed, the time to decide this is before asking pacman to do so. Or by not releasing an update.

It is possible with hooks, which specifically document AbortOnFail, to have PreTransaction hooks that check for certain conditions, then refuse to permit installing *any* packages. But then pacman simply says "error: you cannot update today, go fix your XXXXX".


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

Offline

#12 2020-12-08 20:37:09

MountainX
Member
Registered: 2016-02-08
Posts: 360

Re: How to bump version but NOT let pkg be upgraded?

eschwartz wrote:

The point of an install script is to do things *in addition to* installing the package.

It's never okay to tell pacman internals to remove packages from the transaction list, *after* the transaction started. If you don't want the package to be installed, the time to decide this is before asking pacman to do so. Or by not releasing an update.

It is possible with hooks, which specifically document AbortOnFail, to have PreTransaction hooks that check for certain conditions, then refuse to permit installing *any* packages. But then pacman simply says "error: you cannot update today, go fix your XXXXX".

Thank you! Great explanation.

Offline

Board footer

Powered by FluxBB