pgdg-python3-argcomplete: Initial packaging for the PostgreSQL RPM repository to...
authorDevrim Gunduz <devrim@gunduz.org>
Mon, 19 May 2025 18:00:11 +0000 (21:00 +0300)
committerDevrim Gunduz <devrim@gunduz.org>
Mon, 19 May 2025 18:00:11 +0000 (21:00 +0300)
rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/Makefile [new file with mode: 0644]
rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/hotfix-bz2359689.patch [new symlink]
rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/pgdg-python3-argcomplete.spec [new symlink]
rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/Makefile [new file with mode: 0644]
rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/hotfix-bz2359689.patch [new symlink]
rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/pgdg-python3-argcomplete.spec [new symlink]
rpm/redhat/main/common/pgdg-python3-argcomplete/main/Makefile [new file with mode: 0644]
rpm/redhat/main/common/pgdg-python3-argcomplete/main/hotfix-bz2359689.patch [new file with mode: 0644]
rpm/redhat/main/common/pgdg-python3-argcomplete/main/pgdg-python3-argcomplete.spec [new file with mode: 0644]

diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/Makefile b/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/Makefile
new file mode 100644 (file)
index 0000000..cb5a32e
--- /dev/null
@@ -0,0 +1,17 @@
+#################################
+# RPM-specific Makefile                #
+# https://yum.postgresql.org   #
+#                              #
+# Devrim Gunduz                        #
+# devrim@gunduz.org            #
+#################################
+
+# Predefined values
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.rhel8
+SPECFILE="pgdg-python3-argcomplete.spec"
+
+# Now, include global Makefile
+include ../../../../global/Makefile.global
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/hotfix-bz2359689.patch b/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/hotfix-bz2359689.patch
new file mode 120000 (symlink)
index 0000000..2f83885
--- /dev/null
@@ -0,0 +1 @@
+../main/hotfix-bz2359689.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/pgdg-python3-argcomplete.spec b/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-8/pgdg-python3-argcomplete.spec
new file mode 120000 (symlink)
index 0000000..49baa90
--- /dev/null
@@ -0,0 +1 @@
+../main/pgdg-python3-argcomplete.spec
\ No newline at end of file
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/Makefile b/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/Makefile
new file mode 100644 (file)
index 0000000..2da3567
--- /dev/null
@@ -0,0 +1,17 @@
+#################################
+# RPM-specific Makefile                #
+# https://yum.postgresql.org   #
+#                              #
+# Devrim Gunduz                        #
+# devrim@gunduz.org            #
+#################################
+
+# Predefined values
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.rhel9
+SPECFILE="pgdg-python3-argcomplete.spec"
+
+# Now, include global Makefile
+include ../../../../global/Makefile.global
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/hotfix-bz2359689.patch b/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/hotfix-bz2359689.patch
new file mode 120000 (symlink)
index 0000000..2f83885
--- /dev/null
@@ -0,0 +1 @@
+../main/hotfix-bz2359689.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/pgdg-python3-argcomplete.spec b/rpm/redhat/main/common/pgdg-python3-argcomplete/EL-9/pgdg-python3-argcomplete.spec
new file mode 120000 (symlink)
index 0000000..49baa90
--- /dev/null
@@ -0,0 +1 @@
+../main/pgdg-python3-argcomplete.spec
\ No newline at end of file
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/main/Makefile b/rpm/redhat/main/common/pgdg-python3-argcomplete/main/Makefile
new file mode 100644 (file)
index 0000000..5de2dac
--- /dev/null
@@ -0,0 +1,17 @@
+#################################
+# RPM-specific Makefile                #
+# https://yum.postgresql.org   #
+#                              #
+# Devrim Gunduz                        #
+# devrim@gunduz.org            #
+#################################
+
+# Predefined values
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.f99
+SPECFILE="pgdg-python3-argcomplete.spec"
+
+# Now, include global Makefile
+include ../../../../global/Makefile.global
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/main/hotfix-bz2359689.patch b/rpm/redhat/main/common/pgdg-python3-argcomplete/main/hotfix-bz2359689.patch
new file mode 100644 (file)
index 0000000..cd367c0
--- /dev/null
@@ -0,0 +1,33 @@
+From 38e41e474749a2b4ee3d16bf5bbb3fb19a1998a2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 17 Apr 2025 10:11:12 +0200
+Subject: [PATCH] Temporary hotfix for rhbz#2359689
+
+Reported upstream in https://github.com/kislyuk/argcomplete/issues/535
+
+Fedora RPM-packaged scripts using argcompelte all have Python shebangs.
+
+This checks if the interpreter is anything with python or pypy in it.
+
+Proper fix awaiting upstream response.
+---
+ argcomplete/bash_completion.d/_python-argcomplete | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/argcomplete/bash_completion.d/_python-argcomplete b/argcomplete/bash_completion.d/_python-argcomplete
+index 81c9d41..6520b93 100644
+--- a/argcomplete/bash_completion.d/_python-argcomplete
++++ b/argcomplete/bash_completion.d/_python-argcomplete
+@@ -193,7 +193,8 @@ _python_argcomplete_global() {
+             if (__python_argcomplete_scan_head_noerr "$SCRIPT_NAME" easy_install \
+                 && "${interpreter[@]}" "$(__python_argcomplete_which python-argcomplete-check-easy-install-script)" "$SCRIPT_NAME") >/dev/null 2>&1; then
+                 ARGCOMPLETE=1
+-            elif __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
++            elif ([[ "${interpreter[@]}" == *python* ]] || [[ "${interpreter[@]}" == *pypy* ]])\
++                && __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
+                 ARGCOMPLETE=1
+             fi
+         fi
+-- 
+2.49.0
+
diff --git a/rpm/redhat/main/common/pgdg-python3-argcomplete/main/pgdg-python3-argcomplete.spec b/rpm/redhat/main/common/pgdg-python3-argcomplete/main/pgdg-python3-argcomplete.spec
new file mode 100644 (file)
index 0000000..9437a66
--- /dev/null
@@ -0,0 +1,86 @@
+%global modname argcomplete
+
+%if 0%{?fedora} && 0%{?fedora} <= 42
+%global        __python3 %{_bindir}/python3.13
+%global        python3_pkgversion 3.13
+%endif
+%if 0%{?rhel} && 0%{?rhel} < 10
+%global        __python3 %{_bindir}/python3.12
+%global        python3_pkgversion 3.12
+%endif
+%if 0%{?suse_version} >= 1500
+%global        __python3 %{_bindir}/python3.11
+%global        python3_pkgversion 311
+%endif
+
+Name:          python%{python3_pkgversion}-%{modname}
+Summary:       Bash tab completion for argparse
+Version:       3.6.2
+Release:       1PGDG%{dist}
+License:       Apache-2.0
+URL:           https://github.com/kislyuk/%{modname}
+Source0:       https://files.pythonhosted.org/packages/source/a/%{modname}/%{modname}-%{version}.tar.gz
+
+# Temporary hotfix for https://bugzilla.redhat.com/2359689
+# Reported upstream in https://github.com/kislyuk/argcomplete/issues/535
+Patch:         hotfix-bz2359689.patch
+
+BuildRequires: python%{python3_pkgversion}-devel
+BuildArch:     noarch
+
+%description
+Tab complete all the things!
+
+Argcomplete provides easy, extensible command line tab completion of
+arguments for your Python application.
+
+It makes two assumptions:
+
+ - You're using bash or zsh as your shell
+ - You're using argparse to manage your command line arguments/options
+
+Argcomplete is particularly useful if your program has lots of options
+or subparsers, and if your program can dynamically suggest completions
+for your argument/option values (for example, if the user is browsing
+resources over the network).}
+
+%prep
+%autosetup -p1 -n argcomplete-%{version}
+# Remove useless BRs (aka linters)
+sed -i -r -e '/test = /s/"(coverage|ruff|mypy)"[, ]*//g' pyproject.toml
+
+# https://github.com/kislyuk/argcomplete/issues/255
+# https://github.com/kislyuk/argcomplete/issues/256
+sed -i -e "1s|#!.*python.*|#!%{__python3}|" test/prog argcomplete/scripts/*
+sed -i -e "s|python |python3 |" test/test.py
+
+# Remove shebang from installed scripts
+sed -i '/^#!/d' argcomplete/scripts/*.py
+
+%generate_buildrequires
+%pyproject_buildrequires
+
+%build
+%pyproject_wheel
+
+%install
+%pyproject_install
+%{__rm} %{buildroot}%{_bindir}/*
+
+%files
+%license LICENSE.rst
+%doc README.rst
+%{python3_sitelib}/%{modname}-%{version}.dist-info/*
+%{python3_sitelib}/argcomplete/*.py*
+%{python3_sitelib}/argcomplete/__pycache__/*.py*
+%{python3_sitelib}/argcomplete/bash_completion.d/_python-argcomplete
+%{python3_sitelib}/argcomplete/packages/*.py*
+%{python3_sitelib}/argcomplete/packages/__pycache__/*.py*
+%{python3_sitelib}/argcomplete/py.typed
+%{python3_sitelib}/argcomplete/scripts/*.py*
+%{python3_sitelib}/argcomplete/scripts/__pycache__/*.py*
+
+%changelog
+* Mon May 19 2025 Devrim Gunduz <devrim@gunduz.org> - 3.6.2-1PGDG
+- Inıtial packaging for the PostgreSQL RPM repository to support Barman
+  on RHEL 9 and RHEL 8. Modified Fedora rawhide spec file.