[Packaging] Add Dockerfile.mariner to support Mariner build#20061
[Packaging] Add Dockerfile.mariner to support Mariner build#20061
Conversation
Modify the `azure-cli.spec` with a %if conditional macro to handle mariner specific installation path. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
scripts/release/rpm/azure-cli.spec
Outdated
| python_cmd=%{python_cmd} | ||
| if command -v ${python_version} &>/dev/null; then python_cmd=${python_version}; fi | ||
| %if 0%{?cblmariner} | ||
| AZ_INSTALLER=RPM PYTHONPATH=\"%{_libdir}/az/lib/${python_version}/site-packages\" \$python_cmd -sm azure.cli \"\$@\" |
There was a problem hiding this comment.
There seems to be no difference between %{_libdir} and "$bin_dir"/../%{_lib}:
# command -v az
/usr/bin/az
# cat /usr/bin/az
#!/usr/bin/env bash
bin_dir=`cd "$(dirname "$BASH_SOURCE[0]")"; pwd`
python_cmd=python3
if command -v python3.6 &>/dev/null; then python_cmd=python3.6; fi
AZ_INSTALLER=RPM PYTHONPATH="$bin_dir"/../lib64/az/lib/python3.6/site-packages $python_cmd -sm azure.cli "$@"
# rpm --eval %{_lib}
lib64
# rpm --eval %{_libdir}
/usr/lib64
The if-else seems redundant.
There was a problem hiding this comment.
I tried that earlier, but that seemed to fail to find module specification (below):
root [ / ]# ls /usr/bin/az
/usr/bin/az
root [ / ]# cat /usr/bin/az
#!/usr/bin/env bash
bin_dir=`cd "$(dirname "$BASH_SOURCE[0]")"; pwd`
python_cmd=python3
if command -v python3.7 &>/dev/null; then python_cmd=python3.7; fi
AZ_INSTALLER=RPM PYTHONPATH="$bin_dir"/..//usr/lib/az/lib/python3.7/site-packages $python_cmd -sm azure.cli "$@"
root [ / ]# az
/usr/bin/python3.7: Error while finding module specification for 'azure.cli' (ModuleNotFoundError: No module named 'azure')
root [ / ]# There was a problem hiding this comment.
It looks like %{_lib} doesn't expand correctly. Is this a bug on the image?
There was a problem hiding this comment.
The macro %{_lib} & %{_libdir} both point to /usr/lib.
When we do the "$bin_dir"/../%{_lib}/az/lib/......... it points to a location which is not present, i.e
/usr/usr/lib/az/lib,
Mariner's %{_bindir} is /usr/bin and not /bin. This is the reason to have an %if else clause in the spec.
There was a problem hiding this comment.
I will do some research in next sprint. We may possibly find one line that works everywhere.
There was a problem hiding this comment.
I think %{_lib} is used here for a reason. Without it being available, we can't figure out the PYTHONPATH if the RPM is installed to some other place. See #17491 (comment)
There was a problem hiding this comment.
Do you want me to rebase this PR with the one you created or should I modify this PR with the change:
s/%{_lib}/lib64/
There was a problem hiding this comment.
Please just don't change this file.
|
Support Mariner |
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Co-authored-by: Jiashuo Li <4003950+jiasli@users.noreply.github.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
|
|
||
| RUN dos2unix ./scripts/release/rpm/azure-cli.spec && \ | ||
| REPO_PATH=$(pwd) CLI_VERSION=$cli_version rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && \ | ||
| cp /usr/src/mariner/RPMS/x86_64/azure-cli-${cli_version}-1.x86_64.rpm /azure-cli-dev.rpm |
There was a problem hiding this comment.
For CentOS, it is /root/rpmbuild/RPMS/x86_64/azure-cli-${cli_version}-1.*.x86_64.rpm. Interesting difference.
Description
azure-cli.rpmfor CBL-Mariner.marinerspecific build.Dockerfile.fedorato include theaz --version.Testing Guide
Created a
devrpm and tested it with installation & uninstallation.History Notes
NA
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.