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

#
# spec file for package aws-cli-cmd
#
# Copyright (c) 2024 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:           aws-cli-cmd
# We want the version to match the aws-cli version we ship
Version:        1.36.2
Release:        0
Summary:        Amazon Web Services Command Line Interface
License:        Apache-2.0
Group:          System/Management
Source0:        register_aws
Source1:        deregister_aws
URL:            https://github.com/OSInside/flake-pilot
Provides:       awscli = %{version}
Provides:       aws-cli = %{version}
Obsoletes:      aws-cli < %{version}
BuildArch:      noarch
# Package requirements on the system
Requires:       flake-pilot >= 3.1.27
Requires:       flake-pilot-podman >= 3.1.27
# 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:       groff

# Dependent containers
Requires:       aws-sdk-image
# The command container
Requires:       aws-cli-image

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

%prep

%build

%install
install -D -m 755 %{SOURCE0} %{buildroot}%{_bindir}/register_aws
install -D -m 755 %{SOURCE1} %{buildroot}%{_bindir}/deregister_aws

%post
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    register_aws
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 aws flake here in posttrans.
# Remove this hack on or after 2026-11-30
if [ "$YAST_IS_RUNNING" != "instsys" ] ; then
    register_aws
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_aws
    fi
fi

%files
%ghost %attr(0755,root,root) /usr/bin/aws"
%{_bindir}/register_aws
%{_bindir}/deregister_aws
openSUSE Build Service is sponsored by