-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Packaging} Unblock installation in customized location for deb and RPM #17491
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
Conversation
…ux_custom_install
| mkdir -p %{buildroot}%{_bindir} | ||
| python_version=$(ls %{buildroot}%{cli_lib_dir}/lib/ | head -n 1) | ||
| printf "#!/usr/bin/env bash\nAZ_INSTALLER=RPM PYTHONPATH=%{cli_lib_dir}/lib/${python_version}/site-packages /usr/bin/%{python_cmd} -sm azure.cli \"\$@\"" > %{buildroot}%{_bindir}/az | ||
| printf "#!/usr/bin/env bash\nbin_dir=\`cd \"\$(dirname \"\$BASH_SOURCE[0]\")\"; pwd\`\nAZ_INSTALLER=RPM PYTHONPATH=\"\$bin_dir\"/../%{_lib}/az/lib/${python_version}/site-packages %{python_cmd} -sm azure.cli \"\$@\"" > %{buildroot}%{_bindir}/az |
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.
The script becomes:
#!/usr/bin/env bash
bin_dir=`cd "$(dirname "$BASH_SOURCE[0]")"; pwd`
AZ_INSTALLER=RPM PYTHONPATH="$bin_dir"/../lib64/az/lib/python3.6/site-packages python3 -sm azure.cli "$@"
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.
Use python3 instead of hard-coded /usr/bin/python3. This gives users flexibility to use any installed python3 by manipulating the PATH environment variable.
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.
%{_lib} causes problem on Mariner as it is different from that on Fedora/CentOS/RedHat:
> docker run -it --rm fedora rpm --eval '%{_lib}'
lib64
> docker run -it --rm centos rpm --eval '%{_lib}'
lib64
> docker run -it --rm redhat/ubi8-minimal rpm --eval '%{_lib}'
lib64
> docker run -it --rm cblmariner.azurecr.io/base/core:1.0 rpm --eval '%{_lib}'
/usr/lib
| ${TAB}cp -a python_env/* debian/azure-cli/opt/az | ||
| ${TAB}mkdir -p debian/azure-cli/usr/bin/ | ||
| ${TAB}echo "\043!/usr/bin/env bash\nAZ_INSTALLER=DEB /opt/az/bin/python3 -Im azure.cli \"\044\100\"" > debian/azure-cli/usr/bin/az | ||
| ${TAB}echo "\043!/usr/bin/env bash\nbin_dir=\140cd \"\044(dirname \"\044BASH_SOURCE[0]\")\"; pwd\140\nAZ_INSTALLER=DEB \"\044bin_dir\"/../../opt/az/bin/python3 -Im azure.cli \"\044\100\"" > debian/azure-cli/usr/bin/az |
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.
The script becomes:
#!/usr/bin/env bash
bin_dir=`cd "$(dirname "$BASH_SOURCE[0]")"; pwd`
AZ_INSTALLER=DEB "$bin_dir"/../../opt/az/bin/python3 -Im azure.cli "$@"
| _print("Python location '{}'".format(sys.executable)) | ||
| _print("Extensions directory '{}'".format(EXTENSIONS_DIR)) | ||
| import os | ||
| _print("Python location '{}'".format(os.path.abspath(sys.executable))) |
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.
Use abspath so on Ubuntu the bundle python won't show path like /usr/bin/../../opt/az/bin/python3, instead it will just show /opt/az/bin/python3.
| Prefix: /usr | ||
| Prefix: /etc |
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.
Add Prefix to support relocatable package.
Description
Resolve #17221
This PR provides a more general
azscript to unblock customized location install, but it is not aimed to fully support custom install for deb and RPM as custom install is not fully tested and may cause some unknown issues. It is not a recommended way ofazure-cliinstallation.Testing Guide
build_testbranch build has the packages for the same code).History Notes
[Packaging] BREAKING CHANGE: RPM installed az now uses
python3instead of hard-coded/usr/bin/python3.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.