Yay: Handle `--needed` cliarg

Created on 6 Sep 2017  路  7Comments  路  Source: Jguer/yay

It would be handy if yay respected --needed for AUR-based packages, too.

Most helpful comment

We rebuild the package if it doesn't already exist. I didn't think about the case where you don't have the package in cache and use --needed. Up until now I've just left the --needed flag for Pacman to handle. I'll have Yay handle --needed too. The above problem is still also a valid concern.

All 7 comments

Yes, as in going so far as to refreshing/doing a repo checkout and seeing if makepkg results in a newer pkgver.

--needed should be handled correctly by pacman, AUR packages now have --needed like behaviour by default.

@Morganamilo It does skip installing, but it seems to always build a new package first, even if it matches the currently installed version. Shouldn't it just compare pkgvers and skip at that point?

Are you sure its building? Yay splits the install up into two parts: download sources=() and build+install. So what Yay is probably doing is downloading the sources, not building and reinstalling the built package.

I agree it shouldn't really be doing this. We need the sources=() so that the pkgbuild may correctly execute the pkgver() function. Ideally I would like a "download sources only if there's a pkgver() function" but makepkg doesn't provide this.

A little hacky but we could grep the pkgbuild for a pkgver() function and skip the download, or maybe a better way is to source it instead.

Most packages don't contain a pkgver() so I get this is pretty wasteful, I'll think about a decent solution to this.

Yeah, I'm just starring at a 10 minute build of code... Maybe because I've deleted the cache before? See the log output (yay git master) attached.

I can understand your reasoning and downloading sources for the pkgver check would be acceptable, in my opinion.

Output of build:

...
==> Creating package "code"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: code 1.22.2-1 (Wed Apr 18 00:21:09 CEST 2018)
==> Cleaning up...
loading packages...
warning: code-1.22.2-1 is up to date -- skipping
 there is nothing to do

Update: If I keep the cache populated it indeed only downloads/updates the git sources for the pkgver check.

We rebuild the package if it doesn't already exist. I didn't think about the case where you don't have the package in cache and use --needed. Up until now I've just left the --needed flag for Pacman to handle. I'll have Yay handle --needed too. The above problem is still also a valid concern.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renom picture renom  路  3Comments

GermanG picture GermanG  路  4Comments

tapir picture tapir  路  3Comments

Zeioth picture Zeioth  路  3Comments

bazeeel picture bazeeel  路  4Comments