You are not logged in.
When is the post_upgrade() function of an installation script executed? In my test is run during installation, which surprised me. Is this a defect /side effect or can this be expected to be stable functionality? If this is desired, I have to move all the steps that are supposed to be executed during installation & upgrade to the upgrade function only. Otherwise they are executed twice during installation.
Last edited by ente (2020-05-15 19:14:30)
Offline
Have you read the PKGBUILD man page?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Offline
Yes. I read the wiki. I read the man page. Did you read my question?
From the wiki (and the man page is exactly as vague):
post_upgrade — The script is run right after files are extracted. Two arguments are passed in the following order: new package version, old package version.
This would make me assume the function is not called during an installation. The description is not getting even close to make me assume it would be executed during installation. So what should I read? Where does it say that "post_upgrade" is executed during an installation process as well and not only during a package upgrade.
Offline
test PKGBUILD
pkgname=test
pkgver=1
pkgrel=1
pkgdesc=""
arch=('any')
url=""
license=('GPL')
install=test.install
test.install
## arg 1: the new package version
pre_install() {
echo pre_install $1
}
## arg 1: the new package version
post_install() {
echo post_install $1
}
## arg 1: the new package version
## arg 2: the old package version
pre_upgrade() {
echo pre_upgrade $1 $2
}
## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
echo post_upgrade $1 $2
}
## arg 1: the old package version
pre_remove() {
echo pre_remove $1
}
## arg 1: the old package version
post_remove() {
echo post_remove $1
}
Produces the following
$ pacman -U test-1-1-any.pkg.tar.zst
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (1) test-1-1
:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [####################################################################] 100%
(1/1) checking package integrity [####################################################################] 100%
(1/1) loading package files [####################################################################] 100%
(1/1) checking for file conflicts [####################################################################] 100%
(1/1) checking available disk space [####################################################################] 100%
:: Processing package changes...
pre_install 1-1
(1/1) installing test [####################################################################] 100%
post_install 1-1
$ pacman -U test-2-1-any.pkg.tar.zst
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (1) test-2-1
:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [####################################################################] 100%
(1/1) checking package integrity [####################################################################] 100%
(1/1) loading package files [####################################################################] 100%
(1/1) checking for file conflicts [####################################################################] 100%
(1/1) checking available disk space [####################################################################] 100%
:: Processing package changes...
pre_upgrade 2-1 1-1
(1/1) upgrading test [####################################################################] 100%
post_upgrade 2-1 1-1
Offline
In my test is run during installation, which surprised me. Is this a defect /side effect or can this be expected to be stable functionality?
This is an anomalous occurrence, it directly contradicts the documentation, the name of the feature, and the intention of the pacman developers.
Yes. I read the wiki. I read the man page. Did you read my question?
From the wiki (and the man page is exactly as vague):post_upgrade — The script is run right after files are extracted. Two arguments are passed in the following order: new package version, old package version.
This would make me assume the function is not called during an installation. The description is not getting even close to make me assume it would be executed during installation. So what should I read? Where does it say that "post_upgrade" is executed during an installation process as well and not only during a package upgrade.
I don't know how this is supposed to be vague. If the possible transaction types are "install", "upgrade", and "remove", it seems to be obvious that installing is not the same as upgrading, and in fact, pacman will print out a status message for every package saying either "installing" or "upgrading" the package.
"The exact time the script is run varies with each operation, and should be self-explanatory. Note that during an upgrade operation, none of the install or remove functions will be called."
This second sentence is bulletproof. There is no vagueness here. graysky was entirely correct in calling you out on reading the manpage and questioning why you asked whether it's expected behavior. Apparently, you did read the manpage, but you didn't fully read it; fortunately, we can read it for you and parrot specific sentences at you, though honestly, it would be more efficient and less distracting if you were to read it for yourself first.
To be perfectly, unambiguously clear: you are claiming you have observed that something has happened. The PKGBUILD manpage says that your observation must not, under any circumstances, happen.
...
tl;dr
As a result, I don't believe you that it's actually occurring at all.
Please post a sample PKGBUILD and install script which you claim demonstrates this defect. Please also post the entire output of pacman --debug -U /path/to/built/package.pkg.tar.zst (or pacman --debug -S foopkg). I would like to see the --debug output of this transaction, as it will prove, once and for all, whether this is actually happening.
If it is indeed going wrong, this is an extremely serious bug, but I cannot reproduce it.
Last edited by eschwartz (2020-05-15 16:49:45)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Correct. There is been an issue in the PKGBUILD. I didn't remove some # which caused me to believe the function would be called during installation while it actually wasn't. Sorry for the noise.
Thanks loqs for actually making me check my script once more.
Offline
OK, great, glad that's solved then.
Please change the [closed] in the thread title to [solved] or similar -- "[closed]" is easily confused with "Closed:" which is the forum software's tag for threads which have been locked by the moderators.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline