Jguer / yay

Yet another Yogurt - An AUR Helper written in Go
GNU General Public License v3.0
11.25k stars 366 forks source link

package from git gets built again, even if it is installed #2477

Open soloturn opened 4 months ago

soloturn commented 4 months ago

can yay please notice that a package from git is already installed if the pkgver() function returns the same value of installed package? example, cosmic-comp-git.

❯ yay -Q | grep cosmic
cosmic-comp-git r1155.4f04313-1

❯ yay -S cosmic-comp-git
AUR Dependency (1): cosmic-comp-git-r1128.b3b9ead-1
:: PKGBUILD up to date, skipping download: cosmic-comp-git
  1 cosmic-comp-git                          (Installed) (Build Files Exist)
==> Packages to cleanBuild?

and it would build again and install again. even if the prepare function returns the same version which is already installed:

pkgver() {
  cd "${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}
Jguer commented 4 months ago

to triage, this should work

soloturn commented 4 months ago

@Jguer the use case is special. the version is calculated from git repository, and is NOT the same as in the AUR PKGBUILD file, as i, as a package maintainer of cosmic-comp-git, do not update the version on every git commit in the upstream repository. but, the version is calculated out of the git hash of the upstream repository. this means, a version is installed, which is different from the one in the AUR.

the case failing is then, if one starts the install again, and the upstream git did NOT change. yay does NOT notice the version is already installed, and does download, compile, etc etc again.

fritzbauer commented 4 months ago

Observing the same behavior for golden-cheetah-git since a few weeks: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=golden-cheetah-git

It reinstalls even if there are no new commits in the git repository, although it skips the rebuild.