-
Notifications
You must be signed in to change notification settings - Fork 932
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
install_prereq: Fix package so asterisk can install on debian buster,bullseye, and bookworm. #489
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things...
- Please open a corresponding "improvement" issue and add a "Fixes" or 'Resolves" line to the commit message per Commit Messages
- Is this really docker specific? Doesn't seem so.
- Update the commit message summary line so it's clear that it's only install_prereq that's changing:
install_prereq: Update for debian:bullseye
might be better. - Add the cherry-pick comment per Code-Contribution
- You might want to list the packages that were actually changed in the commit message.
- How far back in ubuntu and debian versions are the changes still good? If this breaks installing on ubuntu:18 or debian:buster for instance, this would be a problem.
Remember to follow the procedure for force pushing an amended commit described in Code-Contribution.
After you re-push up the commit, don't forget to change the PR description. It doesn't update automatically.
REMINDER: If this PR applies to other branches, please add a comment with the appropriate "cherry-pick-to" headers as per the Create a Pull Request process. If you don't want it cherry-picked, please add a comment with If, after adding "cherry-pick-to" comments, you change your mind, please edit the comment to DELETE the header lines and add The currently active branches are now 18, 20, 21 and master. |
This PR has been marked stale because it has been in "Changes Requested" or "submitter-action-required" state for 28 days or more. Please make the requested changes within 14 days or the PR will be closed. |
✅ Please open a corresponding "improvement" issue and add a "Fixes" or 'Resolves" line to the commit message per Is this really docker specific? Doesn't seem so. ✅ Update the commit message summary line so it's clear that it's only install_prereq that's changing ✅ Add the cherry-pick comment per Code-Contribution ✅ You might want to list the packages that were actually changed in the commit message. How far back in ubuntu and debian versions are the changes still good? If this breaks installing on ubuntu:18 or debian:buster for instance, this would be a problem. |
contrib/scripts/install_prereq
Outdated
EXISTS=`dpkg -l | cut -d ' ' -f 3 | grep ^"${pack}"\\$ | wc -l` | ||
if [ ${EXISTS} -eq 0 ]; then | ||
echo "${pack}" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ! dpkg -l | awk 'NR > 5 {print $2}' | grep -q ^"${pack}"$; then
echo "${pack}"
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it may be as simple as:
dpkg -l "${pack}" >/dev/null 2>&1 || echo "${pack}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @seanbright -- your suggestion here isn't quite safe:
cat test.sh
#!/usr/bin/env sh
PACK="SOMETHING_I_DONT_HAVE"
EXISTS=`dpkg -l "${pack}" >/dev/null 2>&1 || echo "${pack}"`
if [ ${EXISTS} -eq 0 ]; then
echo "${pack}"
fi
./test.sh
./test.sh: 6: [: -eq: unexpected operator
The approach I have is guaranteed to provide a numeric output with the | wc -l
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you misunderstood my suggestion. I was suggesting this:
check_installed_debs() {
for pack in "$@" ; do
dpkg -l "${pack}" >/dev/null 2>&1 || echo "${pack}"
done
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're going to have to switch between package lists based on the Debian/Ubuntu version. lsb_release -a
gives you some of this info (at least on Ubuntu, I don't know about Debian).
This PR has been marked stale because it has been in "Changes Requested" or "submitter-action-required" state for 28 days or more. Please make the requested changes within 14 days or the PR will be closed. |
- [x] update list of debian packages to installable packages for debian:bullseye debian:buster, and debian:bookworm libmysqlclient-dev -> libmariadb-dev-compat libgmime-2.6-dev is not available in debian:bulleye. Remove. libsrtp0-dev is no longer available on debian:bulleye. Remove. - [x] switch from aptitude to apt (so that we error messages are more obvious when packages aren't found) - [x] switch aptitude check for packages to dpkg since thats one less dependency needed. - [x] verify works w/ debian:buster, debian:bullseye, debian:bookworm. Side note, I didn't test w/ Debian:jessie since that Docker image was returning 404's when attempting an apt update out of the box. See [Github Gist containing Dockerfiles I used to test this PR](https://gist.github.com/jackdpeterson/c75eed4ac6e842e173fde80b56af3b04)
@seanbright -- I'd appreciate your feedback on this PR. I've modified my changes to separate out the different debian releases and select the packages there. This should make this more maintainable going forward and could be used as a pattern for other distributions that change/modify/remove packages over time. In-scope: debian based OS's.
Commands to build: Buster
Bullseye
Bookworm
Initially I tried compiling this on a Macbook Pro w/ an M1 chip; and compilation of asterisk failed there. What did work was launching a C5.2xlarge instance on AWS EC2 running Ubuntu 22.04 w/ git and docker.io installed. |
Could use a little bit of guidance on the failing tests here. Not making any changes to PJSIP. |
The install_prereq script is not used, the failing tests can be ignored for this PR. |
implement seanbright's change
Fixing one more issue; ensuring that dpkg -l section properly gets converted to a number always w/
|
## Default for previous debian releases | ||
extra_packs=`check_installed_debs $PACKAGES_DEBIAN` | ||
|
||
## Debian Bookworm | ||
if [ $(cat /etc/debian_version | cut -d '.' -f 1) -eq 10 ]; then | ||
extra_packs=`check_installed_debs $PACKAGES_DEBIAN_BUSTER` | ||
fi | ||
|
||
if [ $(cat /etc/debian_version | cut -d '.' -f 1) -eq 11 ]; then | ||
extra_packs=`check_installed_debs $PACKAGES_DEBIAN_BULLSEYE` | ||
fi | ||
|
||
if [ $(cat /etc/debian_version | cut -d '.' -f 1) -eq 12 ]; then | ||
extra_packs=`check_installed_debs $PACKAGES_DEBIAN_BOOKWORM` | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be simplified with a case
statement? Something like:
case "$(cut -f1 -d. /etc/debian_version)" in
10) extra_packs=$(check_installed_debs $PACKAGES_DEBIAN_BUSTER) ;;
11) extra_packs=$(check_installed_debs $PACKAGES_DEBIAN_BULLSEYE) ;;
12) extra_packs=$(check_installed_debs $PACKAGES_DEBIAN_BOOKWORM) ;;
*) extra_packs=$(check_installed_debs $PACKAGES_DEBIAN) ;;
esac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty. I'll update the PR and test it to reflect that concept.
This PR has been marked stale because it has been in "Changes Requested" or "submitter-action-required" state for 28 days or more. Please make the requested changes within 14 days or the PR will be closed. |
Other notes: this is a pretty messy script as-is and should probably have those constants split by version of OS. For example, debian bullseye doesn't have the mysql dependency available -- that's replaced w/ mariaDB equivalent client connector library. Furthermore, certain legacy libraries are replaced by newer versions.