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

Packager improvements #136

Merged
merged 9 commits into from Aug 29, 2022
Merged

Conversation

specious
Copy link
Contributor

As noted in #131 (comment), on Alpine we have grep implemented by busybox by default, and busybox grep doesn't know -F as --fixed-strings.

This pull request fixes that and also simplifies the logic for getting shared module paths from the system package manager query that lists what the installed libc package contains.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Collaborator

@bmoffatt bmoffatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, cc @marcomagdy since this is a followup to #131

Copy link
Contributor

@marcomagdy marcomagdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. Overall LGTM, but we need to be careful with bash changes because we don't have great CI that covers our back.
So, let's take out the unnecessary changes for now.

if [[ $(dpkg-query --listfiles libc6 | wc -l) -gt 0 ]]; then
dpkg-query --listfiles libc6 | pluck_so_files
fi
dpkg-query --listfiles libc6:$(dpkg --print-architecture) | find_so_files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not broken let's not try to be clever. I really don't want to have churn in bash files because of some arcane syntax in some distro. We already don't have good CI for different distros, so please let's not change what is currently working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, there's a bit of fragility here and it would be undesirable to introduce a regression.

My thoughts were that this is actually a more straightforward (and less hacky) approach in this particular case.

Admittedly, my testing wasn't totally comprehensive, but I did some runs with the packager in both a debian and fedora docker container to make sure that it properly does the job here and picks up the shared modules before submitting the PR.

To be precise, in the loop further down that iterates over the items, I added:

echo "module: $i"

So I could see what modules are being picked up.

Since it's natural that people will be reproducing this pattern to add support for other distros, taking the time to set a good example seems worth considering.

if grep --fixed-strings "Alpine Linux" < /etc/os-release > /dev/null; then
if grep -F "Alpine Linux" < /etc/os-release > /dev/null; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm grudgingly OK with this. But please add a comment. I, for one, don't know what -F stands for and I have to look it up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case it seems like the long form name of the flag doesn't explain its function too well either.

I added a comment that explains it: c1480f7

function pluck_so_files() {
function find_so_files() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Comment on lines -88 to +87
arch=$(uname -m)

if type rpm > /dev/null 2>&1; then
if [[ $(rpm --query --list glibc.$arch | wc -l) -gt 1 ]]; then
rpm --query --list glibc.$arch | pluck_so_files
fi
rpm --query --list glibc.$(uname -m) | find_so_files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Don't change what is already working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still like to propose that the simpler version is more robust. Maybe we can test it to make sure it works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested Amazon Linux, Arch Linux, Manjaro, etc.?

I don't see the benefits worth the risk here. If you're right, it still works the same, and if you're wrong we end up with a lot of PR churn and less confidence in the project overall. I'm sorry.

Please just fix the dpkg arch part and revert the rest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would merge this after a careful review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this PR can stay open so people can test it out.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested Amazon Linux, Arch Linux, Manjaro, etc.?

I don't see the benefits worth the risk here. If you're right, it still works the same, and if you're wrong we end up with a lot of PR churn and less confidence in the project overall. I'm sorry.

Please just fix the dpkg arch part and revert the rest.

With the Alpine changes having been cherry-picked into #137, this PR is now well-scoped into only removing the if [[ and wc -l guards on "RHEL-like" and "Debian-like" distros, making the logic consistent with "Arch-like" and Alpine. In my understanding, these guards were redundant with the pipelining to find_so_files.

I think this is merge-able now with the CI added since this comment @marcomagdy - LMK if you see some other risky aspect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it. Thank you!

@bmoffatt bmoffatt mentioned this pull request Nov 30, 2021
Comment on lines -88 to +87
arch=$(uname -m)

if type rpm > /dev/null 2>&1; then
if [[ $(rpm --query --list glibc.$arch | wc -l) -gt 1 ]]; then
rpm --query --list glibc.$arch | pluck_so_files
fi
rpm --query --list glibc.$(uname -m) | find_so_files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested Amazon Linux, Arch Linux, Manjaro, etc.?

I don't see the benefits worth the risk here. If you're right, it still works the same, and if you're wrong we end up with a lot of PR churn and less confidence in the project overall. I'm sorry.

Please just fix the dpkg arch part and revert the rest.

@bmoffatt bmoffatt merged commit 5fb60b9 into awslabs:master Aug 29, 2022
bmoffatt added a commit that referenced this pull request Feb 27, 2023
* Add demo project

* Add build-demo CI job

* Revert "Simplified method for picking out shared libraries from system package query result (#136)"

This reverts commit 5fb60b9.

---------

Co-authored-by: Bryan Moffatt <bmoffatt@users.noreply.github.com>
Co-authored-by: Bryan Moffatt <bryan@bryanmoffatt.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants