-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fixes to failing mpm --pacman install <package_id>
#766
Conversation
`gitlab-runner exec docker pacman` runs the pipeline. And it fails.
mpm --pacman install vim
mpm --pacman install <package_id>
Thanks @dilawar for the PR! As you pointed out, the unittest suite is not bullet-proof and quite fragile. 90% of the work on I'll merge your PR as-is and trust you on |
I'm wondering why it didn't work before 🤔 Because |
I'm not a pacman user so I blindly rely on you two to decide which is the better way. Adding more tests and making the test suite robust will help us go to the bottom of it. But I don't have a clue on how to cleanly integrate Docker with GitHub workflows. 😅 |
If I remember correctly, we never reached to We still have a problem though. For example, if I have two packages from two different repos.
[dilawars@chutki meta-package-manager (post_766)]$ poetry run mpm --pacman search samtools
╭─────────────┬──────┬─────────┬────────────────╮
│ Package ID │ Name │ Manager │ Latest version │
├─────────────┼──────┼─────────┼────────────────┤
│ r-rsamtools │ │ pacman │ 2.12.0-4 │
│ samtools │ │ pacman │ 1.16-1 │
│ samtools │ │ pacman │ 1.16.1-1 │
╰─────────────┴──────┴─────────┴────────────────╯
3 packages total (pacman: 3). [dilawars@chutki meta-package-manager (post_766)]$ poetry run mpm --pacman install samtools
Package manager order: pacman
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click_extra/commands.py", line 142, in main
super().main(*args, **kwargs)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click_extra/commands.py", line 175, in invoke
return super().invoke(ctx)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/dilawars/Work/GITHUB/DILAWAR/meta-package-manager/meta_package_manager/cli.py", line 727, in install
raise ValueError("Exact search returned multiple packages.")
ValueError: Exact search returned multiple packages. [dilawars@chutki meta-package-manager (post_766)]$ poetry run mpm --pacman search bioarchlinux/samtools
0 package total (pacman: 0). [dilawars@chutki meta-package-manager (post_766)]$ poetry run mpm --pacman search samtools
╭───────────────────────────────┬─────────────┬─────────┬────────────────╮
│ Package ID │ Name │ Manager │ Latest version │
├───────────────────────────────┼─────────────┼─────────┼────────────────┤
│ bioarchlinux/package_name │ r-rsamtools │ pacman │ 2.12.0-4 │
│ bioarchlinux/package_name │ samtools │ pacman │ 1.16.1-1 │
│ home_subcom_Arch/package_name │ samtools │ pacman │ 1.16-1 │
╰───────────────────────────────┴─────────────┴─────────┴────────────────╯
3 packages total (pacman: 3). [dilawars@chutki meta-package-manager (post_766)]$ poetry run mpm --pacman install samtools
Package manager order: pacman
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click_extra/commands.py", line 142, in main
super().main(*args, **kwargs)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click_extra/commands.py", line 175, in invoke
return super().invoke(ctx)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/dilawars/.cache/pypoetry/virtualenvs/meta-package-manager-fj-rdx---py3.10/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/dilawars/Work/GITHUB/DILAWAR/meta-package-manager/meta_package_manager/cli.py", line 728, in install
raise ValueError(f"Exact search returned multiple packages: {pkg_list}")
ValueError: Exact search returned multiple packages: ['bioarchlinux/samtools', 'home_subcom_Arch/samtools'] Above are my old notes before submitting the PR. I feel that forcing only a single match by raising exceptions if there are multiple matches is a bit more strict IMO. We can print a warning and continue with the first match?! But I also appreciate that things are explicit. Maybe we can have |
Interesting. When I use pacman with "exact" search, it shows me this:
(gvim as well because gvim provides vim) And yeah, because a package can exist in multiple repos (the most famous being testing for versions before going to extra etc.), the repo name should be part of the package name. The only problem is, that you can't search for "repo/package" in pacman. To check if a package exists (with repo name), you have to use |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Before this PR.
After this PR, this works!
Fix
Fixes the parsing of the output of
pacman search
command.Before this patch, the
package_id
would beextra/vim
from the regex. After this patch, thepackage_id
would bevim
.extra/
is parsed asrepo_id
and ignored.If pacman allows two packages with the same name but different repo e.g.
foo/vim
andbar/vim
to co-exist then this PR is not a good solution.Extra
Also adds a
.gitlab-ci.yml
file to test the package in an ArchLinux container.gitlab-runner exec docker pacman
will run the tests inside an ArchLinux container. Can be used for #561? Unfortunately, requires installation ofgitlab-runner
. +1 that you can run the pipeline locally with gitlab-runner. Happy to drop these changes though.