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

Pacman: Fix name of URL packages #4959

Merged

Conversation

Minei3oat
Copy link
Contributor

SUMMARY

This PR fixes the wrong name resolution of URLs.

When the URL is unknown to pacman, it will download the package, which results in filename_without_extension downloading...\n beeing prepend to the output for each unknown URL. As this content isn't filtered out, the package name will be filename_without_extension downloading...\npackage_name.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

pacman

ADDITIONAL INFORMATION
import subprocess
result = subprocess.run(["pacman", "--upgrade", "--print-format", "%n", "https://ftp.halifax.rwth-aachen.de/manjaro/stable/core/x86_64/nano-6.3-1-x86_64.pkg.tar.zst"], capture_output=True)
result.stdout
# b' nano-6.3-1-x86_64 downloading...\nloading packages...\nnano\n'

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor os packaging plugins plugin (any type) labels Jul 18, 2022
Inspired by the integration tests for url packages
@ansibullbot ansibullbot added integration tests/integration tests tests labels Jul 19, 2022
This reverts commit f60d92f.

Accidentally commited to the wrong branch.
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-4 labels Jul 20, 2022
@felixfontein
Copy link
Collaborator

CC @jraby

@jraby
Copy link
Contributor

jraby commented Jul 21, 2022

Nice, thanks for taking the time to fix this. I definitely didn't test URLs when developing the feature, only local pkgs.
As a side note, I wish pacman didn't output diagnostic/info logs on stdout, especially when --print-format is used, but I guess that's another story.

I was wondering if we could find a way to add a test for this, there's already something close, but not quite:
https://github.com/ansible-collections/community.general/blob/main/tests/integration/targets/pacman/tasks/package_urls.yml
It tests installing a package from the local filesystem and from a URL, but the URL used is from one of the configured repo which works around the behavior that was broken.

I'm not sure how to go about this since we probably don't want to hardcode a URL...

@felixfontein
Copy link
Collaborator

@jraby you can always download a package and then serve it through a local HTTP server, and install it through that URL.

@felixfontein
Copy link
Collaborator

Should we merge this for now? Then you (or whoever wants to) can add tests in a follow-up PR, and most importantly #4956 can proceed.

@Minei3oat
Copy link
Contributor Author

Minei3oat commented Jul 21, 2022

I created a new PR for improving the integrity tests for url packages: #4968

@jraby
Copy link
Contributor

jraby commented Jul 21, 2022

Should we merge this for now? Then you (or whoever wants to) can add tests in a follow-up PR, and most importantly #4956 can proceed.

Oh absolutely! I didn't mean to hold this PR (or #4956) back, I was just thinking out loud!
Go ahead and merge!

@felixfontein felixfontein merged commit 788cfb6 into ansible-collections:main Jul 21, 2022
@patchback
Copy link

patchback bot commented Jul 21, 2022

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/788cfb624aa7e694b533b5d2722aab0ff4522ce6/pr-4959

Backported as #4970

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jul 21, 2022
* Strip downloading... of unseen URLs

* Added changelog fragment

* Added integration tests for reason and reason_for

Inspired by the integration tests for url packages

* Revert "Added integration tests for reason and reason_for"

This reverts commit f60d92f.

Accidentally commited to the wrong branch.

(cherry picked from commit 788cfb6)
@patchback
Copy link

patchback bot commented Jul 21, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/788cfb624aa7e694b533b5d2722aab0ff4522ce6/pr-4959

Backported as #4971

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@Minei3oat thanks for fixing this!
@jraby thanks for reviewing!

patchback bot pushed a commit that referenced this pull request Jul 21, 2022
* Strip downloading... of unseen URLs

* Added changelog fragment

* Added integration tests for reason and reason_for

Inspired by the integration tests for url packages

* Revert "Added integration tests for reason and reason_for"

This reverts commit f60d92f.

Accidentally commited to the wrong branch.

(cherry picked from commit 788cfb6)
This was referenced Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug integration tests/integration module module new_contributor Help guide this first time contributor os packaging plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants