From 67705010c254aff2b40164b15fbd4a59d0576ff8 Mon Sep 17 00:00:00 2001 From: Nikola Forró Date: May 05 2023 16:05:26 +0000 Subject: Initial package --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2cd9d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/aws-cli-2.11.16.tar.gz +/aws-cli-2.11.17.tar.gz diff --git a/awscli2.spec b/awscli2.spec new file mode 100644 index 0000000..e53281a --- /dev/null +++ b/awscli2.spec @@ -0,0 +1,107 @@ +%global pkgname aws-cli + +Name: awscli2 +Version: 2.11.17 +Release: %autorelease + +Summary: Universal Command Line Environment for AWS, version 2 +# all files are licensed under Apache-2.0, except: +# - awscli/topictags.py is MIT +# - awscli/botocore/vendored/six.py is MIT +License: Apache-2.0 AND MIT +URL: https://github.com/aws/aws-cli/tree/v2 + +Source0: https://github.com/aws/aws-cli/archive/%{version}/%{pkgname}-%{version}.tar.gz + +# ruamel-yaml 0.17.22 changed whitespace formatting, breaking some TestUpdateKubeconfig tests +# add a workaround for that until upstream comes with a proper fix +Patch0: ruamel-yaml-0.17.22.patch + +BuildArch: noarch + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-pytest +BuildRequires: python%{python3_pkgversion}-pytest-xdist +BuildRequires: python%{python3_pkgversion}-jsonschema +BuildRequires: python-unversioned-command +BuildRequires: procps-ng + +Recommends: groff + +Provides: awscli = %{version}-%{release} +Obsoletes: awscli < 2 + +# provide an upgrade path from awscli-2 (Amazon Linux) +Provides: awscli-2 = %{version}-%{release} +Obsoletes: awscli-2 < %{version}-%{release} + +# python-awscrt does not build on s390x +ExcludeArch: s390x + + +%description +This package provides version 2 of the unified command line +interface to Amazon Web Services. + + +%prep +%autosetup -p1 -n %{pkgname}-%{version} + +# fix permissions +find awscli/examples/ -type f -name '*.rst' -executable -exec chmod -x '{}' + + +# use unittest.mock +find -type f -name '*.py' -exec sed \ + -e 's/^\( *\)import mock$/\1from unittest import mock/' \ + -e 's/^\( *\)from mock import mock/\1from unittest import mock/' \ + -e 's/^\( *\)from mock import/\1from unittest.mock import/' \ + -i '{}' + + + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files awscli + +# remove unnecessary scripts +rm -vf %{buildroot}%{_bindir}/{aws_bash_completer,aws_zsh_completer.sh,aws.cmd} + +# install shell completion +install -Dpm0644 bin/aws_bash_completer \ + %{buildroot}%{_datadir}/bash-completion/completions/aws +install -Dpm0644 bin/aws_zsh_completer.sh \ + %{buildroot}%{_datadir}/zsh/site-functions/_awscli + + +%check +# it appears that some tests modify the environment and remove PYTHONPATH +# so it's not passed to botocore cmd-runner, inject it here +sed -i '/self.driver.start(env=env)/i \ \ \ \ \ \ \ \ env["PYTHONPATH"] = "%{buildroot}%{python3_sitelib}"' \ + tests/utils/botocore/__init__.py + +export TESTS_REMOVE_REPO_ROOT_FROM_PATH=1 TZ=UTC +%pytest --verbose --numprocesses=auto --dist=loadfile tests/unit tests/functional + + +%files -f %{pyproject_files} +%license LICENSE.txt +%doc README.rst +%{_bindir}/aws +%{_bindir}/aws_completer +%dir %{_datadir}/bash-completion +%dir %{_datadir}/bash-completion/completions +%{_datadir}/bash-completion/completions/aws +%dir %{_datadir}/zsh +%dir %{_datadir}/zsh/site-functions +%{_datadir}/zsh/site-functions/_awscli + + +%changelog +%autochangelog diff --git a/ruamel-yaml-0.17.22.patch b/ruamel-yaml-0.17.22.patch new file mode 100644 index 0000000..e874606 --- /dev/null +++ b/ruamel-yaml-0.17.22.patch @@ -0,0 +1,25 @@ +diff --git a/awscli/customizations/eks/ordered_yaml.py b/awscli/customizations/eks/ordered_yaml.py +index 23834e0..828280a 100644 +--- a/awscli/customizations/eks/ordered_yaml.py ++++ b/awscli/customizations/eks/ordered_yaml.py +@@ -46,6 +46,7 @@ def ordered_yaml_dump(to_dump, stream=None): + :type stream: file + """ + yaml = ruamel.yaml.YAML(typ="safe", pure=True) ++ yaml.width = 99999 + yaml.default_flow_style = False + yaml.Representer.add_representer(OrderedDict, _ordered_representer) + +diff --git a/pyproject.toml b/pyproject.toml +index db82f2a..991ddfa 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -31,7 +31,7 @@ dependencies = [ + "colorama>=0.2.5,<0.4.7", + "docutils>=0.10,<0.20", + "cryptography>=3.3.2,<40.0.2", +- "ruamel.yaml>=0.15.0,<=0.17.21", ++ "ruamel.yaml>=0.15.0,<=0.17.22", + # ruamel.yaml only requires ruamel.yaml.clib for Python versions + # less than or equal to Python 3.10. In order to ensure we have + # a consistent dependency closure across all Python versions, diff --git a/sources b/sources new file mode 100644 index 0000000..9e1c298 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (aws-cli-2.11.17.tar.gz) = e9cccd2d4e33cd926f8699112e9dd77e46f228bd8f037d5ff981d41cc71cc4324dea059e4431c50b87ce1cbc5109b48ae6de2372b47c6a6ae32f88bf8c670891