Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

Working around packages.xml issues at install #1144

Open
manuel-192 opened this issue Mar 28, 2019 · 5 comments
Open

Working around packages.xml issues at install #1144

manuel-192 opened this issue Mar 28, 2019 · 5 comments
Assignees

Comments

@manuel-192
Copy link

manuel-192 commented Mar 28, 2019

Problem

Official packages from time to time get moved to AUR. Sometimes this causes problems for cnchi if packages.xml includes the package just moved to AUR.

Solution alternatives

This could be solved/worked around in cnchi by at least the following alternative ways:

  1. Ignore the missing package, and don't fail the install. Just warn the user. Often the removed package has been included into another existing package, so this probably works in many cases. If the install succeeds, remove the missing package from the master packages.xml, automatically if possible?

  2. Check if the package exists in AUR and use it. But this may lead to security issues? Probably not so great idea after all.

  3. On some Antergos server, create a process that checks the true existence of the packages listed in packages.xml. When a package is no more available, update (or prepare the update) the master packages.xml accordingly. This would speed up required changes for packages.xml.

Maybe the alternative 3. is the best. Alternative 1. is also possible and quite easy (I guess) to implement.

Caveats

Automatic removal of packages from packages.xml may still cause problems if the a package is only temporarily missing. So I guess manual intervention is always needed at some stage.

@karasu karasu self-assigned this Mar 28, 2019
@karasu
Copy link
Member

karasu commented Mar 31, 2019

I like the 3rd one. Maybe @lots0logs would you be so kind to make a script that checks that? No rush...

@manuel-192
Copy link
Author

manuel-192 commented Mar 31, 2019

I wrote a little bash script to check packages inside packages.xml. If it helps anything, feel free to use or modify it.
It uses pacman and yay to get package info, and probably could be much faster by reading all package databases instead of using pacman or yay for each package.

#!/bin/bash

Main()
{
    local file=/usr/share/cnchi/data/packages.xml
    local pkg line lines ix
    local okcount=0 failcount=0
    local failedpkgs failreasons

    readarray -t lines <<< "$(grep '' $file)"

    for line in "${lines[@]}" ; do
        pkg=$(echo "$line" | sed -e 's|.*$||' -e 's|^.*>||')
        case "$pkg" in
            base | base-devel) continue ;;
        esac
        echo "$pkg"
        if [ "$(pacman -Si "$pkg")" != "" ] ; then
            ((okcount++))
        else
            if [ "$(yay -Si "$pkg" 2>/dev/null | grep "^Repository " | grep ": aur")" != "" ] ; then
                echo "Package '$pkg' is in AUR."
                failreasons+=("AUR")
            else
                failreasons+=("missing")
            fi
            failedpkgs+=("$pkg")
            ((failcount++))
        fi
    done
    echo "$okcount succeeded, $failcount failed."
    if [ $failcount -ne 0 ] ; then
        echo "Failed packages:"
        ix=0
        for pkg in "${failedpkgs[@]}" ; do
            echo "    $pkg: ${failreasons[$ix]}"
            ((ix++))
        done
    fi
}

Main "$@"

@manuel-192
Copy link
Author

Noticed a minor bug in the end of the script. Should be fixed now.

@manuel-192
Copy link
Author

manuel-192 commented Mar 31, 2019

For the current cnchi 0.16.21-2 package the script gives the following failure output after all package names. Hopefully I haven't misunderstood the package list.

679 succeeded, 7 failed.
Failed packages:
    xorg-mkfontdir: missing
    gamin: AUR
    kdesudo: AUR
    deepin-grub2-themes: missing
    thermald: AUR
    gtk3-print-backends: missing
    vivaldi: AUR

@manuel-192
Copy link
Author

manuel-192 commented Apr 5, 2019

Tried to edit the script above to ignore commented lines in packages.xml, but github's editor trashes all changes...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants