File az-cli-cmd.spec of Package az-cli-cmd

#
# spec file for package az-cli-cmd
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%if 0%{?suse_version} >= 1600
%define pythons python313
%else
%define pythons python311
%endif
%global _sitelibdir %{%{pythons}_sitelib}

Name:           az-cli-cmd
# We want the version to match the az-cli version we ship
Version:        1.37.1
Release:        0
Summary:        Microsoft Azure Command Line Interface
License:        Apache-2.0
Group:          System/Management
Source0:        register_az
Source1:        deregister_az
URL:            some-github-project
Provides:       azcli = %{version}
# Upgrade the system installed azure-cli package in SLE 15 to the new way of
# packaging the cli
Provides:       azure-cli = %{version}
Obsoletes:      azure-cli < %{version}
BuildArch:      noarch
# Package requirements on the system
Requires:       ca-certificates
Requires:       flake-pilot
Requires:       flake-pilot-podman
# Package requirements from runtime container
Requires:       (%{pythons}-PyYAML >= 3.10 with %{pythons}-PyYAML <= 6.1)
Requires:       (%{pythons}-colorama >= 0.2.5 with %{pythons}-colorama <= 0.5.0)
Requires:       (%{pythons}-docutils >= 0.10 with %{pythons}-docutils < 0.30)
Requires:       (%{pythons}-rsa >= 3.1.2 with %{pythons}-rsa < 5.0.0)
Requires:       %{pythons}-six
Requires:       %{pythons}-jmespath
Requires:       %{pythons}-python-dateutil
Requires:       %{pythons}-requests
Requires:       %{pythons}-Fabric
Requires:       %{pythons}-PyGithub
Requires:       %{pythons}-antlr4-python3-runtime
Requires:       %{pythons}-avro
Requires:       %{pythons}-capturer
Requires:       %{pythons}-coloredlogs
Requires:       %{pythons}-fixedint
Requires:       %{pythons}-humanfriendly
Requires:       %{pythons}-javaproperties
Requires:       %{pythons}-jsondiff
Requires:       %{pythons}-knack
Requires:       %{pythons}-pycomposefile
Requires:       %{pythons}-pydash
Requires:       %{pythons}-retrying
Requires:       %{pythons}-scp
Requires:       %{pythons}-semver
Requires:       %{pythons}-sshtunnel
Requires:       %{pythons}-strictyaml
Requires:       %{pythons}-verboselogs
Requires:       %{pythons}-zipp
Requires:       %{pythons}-py-deviceid
Requires:       %{pythons}-pluggy
Requires:       %{pythons}-mmh3
Requires:       %{pythons}-iniconfig
Requires:       %{pythons}-dill
Requires:       %{pythons}-importlib-metadata
Requires:       %{pythons}-pytest
Requires:       %{pythons}-isort
Requires:       %{pythons}-syrupy
Requires:       %{pythons}-yarg

# Dependent containers
Requires:       az-cli-image
Requires:       az-sdk-image >= 0.1.9

%description
The Azure Command Line Interface (CLI) is a unified tool to manage Azure
services. With this tool, multiple Azure services can be controlled
from the command line and automated through scripts.

%prep

%build

%install
install -D -m 755 %{SOURCE0} %{buildroot}%{_bindir}/register_az
install -D -m 755 %{SOURCE1} %{buildroot}%{_bindir}/deregister_az

%post
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    register_az
fi

%posttrans
# bsc#1253743 older packages did not differentiate between upgrade
# and package removal as such on upgrade "postun" of the old package
# runs after "post" of the new and would harm the registration.
# To workaround this we re-register the az flake here in posttrans.
# Remove this hack on or after 2026-11-30
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    register_az
fi

%preun
# runs on package removal
# does not run on install or upgrade
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    if [ "$1" -eq 0 ]; then
        deregister_az
    fi
fi

%files
%ghost %attr(0755,root,root) %{_bindir}/az"
%{_bindir}/register_az
%{_bindir}/deregister_az
openSUSE Build Service is sponsored by