yay icon indicating copy to clipboard operation
yay copied to clipboard

Don't build already installed packages with --needed

Open raffomania opened this issue 6 years ago • 9 comments

Affected Version

yay v9.1.0 - libalpm v11.0.2

Issue

When running yay with the --needed switch, I would like it to not rebuild packages that are already installed.

Steps to reproduce

  1. yay -S foo
  2. yay -S --needed foo

raffomania avatar Feb 11 '19 14:02 raffomania

--needed isn't actually used anymore.

It should only rebuild if pkgver bumped or in the case of using --devel, the git sources changing upstream.

parkerlreed avatar Feb 11 '19 16:02 parkerlreed

@parkerlreed I don't know what you're on about but --needed does indeed mostly as one would expect.

The only difference is for aur packages, yay will still bump the pkgver before deciding if it should build and install.

If you provided the output (which the template does tell you to do) you should see that after the pkgver dumb nothing happens.

Morganamilo avatar Feb 11 '19 16:02 Morganamilo

Well, it does re-download sources it doesn't find in the cache:

yay -S cava                                                                                                                                                                                               
:: There are 2 providers available for cava:
:: Repository AUR
    1) cava 2) cava-git 

Enter a number (default=1): 1
:: Checking for conflicts...
:: Checking for inner conflicts...
[Repo: 1]  iniparser-4.1-1
[Aur: 1]  cava-0.6.1-1

  1 cava                             (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 
:: PKGBUILD up to date, Skipping (1/1): cava
  1 cava                             (Build Files Exist)
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> Diffs to show?
==> 
:: Parsing SRCINFO (1/1): cava
resolving dependencies...
looking for conflicting packages...

Packages (1) iniparser-4.1-1

Total Download Size:   0.01 MiB
Total Installed Size:  0.04 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 iniparser-4.1-1-x86_64                                                                                          12.7 KiB  4.14M/s 00:00 [###################################################################################] 100%
(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...
(1/1) installing iniparser                                                                                                               [###################################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:50:08 CET)
==> Retrieving sources...
  -> Downloading 0.6.1.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   120    0   120    0     0    376      0 --:--:-- --:--:-- --:--:--   376
100 42285    0 42285    0     0  49747      0 --:--:-- --:--:-- --:--:--  216k
==> Validating source files with sha512sums...
    0.6.1.tar.gz ... Passed
==> Cleaning up...
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:50:10 CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found 0.6.1.tar.gz
==> Validating source files with sha512sums...
    0.6.1.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting 0.6.1.tar.gz with bsdtar
==> Sources are ready.
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:50:11 CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting build()...
<make output>
make[1]: Leaving directory '/home/charlie/.cache/yay/cava/src/cava-0.6.1'
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "cava"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: cava 0.6.1-1 (Di 12 Feb 2019 15:50:20 CET)
==> Cleaning up...
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) cava-0.6.1-1

Total Installed Size:  0.07 MiB

:: Proceed with installation? [Y/n] 
(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...
(1/1) installing cava                                                                                                                    [###################################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
yay -Scc                                                                                                                                                                                                       

Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove ALL files from cache? [y/N] y
removing all files from cache...

Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] y
removing unused sync repositories...

Build directory: /home/charlie/.cache/yay
==> Do you want to remove ALL AUR packages from cache? [Y/n] y
removing AUR packages from cache...
yay -S --needed cava                                                                                                                                                                                           
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur: 1]  cava-0.6.1-1

:: Downloaded PKGBUILD (1/1): cava
  1 cava                             (Installed) (Build Files Exist)
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> Diffs to show?
==> 
:: Parsing SRCINFO (1/1): cava
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:52:47 CET)
==> Retrieving sources...
  -> Downloading 0.6.1.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   120    0   120    0     0    497      0 --:--:-- --:--:-- --:--:--   497
100 42285    0 42285    0     0  47351      0 --:--:-- --:--:-- --:--:--  136k
==> Validating source files with sha512sums...
    0.6.1.tar.gz ... Passed
==> Cleaning up...
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:52:49 CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found 0.6.1.tar.gz
==> Validating source files with sha512sums...
    0.6.1.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting 0.6.1.tar.gz with bsdtar
==> Sources are ready.
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:52:50 CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Sources are ready.
==> Cleaning up...
cava-0.6.1-1 is up to date -- skipping

And even without downloading, it takes ~2s on my pc for what is essentially a no-op:

time yay --answerclean None --answerdiff None -S --needed cava                                                                                                                                                 
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur: 1]  cava-0.6.1-1

  1 cava                             (Installed) (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> None
:: PKGBUILD up to date, Skipping (1/1): cava
  1 cava                             (Installed) (Build Files Exist)
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> Diffs to show?
==> None
:: Parsing SRCINFO (1/1): cava
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:55:16 CET)
==> Retrieving sources...
  -> Found 0.6.1.tar.gz
==> Validating source files with sha512sums...
    0.6.1.tar.gz ... Passed
==> Cleaning up...
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:55:17 CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found 0.6.1.tar.gz
==> Validating source files with sha512sums...
    0.6.1.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting 0.6.1.tar.gz with bsdtar
==> Sources are ready.
==> Making package: cava 0.6.1-1 (Di 12 Feb 2019 15:55:18 CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Sources are ready.
==> Cleaning up...
cava-0.6.1-1 is up to date -- skipping
yay --answerclean None --answerdiff None -S --needed cava  2.32s user 0.76s system 101% cpu 3.024 total

raffomania avatar Feb 12 '19 14:02 raffomania

Fair enough, I'm reopening the issue

Jguer avatar Feb 12 '19 15:02 Jguer

If there's interest in this then I'd prefer if the original behaviour stays and maybe --needed --needed could be used.

The current behaviour is needed to make the pacaur devel check work.

Morganamilo avatar Feb 14 '19 19:02 Morganamilo

As a recent newcomer to yay (yay!), I'd be pretty interested in having the --needed --needed option.

anp avatar Sep 16 '19 02:09 anp

sort of a hack but works for now

#!/usr/bin/env bash
yay -S --noconfirm $(yay -Qi $@ 2>&1 >/dev/null | grep "error: package" | grep "was not found" | cut -d"'" -f2 | tr "\n" " ")

put that in a bash file, say yay-needed.sh

call it like so ./yay-needed.sh apackage anotherpackage someotherpackage

queries the package db and uses the errors generated from non-installed packages as the arguments for the install command

computercam avatar Jan 21 '20 06:01 computercam

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 01 '20 13:11 stale[bot]

Is this fixed yet?

LukasDoesDev avatar Dec 26 '21 11:12 LukasDoesDev

Ran into this in 2023. @computercam's script here works well, though.

alexdelorenzo avatar Feb 19 '23 00:02 alexdelorenzo

Working in yay-git with the following config:

  "newinstallengine": true,

Jguer avatar Feb 21 '23 02:02 Jguer