xbps icon indicating copy to clipboard operation
xbps copied to clipboard

include a built-in way for xbps-install to ignore packages it can't find in repository and continue with installing the rest

Open gpioneer90 opened this issue 4 years ago • 9 comments

when attempting to "xbps-install x y z" package y is not found in the repositories. XBPS stops in its tracks and stops the entire command, instead of proceeding with finding/installing package z (and possibly package x).

On the very helpful IRC channel I was directed to use a for loop to get this command running. It worked, but that's a very complicated/unintiutive way (to me, a non-programmer) to do something that should be very simple IMO.

Is there a way to implement a flag in xbps-install to proceed with the command and simply ignore packages it can't find? ("xbps-install -i x y z" (-i to ignore errors, or something like this.)

I don't believe I ran into this issue with apt, zypper, or dnf.

gpioneer90 avatar Oct 11 '21 13:10 gpioneer90

Is there any good reason for why this would be useful?

Duncaen avatar Oct 11 '21 15:10 Duncaen

Well for example as a casual Linux user, I wanted to install many packages in one go through common names I knew. So I tried doing xbps-install followed by a long list of packages I wanted installed. But as soon as xbps ran into the first package on the list it couldn't find in the repository, it would stop, instead of simply going to the next package and letting me know at the end prior to installing that some packages were not found.

There is currently no easy way to install multiple packages in this manner, unless you do something more hack-like, as was suggested to me with the loop command on IRC. It would be nice to have this built in to xbps so any user can accomplish this task

----- Original message ----- From: Duncan Overbruck @.> To: void-linux/xbps @.> Cc: gpioneer90 @.>, Author @.> Subject: Re: [void-linux/xbps] include a built-in way for xbps-install to ignore packages it can't find in repository and continue with installing the rest (#432) Date: Monday, October 11, 2021 10:22

Is there any good reason for why this would be useful?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/void-linux/xbps/issues/432#issuecomment-940127264, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMTANTY73HFPVIKI3XUHF3UGL6LHANCNFSM5FYH3XTQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ghost avatar Oct 11 '21 15:10 ghost

I don't really see how this is useful or worth a new flag.

This would also have some pretty weird implications. As example the list of packages and the order of how they are being installed can influence the final list of packages being installed in case of virtual dependencies, randomly skipping some package might change what is being installed.

I don't believe other package managers actually have such a flag.

Duncaen avatar Oct 11 '21 15:10 Duncaen

I don't believe they require a flag. But, I don't currently have another OS installed to confirm. I think if you try apt-get install x y z, and y is a made up package name, it should still try and install x and z (I believe), but Void does not.

So unless you use the 'if loop' workaround, you basically have to do xbps-install x - let it install it, then xbps-install z, let it install it, etc etc, one at a time. All because xbps shuts down when it can't find just one packages in a long list of packages =/ perhaps others will chime in if this is useful or not at some points in the future. Thanks for the consideration!

----- Original message ----- From: Duncan Overbruck @.> To: void-linux/xbps @.> Cc: gpioneer90 @.>, Author @.> Subject: Re: [void-linux/xbps] include a built-in way for xbps-install to ignore packages it can't find in repository and continue with installing the rest (#432) Date: Monday, October 11, 2021 10:37

I don't really see how this is useful or worth a new flag.

This would also have some pretty weird implications. as example the list of packages and the order of how they are being installed can influence the final list of packages being installed in case of virtual dependencies, randomly skipping some package might change what is being installed.

I don't believe other package managers actually have such a flag.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/void-linux/xbps/issues/432#issuecomment-940138800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMTANSL6JF3OZNLGPACVR3UGMAEZANCNFSM5FYH3XTQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ghost avatar Oct 11 '21 15:10 ghost

I suggest a different behavior:

# xbps-install foo bar baz
Package 'foo' not found in repository pool.

This should also say that baz and bar are not found.

Then long install lines can be fixed easily.

leahneukirchen avatar Oct 11 '21 16:10 leahneukirchen

That too would be a step in the right direction. It was really really frustrating trying to install a bunch of packages where many ended up not being in the repos because I had to keep running the command over and over until and removing the unfound packages one at a time until the command would finally run for the packages it did find.

----- Original message ----- From: Leah Neukirchen @.> To: void-linux/xbps @.> Cc: gpioneer90 @.>, Author @.> Subject: Re: [void-linux/xbps] include a built-in way for xbps-install to ignore packages it can't find in repository and continue with installing the rest (#432) Date: Monday, October 11, 2021 11:44

I suggest a different behavior:

# xbps-install foo bar baz Package 'foo' not found in repository pool. This should also say that baz and bar are not found.

Then long install lines can be fixed easily.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/void-linux/xbps/issues/432#issuecomment-940188120, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMTANRECGE7CJ6YZGAU5M3UGMH7TANCNFSM5FYH3XTQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ghost avatar Oct 13 '21 09:10 ghost

I'm interested in implementing the behavior @leahneukirchen suggested. I see other people are receptive to the idea.

My implementation wouldn't install anything, it would only print the rest of the non-existent packages. This respects the current installation/update behavior of not executing the transaction if any of the target packages are not found.

Is this something the xbps maintainers would be open to accepting?

jony255 avatar Nov 11 '21 00:11 jony255

Hi, I took a stab at creating the behavior the @leahneukirchen described, xbps-install will still abort if it cannot find the packages, however it will continue to list the packages it cannot find and those that are already installed. It still remains silent if it can find a package (in the example below, rust is found, and is not currently installed.

# xbps-install zlib foo bar grep nonexistent baz rust
Package `zlib' already installed.
Package 'foo' not found in repository pool.
Package 'bar' not found in repository pool.
Package `grep' already installed.
Package 'nonexistent' not found in repository pool.
Package 'baz' not found in repository pool.

The diff below passes all the tests from make check. Is this something the maintainers would consider accepting?

$ make check
===> Summary
Results read from /home/wren/dev/void-linux/xbps/result.db
Test cases: 266 total, 0 skipped, 3 expected failures, 0 broken, 0 failed
diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c
index c626d407..8c9ffc54 100644
--- a/bin/xbps-install/main.c
+++ b/bin/xbps-install/main.c
@@ -274,18 +274,21 @@ main(int argc, char **argv)
        rv = exec_transaction(&xh, maxcols, yes, drun);
    } else if (!update) {
        /* Install target packages */
+       bool target_pkgs_not_found = false;
        for (i = optind; i < argc; i++) {
            rv = install_new_pkg(&xh, argv[i], force);
            if (rv == EEXIST) {
                /* pkg already installed, ignore */
                rv = 0;
                eexist++;
+           } else if (rv == ENOENT) {
+               target_pkgs_not_found = true;
            } else if (rv != 0) {
                xbps_end(&xh);
                exit(rv);
            }
        }
-       if (eexist == argc)
+       if (eexist == argc || target_pkgs_not_found)
            goto out;

        rv = exec_transaction(&xh, maxcols, yes, drun);

AlexDvorak avatar Dec 02 '21 03:12 AlexDvorak

Update mode should do the same. Send a PR.

Chocimier avatar Dec 04 '21 22:12 Chocimier