actionless / pikaur

AUR helper with minimal dependencies. Review PKGBUILDs all in once, next build them all without user interaction.
GNU General Public License v3.0
852 stars 85 forks source link

pikaur incorrectly detecting package as being available in repos #598

Open lectrode opened 2 years ago

lectrode commented 2 years ago
$ python3 ./pikaur.py -Vq
Pikaur v1.8-dev
Pacman v6.0.1 - libalpm v13.0.1 - pyalpm v0.10.6
Attached log:
$ python3 ./pikaur.py -S --rebuild --verbose --pikaur-debug pikaur
:: debug: Pikaur operation found for sys.argv=['./pikaur.py', '-S', '--rebuild', '--verbose', '--pikaur-debug', 'pikaur']: cli_install_packages
:: debug: install_info_fetcher: Gonna fetch install info for:
    install_package_names=['pikaur']
    not_found_repo_pkgs_names=[]
    pkgbuilds_packagelists={}
    manually_excluded_packages_names=[]

:: debug: install_info_fetcher: Gonna get repo pkgs install info...
Reading repository package databases...
Reading local package database...
=> pacman --color=always --sync pikaur --print-format %r/%n
:: debug: install_info_fetcher: gonna get AUR pkgs install info for:
    aur_packages_versionmatchers=[]
    self.aur_updates_install_info=[]
    aur_packages_names_to_versions={}
:: debug: install_info_fetcher: found AUR pkgs:
    aur_pkg_list=[]
    not_found_aur_pkgs=[]

:: debug: install_info_fetcher: got AUR pkgs install info: self.aur_updates_install_info=[]
:: Nothing to do.
actionless commented 2 years ago

weird, my log is different, i'll think what could cause the difference

could you try with default pikaur config file?

$ ./pikaur.py -S --rebuild --verbose --pikaur-debug pikaur
:: debug: Pikaur operation found for sys.argv=['./pikaur.py', '-S', '--rebuild', '--verbose', '--pikaur-debug', 'pikaur']: cli_install_packages
:: debug: install_info_fetcher: Gonna fetch install info for:
    install_package_names=['pikaur']
    not_found_repo_pkgs_names=[]
    pkgbuilds_packagelists={}
    manually_excluded_packages_names=[]

:: debug: install_info_fetcher: Gonna get repo pkgs install info...
Reading repository package databases...
Reading local package database...
=> pacman --color=always --sync pikaur --print-format %r/%n
:: debug: install_info_fetcher: gonna get AUR pkgs install info for:
    aur_packages_versionmatchers=['pikaur']
    self.aur_updates_install_info=[]
    aur_packages_names_to_versions={'pikaur': <VersionMatcher pikaur['cmp_default']None>}
=> GET https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=pikaur
:: debug: install_info_fetcher: found AUR pkgs:
    aur_pkg_list=[<AURPackageInfo "pikaur" 1.8-1>]
    not_found_aur_pkgs=[]

:: debug: install_info_fetcher: got AUR pkgs install info: self.aur_updates_install_info=[<InstallInfo "pikaur"   -> 1.8-1>]
Resolving AUR dependencies...
=> pacman --color=always --deptest pyalpm git python-commonmark
lectrode commented 2 years ago

This seems to have something to do with how pikaur detects if a package is provided by local repos. On the computer in question, pikaur is intalled, and I have the chaotic-aur configured as a source. While it doesn't have pikaur specifically available in that source, it has pikaur-git, which "provides" pikaur.

If I alter the command to look at the AUR only, it works as intended:

python3 ./pikaur.py -Sa --rebuild pikaur

Likewise, if I disable the chaotic-aur, it will also work.

I guess my only question at this point is, is this a bug in pikaur or pacman? pikaur detects that an installed repo provides an updated replacement of an existing package, but pacman doesn't, leading to nothing changing with the original command.

AFAIK, pacman only replaces a particular package with one of a different name if it includes the "replaces" setting in the PKGBUILD. That might need to be something pikaur needs to take into account.

actionless commented 2 years ago

then it's expected behavior, you must use --aur flag to specify what you want in such edge cases where package available in both aur and repos (by default repo packages have higher priority than aur ones)

lectrode commented 2 years ago

respectfully, that's not what's happening here.

pikaur-git is in the 3rd-party repo, but that's not what I have installed.

piakur is only available from the AUR, and that's what I have installed.

image

pikaur incorrectly detects that package as being available from a different repo, when it clearly is not.

actionless commented 2 years ago

could you please show the output of pikaur -Ss pikaur

lectrode commented 2 years ago
$ pikaur -Ss pikaur
Searching... [###]
community/pacui 1.14-1 
    Bash script providing advanced Pacman and    
    Yay/Pikaur/Aurman/Pakku/Trizen/Pacaur functionality in a simple UI    
chaotic-aur/pacui 1.14-1 
    Bash script providing advanced Pacman and    
    Yay/Pikaur/Aurman/Pakku/Trizen/Paru/Pacaur/Pamac-cli functionality in a    
    simple UI    
chaotic-aur/pikaur-git 1.8.r4.gcbad87e-1 
    AUR helper which asks all questions before installing/building. Inspired    
    by pacaur, yaourt and yay.    
aur/pikaur 1.8-1 [installed] (234, 4.69)
    AUR helper which asks all questions before installing/building. Inspired    
    by pacaur, yaourt and yay.    
aur/pikaur-git 1.8-1 (20, 0.54)
    AUR helper which asks all questions before installing/building. Inspired    
    by pacaur, yaourt and yay.    
aur/aptpik 1.0-1 (1, 0.00)
    a pikaur wrapper with syntax from debian's apt    
aur/pikaur-aurnews 1.8-1 (0, 0.00)
    AUR helper which asks all questions before installing/building. Inspired    
    by pacaur, yaourt and yay, and with the live aurnews eggzpatch
actionless commented 2 years ago

thanks!

and, to make sure, we're on the correct path, could you disable your custom repository, do -Sy, and re-try your test-case?

lectrode commented 2 years ago

sure thing

$ pikaur -Ss pikaur
Searching... [###]
community/pacui 1.14-1 
    Bash script providing advanced Pacman and Yay/Pikaur/Aurman/Pakku/Trizen/Pacaur    
    functionality in a simple UI    
aur/pikaur 1.8-1 [installed] (234, 4.69)
    AUR helper which asks all questions before installing/building. Inspired by    
    pacaur, yaourt and yay.    
aur/pikaur-git 1.8-1 (20, 0.54)
    AUR helper which asks all questions before installing/building. Inspired by    
    pacaur, yaourt and yay.    
aur/aptpik 1.0-1 (1, 0.00)
    a pikaur wrapper with syntax from debian's apt    
aur/pikaur-aurnews 1.8-1 (0, 0.00)
    AUR helper which asks all questions before installing/building. Inspired by    
    pacaur, yaourt and yay, and with the live aurnews eggzpatch

i'll test the package update momentarily

lectrode commented 2 years ago

chaotic-aur enabled:

$ python3 ./pikaur.py -S --rebuild --verbose --pikaur-debug pikaur
:: debug: Pikaur operation found for sys.argv=['./pikaur.py', '-S', '--rebuild', '--verbose', '--pikaur-debug', 'pikaur']: cli_install_packages
:: debug: install_info_fetcher: Gonna fetch install info for:
    install_package_names=['pikaur']
    not_found_repo_pkgs_names=[]
    pkgbuilds_packagelists={}
    manually_excluded_packages_names=[]

:: debug: install_info_fetcher: Gonna get repo pkgs install info...
Reading repository package databases...
Reading local package database...
=> pacman --color=always --sync pikaur --print-format %r/%n
:: debug: install_info_fetcher: gonna get AUR pkgs install info for:
    aur_packages_versionmatchers=[]
    self.aur_updates_install_info=[]
    aur_packages_names_to_versions={}
:: debug: install_info_fetcher: found AUR pkgs:
    aur_pkg_list=[]
    not_found_aur_pkgs=[]

:: debug: install_info_fetcher: got AUR pkgs install info: self.aur_updates_install_info=[]
:: Nothing to do.

chaotic-aur disabled:

$ $ python3 ./pikaur.py -S --rebuild --verbose --pikaur-debug pikaur
:: debug: Pikaur operation found for sys.argv=['./pikaur.py', '-S', '--rebuild', '--verbose', '--pikaur-debug', 'pikaur']: cli_install_packages
:: debug: install_info_fetcher: Gonna fetch install info for:
    install_package_names=['pikaur']
    not_found_repo_pkgs_names=[]
    pkgbuilds_packagelists={}
    manually_excluded_packages_names=[]

:: debug: install_info_fetcher: Gonna get repo pkgs install info...
Reading repository package databases...
Reading local package database...
=> pacman --color=always --sync pikaur --print-format %r/%n
:: debug: install_info_fetcher: gonna get AUR pkgs install info for:
    aur_packages_versionmatchers=['pikaur']
    self.aur_updates_install_info=[]
    aur_packages_names_to_versions={'pikaur': <VersionMatcher pikaur['cmp_default']None>}
=> GET https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=pikaur
:: debug: install_info_fetcher: found AUR pkgs:
    aur_pkg_list=[<AURPackageInfo "pikaur" 1.8-1>]
    not_found_aur_pkgs=[]

:: debug: install_info_fetcher: got AUR pkgs install info: self.aur_updates_install_info=[<InstallInfo "pikaur" 1.6.12-1 -> 1.8-1>]
Resolving AUR dependencies...
=> pacman --color=always --deptest pyalpm git python-commonmark
=> pacman --color=always --sync --print-format=%% python-commonmark
=> pacman --color=always --deptest pyalpm git python-commonmark
=> pacman --color=always --sync python-commonmark --print-format %r/%n
=> pacman --color=always --sync --needed python-commonmark --print-format %r/%n

:: New dependencies will be installed from repository:
 python-commonmark (for pikaur)                             -> 0.9.1-3
 python-docutils (for python-commonmark)                    -> 0.17.1-1
 python-future (for python-commonmark)                      -> 0.18.2-5

:: AUR package will be installed:
 pikaur                                1.6.12-1             -> 1.8-1

:: debug: PROMPT: Gonna get input from user...
:: debug: PROMPT: Restoring TTY...
:: debug: PROMPT: Using standard input reader...
:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> 
actionless commented 2 years ago

thanks, i'll try to reproduce it locally given all this info

actionless commented 2 years ago

so i double-checked - and yup, indeed, for some reason command pacman --color=always --sync pikaur when that repository is enabled will start installing pikaur-git

so the only solutions are either using -a/--aur flag or specifying full package name: ./pikaur.py -S --rebuild --verbose --pikaur-debug aur/pikaur

actionless commented 2 years ago

i think it could be worked around by checking, if package returned by pacman is not exact match by name - to search for exact match in aur

lectrode commented 2 years ago

hmm. i think your workaround of checking whether or not the name matches would work. the only thing you'd have to watch out for is a potential "replaces" scenario where a local repo package specifically replaces an AUR package (you'd probably want to allow that, only overriding it if --aur were specified).

the only other solution i can think of would be to let pacman continue with the install of the wrong package, but that would negatively impact cases especially where ppl want specific variants of a package installed. for example, someone might specifically need xfce4-panel-compiz instead of xfce4-panel - pikaur shouldn't replace that unless the other package name was specified, or if one of the packages includes a "replaces" variable

actionless commented 2 years ago

then i guess either leave the current state or just print some sort of warning or such?

lectrode commented 2 years ago

Looks like yay just uses the same dialogue as pacman:

$ yay -S pikaur
resolving dependencies...
looking for conflicting packages...
:: pikaur-git and pikaur are in conflict. Remove pikaur? [y/N] ^C
Interrupt signal received

$ sudo pacman -S pikaur
resolving dependencies...
looking for conflicting packages...
:: pikaur-git and pikaur are in conflict. Remove pikaur? [y/N] ^C
Interrupt signal received

(it correctly detects that it's a conflict at least, and defaults to not making any changes) that's basically what pikaur already does - just needs the warning message (and maybe the option to replace it)