Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ease the base package installs #3457

Closed
goyalyashpal opened this issue Dec 28, 2022 · 18 comments
Closed

Ease the base package installs #3457

goyalyashpal opened this issue Dec 28, 2022 · 18 comments
Labels
not-bug General questions, not an issue

Comments

@goyalyashpal
Copy link

goyalyashpal commented Dec 28, 2022

Summary

Installation of packages with multiple binaries available with different package prefixes should be simpler. Different package prefixes i.e. build against different environments.
ref: "Package Naming" via #3095 thanks god i had opened that issue 😇

Summary in examples:

Should look like:

$ pacman -S helix
... optional Questions about choice ...
... on with install ...

Looks like:

$ pacman -S helix
error: target not found: helix

$ pacman -Ss helix
mingw32/mingw-w64-i686-helix 22.12-1
    A post-modern modal text editor (mingw-w64)
mingw64/mingw-w64-x86_64-helix 22.12-1
    A post-modern modal text editor (mingw-w64)
ucrt64/mingw-w64-ucrt-x86_64-helix 22.12-1
    A post-modern modal text editor (mingw-w64)

# Some moments of confusion and research
# Then COPY PASTE

$ pacman mingw-w64-***-helix
... on with install ...

Details about problem and current situation

  • In case a "base" package is available as build against multiple environments, the package names are prefixed with that environment info.
  • While good for disambiguation, this causes the install instructions to become huge and often inconvenient.
  • It is self evident when took in contrast with install instruction via other package managers
    Refer: helix/install (click here for permalink)

This would not have been a problem if msys2 were only limited for fetching toolchains, or unix packages. However,

  • As msys2 is now also being used as a reliable package manager for fetching native packages
  • that is, this inconvenience caused by long names will pervade to normal users too

P.S.

  • helix is just one example, nothing special to it, replace it with any other appropriate package name.
  • what is syntax for comment in the code block for "console" ? I had to use "bash" to use comments.
    2023-02-15: exact how it's in console, so, has to have prompt i.e. $ before #. Found while documenting this: Reset msys2 #3535 (comment)

@goyalyashpal
Copy link
Author

goyalyashpal commented Dec 28, 2022

Thoughts about possible solutions

  • I know, that the solution is not very straightforward and this problem is inherent with choice of building environements,
  • but as these packages are listed under the same page on packages.msys2.org
    Refer: [msys2/helix], and [msys2/gnuplot]
  • so, there's some record or way to club the packages together

1.1

So, some thought out combination of the following points can yield some solution i think

  • assigning priority to environments (as in f-droid repo priority)
  • auto detection: say to: deprioritise i686 ones on x86_64 architectures
  • global preference (as in git --config global)
  • if some ambiguity still remains, then asking for the specification of the package while installing, rather than before...

Ofcourse, this last step also cause some UX issue:

  • the whole pipeline will pause waiting for user input,
  • which can be jumpy for veteran CLI users
  • but i think if the combination is battle tested enough, then maybe such case(s) of remaining ambiguity will be very very less.

1.2

One further solution can be to add a different option for such base packages. So, using these base package names with normal existing flags will issue error as currently does, and job will run as always. But using these names with that new flag will use this above suggested workflow

Example run:

The comments are just to communicate to you, not necessarily showing that they will be echoed.

$ pacman -S [--base] helix
$ pacman -S helix
# No exact match found
# Match found for "base package"
# Fetching binaries for different environments
# Narrowing down environments based on those points
# Ambiguity still remaining

Choose environment from below:
#say
clang-x86_64
x86_64
#user inputs accordingly, say
x86_64 chosen
... on with install ...

@goyalyashpal
Copy link
Author

Or...

  • maybe some solution already exists out there, maybe even in pacman and just i don't know about it 😅
  • The --groups option comes quite close to it maybe?
  • maybe MSYSTEM active environment already automatically chooses it? I ran via wezterm, and my msys-launcher ain't working since months, so, i don't know.
    Ref: MSYS2_shell.cmd file not launching #3102

@1480c1
Copy link
Contributor

1480c1 commented Dec 28, 2022

I personally would recommend just getting pacboy and running pacboy -S helix:p, with the appropriate value for MINGW_PACKAGE_PREFIX set within the environment. Only downside afaik is you don't have a way to call that from outside a shell, so not from powershell or cmd, at least not without doing something like bash -lc 'pacboy -S helix:p'

@goyalyashpal
Copy link
Author

goyalyashpal commented Dec 31, 2022

running pacboy -S helix:p,
with the appropriate value for MINGW_PACKAGE_PREFIX set within the environment

wow, glad to see that it uses very similar solution to the one i proposed

  • with :p which i am supposing is similar to specifying base package with a separate flag
  • and the environment variable value)

i tried finding its manual online, but didn't find anything on:


Update: 2023.01.01

while searching for git ( pacman -Ss git ), i noticed there is package called pactoys. nice.

pacman -S* pactoys

this was what you meant right?
but notice in the (abridged) output of pacman -Si for it, it doesn't says pacboy in the "provides" field 🤔
edit: but it provides pacboy nonetheless lol

$ pacman -Ss pactoys
msys/pactoys r55.8860e1f-1
    A set of pacman packaging utilities

$ pacman -Si pactoys
...
URL             : https://github.com/renatosilva/pactoys
Provides        : pactoys-git  repman-git  updpkgver-git
...

Update: 2023.03.03
Referring to: #3593 (reply in thread)

pacman -F pacboy will "query the database to know which remote package a file belongs to:"

Use it with bash's brace expansion to include the .exe:

pacboy -F {pacboy,clangd}{,.exe} will result in: pacboy -F pacboy pacboy.exe clangd clangd.exe

@goyalyashpal
Copy link
Author

other than that, i'd still say that this solution should be embedded within msys2's pacman

@goyalyashpal
Copy link
Author

goyalyashpal commented Jan 1, 2023

After finding the pactoys today, following is the manual for pacboy for my reference:

pacboy (abrdiged)

anyways, so, here's breakdown of the command you shared (just for my own records) from the CLI command usage manual for it:

# pacboy -S helix:p
$ pacboy

    This is a pacman wrapper for MSYS2 which handles the package prefixes
    automatically, and provides human-friendly commands for common tasks.

Usage:
        pacboy [command] [arguments]

        For 64-bit MSYS2 shell:
            name:p means MINGW_PACKAGE_PREFIX-only

Commands:
        sync        Shorthand for --sync or --upgrade
pacboy
$ pacboy

    Pacboy 2016.6.24
    Copyright (C) 2015, 2016 Renato Silva
    Licensed under BSD

    This is a pacman wrapper for MSYS2 which handles the package prefixes
    automatically, and provides human-friendly commands for common tasks.

    Usage:
        pacboy [command] [arguments]
        Arguments will be passed to pacman after translation:

        For 64-bit MSYS2 shell:
            name:i means i686-only
            name:x means x86_64-only
            name:z means clang-i686-only
            name:c means clang-x86_64-only
            name:u means ucrt-x86_64-only
            name:a means clang-aarch64-only
            name:p means MINGW_PACKAGE_PREFIX-only

        For MSYS shell:
            name:m means mingw-w64
            name:l means mingw-w64-clang

        For all shells:
            name: disables any translation for name
            repository::name means repository/name

    Commands:
        sync        Shorthand for --sync or --upgrade
        update      Shorthand for --sync --refresh --sysupgrade
        refresh     Shorthand for --sync --refresh
        find        Shorthand for --sync --search
        packages    Shorthand for --sync --list
        files       Shorthand for --query --list [--file]
        info        Shorthand for --query --info [--file]
        origin      Shorthand for --query --owns or --files
        remove      Shorthand for --remove --recursive
        debug       Verbose output for the above commands

"... a pacman wrapper for MSYS2 which handles the package prefixes automatically"

  • yes, that's as close as it can get to what i meant ... (the package prefix part)
  • umh, this package prefix functinality should be merged in the msys2's pacman i guess? 😅
  • it's just one additional msys2 specific flag and rest fits perfectly with rest of the system probably

I just tried actually running that command, and it didn't execute successfully, even after setting values for MINGW_PACKAGE_PREFIX manually ( echo $MINGW_PACKAGE_PREFIX showed blank earlier )

$ MINGW_PACKAGE_PREFIX=x86_64
$ MINGW_PACKAGE_PREFIX=mingw-w64-x86_64
$ MINGW_PACKAGE_PREFIX=mingw-w64-x86_64-
$ pacboy -S helix:p
usage:  pacman {-S --sync} [options] [package(s)]
options:
...

$ pacboy sync helix:p
usage:  pacman {-S --sync} [options] [package(s)]
options:
...

$ pacboy debug sync helix:p
:: Executing pacman --color auto --sync -helix...
usage:  pacman {-S --sync} [options] [package(s)]
options:
...

$ pacboy -S helix
error: target not found: helix
...

@Biswa96
Copy link
Member

Biswa96 commented Jan 1, 2023

this should be merged in the msys2's pacman i guess?

No, pacman and pactoys are separate project. It should be modified only when it is not possible in any other ways. Here "easing the prefix part" is already done by pactoys/pacboy. So, pacman can do its thing as usual.

@goyalyashpal
Copy link
Author

goyalyashpal commented Jan 1, 2023

  • i see your point, it fits very well with unix philosophy.
  • and i personally don't have any problem with it (like i said in the description too - quoted below)
  • ... other than that it didn't work 😆

This would not have been a problem if msys2 were only limited for fetching toolchains, or unix packages. However,

  • As msys2 is now also being used as a reliable package manager for fetching native packages
  • that is, this inconvenience caused by long names will pervade to normal users too
  • my main worry point is that, how to like... make this method to reach the normal end user reading the installation instructions from other sites (like that helix example....)
  • one possible way can be to increase its reach it to have pacboy/pactoy installed by default and include it in the msys2 manuals too - that is, giving it an "official treatment", will that make sense??

@Biswa96
Copy link
Member

Biswa96 commented Jan 1, 2023

make this method to reach the normal end user reading the installation instructions from other sites

The helix documentation need some clarification.

Other than the documentation, this does not look like any issue, right?

@goyalyashpal
Copy link
Author

Other than the documentation, this does not look like any issue, right?

it kinda is - when you are managing packages, or searching for multiple packages at once then for each package, there are multiple items due to these package prefixes. and being prefixes sorted alphabatically, results get super mingled.

i always brush past it as compromise and actively ignore it as it's not something i am very passionate about at the moment. but it would be good the situation could be improved.

@Biswa96
Copy link
Member

Biswa96 commented Jan 1, 2023

there are multiple items due to these package prefixes...results get super mingled.

Yeah, it is somewhat confusing at first. It happened to me also. But when you understand why the prefix was named that way it would get more clear. Hope this page may help https://www.msys2.org/docs/environments/

I shall inform you about the helix docs change.

@Biswa96 Biswa96 closed this as completed Jan 1, 2023
@Biswa96 Biswa96 added the not-bug General questions, not an issue label Jan 1, 2023
@goyalyashpal
Copy link
Author

also note that the pacboy did NOT work for me as already reported in above comment: #3457 (comment)

@Biswa96
Copy link
Member

Biswa96 commented Jan 1, 2023

It depends on which environment you are running pacboy. The :p option varies with MINGW_PACKAGE_PREFIX environment variable.

@goyalyashpal
Copy link
Author

  • one possible way can be to increase its reach it to have pacboy/pactoy installed by default and include it in the msys2 manuals too - that is, giving it an "official treatment", will that make sense??

oh! it's already been added there:
https://www.msys2.org/docs/package-naming/#avoiding-writing-long-package-names

via msys2/msys2.github.io#208
<-- found via blame on package-naming.md

@goyalyashpal
Copy link
Author

I shall inform you about the helix docs change.

just mentioning for the records: helix-editor/helix#5363

@goyalyashpal
Copy link
Author

(i also lowkey wonder why did you ask @ podsvirov for review 🤔 - obviously it's not at all important, but aaaah, my mind just gets drawn to it sorry 😅)

@Biswa96
Copy link
Member

Biswa96 commented Jan 20, 2023

i also lowkey wonder why did you ask @ podsvirov for review

See the git history of that file in helix repository.

@goyalyashpal
Copy link
Author

See the git history of that file in helix repository.

  • aaahw, ohkayh, of that file . nice.
  • i only watched git history of the repo in general.
  • but yeah, fair point, will keep this in mind.

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-bug General questions, not an issue
Projects
None yet
Development

No branches or pull requests

3 participants