Yay: Don't build already installed packages with --needed

Created on 11 Feb 2019  路  8Comments  路  Source: Jguer/yay

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
stale

Most helpful comment

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

All 8 comments

--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 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.

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



md5-fc60c9d2a7cb397afea21b9d0308e8cf



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

Fair enough, I'm reopening the issue

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.

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

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

captn3m0 picture captn3m0  路  4Comments

GermanG picture GermanG  路  4Comments

drrlvn picture drrlvn  路  4Comments

x70b1 picture x70b1  路  4Comments

pantuts picture pantuts  路  3Comments