Compare commits

...

No commits in common. "a8" and "a9" have entirely different histories.
a8 ... a9

5 changed files with 49 additions and 138 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/spacewalk-certs-tools-2.8.8.tar.gz
SOURCES/spacewalk-certs-tools-2.10.8.tar.gz

View File

@ -1 +1 @@
7c21053141f16a42c3a710d3027f713cb5743100 SOURCES/spacewalk-certs-tools-2.8.8.tar.gz
fa91ef3654106a751b8f103dcaef06179076e51a SOURCES/spacewalk-certs-tools-2.10.8.tar.gz

View File

@ -1,63 +0,0 @@
From 9eaa08a3a881a756357ae5777ea6f5d3d90c79a6 Mon Sep 17 00:00:00 2001
From: Michael Mraka <michael.mraka@redhat.com>
Date: Mon, 15 Jul 2019 13:46:01 +0200
Subject: [PATCH] 1728416 - python3 compatible file operations
---
spacewalk/certs-tools/client_config_update.py | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/spacewalk/certs-tools/client_config_update.py b/spacewalk/certs-tools/client_config_update.py
index 01eca6ba8b0..9bd6df9aa56 100755
--- a/spacewalk/certs-tools/client_config_update.py
+++ b/spacewalk/certs-tools/client_config_update.py
@@ -65,6 +65,13 @@
import os
import sys
import tempfile
+try:
+ from rhn.i18n import bstr, sstr
+except ImportError:
+ def sstr(s):
+ return s
+ def bstr(s):
+ return s
DEFAULT_CLIENT_CONFIG_OVERRIDES = 'client-config-overrides.txt'
@@ -110,7 +117,7 @@ def readConfigFile(configFile):
d = {}
for line in fin.readlines():
- kv = _parseConfigLine(line)
+ kv = _parseConfigLine(sstr(line))
if kv:
d[kv[0]] = kv[1]
return d
@@ -131,21 +138,21 @@ def mapNewSettings(configFile, dnew):
# write to temp file
for line in fin.readlines():
- kv = _parseConfigLine(line)
+ kv = _parseConfigLine(sstr(line))
if not kv:
# not a setting, write the unaltered line
- fo.write(line)
+ fo.write(bstr(line))
else:
# it's a setting, populate from the dictionary
if kv[0] in dnew:
if dnew[kv[0]] != kv[1]:
- fo.write('%s=%s\n' % (kv[0], dnew[kv[0]]))
+ fo.write(bstr('%s=%s\n' % (kv[0], dnew[kv[0]])))
changedYN = 1
else:
- fo.write(line)
+ fo.write(bstr(line))
# it's a setting but not being mapped
else:
- fo.write(line)
+ fo.write(bstr(line))
fin.close()
if changedYN:

View File

@ -1,31 +0,0 @@
From f8d386fbd42339912284bd9ef4d6be2e065958b9 Mon Sep 17 00:00:00 2001
From: Michael Mraka <michael.mraka@redhat.com>
Date: Fri, 20 Sep 2019 15:07:59 +0200
Subject: [PATCH] sys.stderr.write() expects string not bytes
fixing
Traceback (most recent call last):
File "/usr/bin/rhn-ssl-tool", line 50, in <module>
sys.exit(mod.main() or 0)
File "/usr/lib/python3.7/site-packages/certs/rhn_ssl_tool.py", line 1298, in main
writeError(e)
File "/usr/lib/python3.7/site-packages/certs/rhn_ssl_tool.py", line 1275, in writeError
sys.stderr.write(bstr('\nERROR: %s\n' % e))
TypeError: write() argument must be str, not bytes
---
spacewalk/certs-tools/rhn_ssl_tool.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spacewalk/certs-tools/rhn_ssl_tool.py b/spacewalk/certs-tools/rhn_ssl_tool.py
index 7d28b24063b..ae761576c5f 100755
--- a/spacewalk/certs-tools/rhn_ssl_tool.py
+++ b/spacewalk/certs-tools/rhn_ssl_tool.py
@@ -1272,7 +1272,7 @@ def main():
"""
def writeError(e):
- sys.stderr.write(bstr('\nERROR: %s\n' % e))
+ sys.stderr.write('\nERROR: %s\n' % e)
ret = 0
try:

View File

@ -5,47 +5,33 @@
%endif
%global rhnroot %{_datadir}/rhn
%if 0%{?fedora} || 0%{?rhel} >= 8
%if 0%{?fedora} || 0%{?rhel} > 8
%global build_py3 1
%global default_py3 1
%endif
%if ( 0%{?fedora} && 0%{?fedora} < 28 ) || ( 0%{?rhel} && 0%{?rhel} < 8 )
%global build_py2 1
%endif
%define pythonX %{?default_py3: python3}%{!?default_py3: python2}
%define __python %{?default_py3: /usr/lib/python3}%{!?default_py3: /usr/lib/python2}
%{!?python2_sitelib: %global python2_sitelib %python_sitelib}
%{!?python2_version: %global python2_version %python_version}
Name: spacewalk-certs-tools
Summary: Spacewalk SSL Key/Cert Tool
License: GPLv2
Version: 2.8.8
Release: 1.1%{?dist}
Version: 2.10.8
Release: 1.0.1%{?dist}
URL: https://github.com/spacewalkproject/spacewalk
Source0: https://github.com/spacewalkproject/spacewalk/archive/%{name}-%{version}.tar.gz
# Upstream patches
Patch0: 9eaa08a3a881a756357ae5777ea6f5d3d90c79a6.patch
Patch1: f8d386fbd42339912284bd9ef4d6be2e065958b9.patch
BuildArch: noarch
Requires: %{pythonX}-%{name} = %{version}-%{release}
Requires: openssl rpm-build
Requires: tar
Requires: /usr/bin/sudo
BuildRequires: docbook-utils
%if 0%{?build_py3}
BuildRequires: python3-devel
Requires: python3-rhn-client-tools
Requires: python3-rhn-setup
%else
BuildRequires: python-devel
Requires: python2-rhn-client-tools
Requires: python2-rhn-setup
%endif
Obsoletes: rhns-certs < 5.3.0
Obsoletes: rhns-certs-tools < 5.3.0
# can not provides = %%{version} since some old packages expect > 3.6.0
# can not provides = %{version} since some old packages expect > 3.6.0
Provides: rhns-certs = 5.3.0
Provides: rhns-certs-tools = 5.3.0
@ -53,7 +39,7 @@ Provides: rhns-certs-tools = 5.3.0
This package contains tools to generate the SSL certificates required by
Spacewalk.
%if 0%{?build_py2}
%if 0%{?rhel} < 9
%package -n python2-%{name}
Summary: Spacewalk SSL Key/Cert Tool
Requires: %{name} = %{version}-%{release}
@ -62,6 +48,9 @@ Requires: spacewalk-backend-libs >= 0.8.28
%if 0%{?rhel} && 0%{?rhel} <= 5
Requires: python-hashlib
%endif
BuildRequires: python2-rpm-macros
BuildRequires: python2-devel
BuildRequires: python2
%description -n python2-%{name}
Python 2 specific files for %{name}.
@ -83,11 +72,8 @@ Python 3 specific files for %{name}.
%prep
%setup -q
%patch0 -p3
%patch1 -p3
%build
make -f Makefile.certs all
#nothing to do here
%if 0%{?suse_version}
# we need to rewrite etc/httpd/conf => etc/apache2
@ -99,14 +85,13 @@ sed -i 's|etc/httpd/conf|etc/apache2|g' ssl-howto.txt
%install
install -d -m 755 $RPM_BUILD_ROOT/%{rhnroot}/certs
%if 0%{?build_py2}
%if 0%{?rhel} < 9
make -f Makefile.certs install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
PYTHONPATH=%{python2_sitelib} PYTHONVERSION=%{python2_version} \
MANDIR=%{_mandir} PUB_BOOTSTRAP_DIR=%{pub_bootstrap_dir}
%endif
%if 0%{?build_py3}
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|' rhn-ssl-tool rhn-bootstrap client_config_update.py
sed -i 's|import urlparse|from urllib.parse import urlparse|' rhn_bootstrap.py
sed -i 's|#!/usr/bin/python2|#!/usr/bin/python3|' rhn-ssl-tool rhn-bootstrap client_config_update.py
make -f Makefile.certs install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
PYTHONPATH=%{python3_sitelib} PYTHONVERSION=%{python3_version} \
MANDIR=%{_mandir} PUB_BOOTSTRAP_DIR=%{pub_bootstrap_dir}
@ -116,13 +101,6 @@ make -f Makefile.certs install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
ln -s rhn-ssl-tool%{default_suffix} $RPM_BUILD_ROOT%{_bindir}/rhn-ssl-tool
ln -s rhn-bootstrap%{default_suffix} $RPM_BUILD_ROOT%{_bindir}/rhn-bootstrap
%if 0%{?suse_version}
%py_compile -O %{buildroot}/%{python_sitelib}
%if 0%{?build_py3}
%py3_compile -O %{buildroot}/%{python3_sitelib}
%endif
%endif
%clean
%files
@ -142,7 +120,7 @@ ln -s rhn-bootstrap%{default_suffix} $RPM_BUILD_ROOT%{_bindir}/rhn-bootstrap
%dir %{pub_bootstrap_dir}
%endif
%if 0%{?build_py2}
%if 0%{?rhel} < 9
%files -n python2-%{name}
%{python2_sitelib}/certs
%attr(755,root,root) %{_bindir}/rhn-ssl-tool-%{python2_version}
@ -157,10 +135,37 @@ ln -s rhn-bootstrap%{default_suffix} $RPM_BUILD_ROOT%{_bindir}/rhn-bootstrap
%endif
%changelog
* Tue Aug 20 2024 Andrew Lukoshko <alukoshko@almalinux.org> 2.8.8-1.1
- made python2 optional
- made python3 default for RHEL >= 8
- added upstream fixes
* Tue Mar 28 2022 David Sloboda <david.x.sloboda@oracle.com> 2.10.8-1.0.1
- Do not use python2 on OL > 8
* Wed Feb 26 2020 Michael Mraka <michael.mraka@redhat.com> 2.10.8-1
- updated copyright to 2020
* Fri Feb 07 2020 Michael Mraka <michael.mraka@redhat.com> 2.10.7-1
- hardcode __python value to overwrite error
* Fri Feb 07 2020 Michael Mraka <michael.mraka@redhat.com> 2.10.6-1
- use python2 build macros
* Fri Sep 20 2019 Michael Mraka <michael.mraka@redhat.com> 2.10.4-1
- sys.stderr.write() expects string not bytes
* Mon Jul 15 2019 Michael Mraka <michael.mraka@redhat.com> 2.10.3-1
- 1728416 - python3 compatible file operations
- 1728416 - check which python is available
* Thu Jun 27 2019 Michael Mraka <michael.mraka@redhat.com> 2.10.2-1
- fixed python macro usage
* Tue Mar 19 2019 Michael Mraka <michael.mraka@redhat.com> 2.10.1-1
- Fixed buildrequires for RHEL8
* Fri Nov 23 2018 Michael Mraka <michael.mraka@redhat.com> 2.9.2-1
- updated copyright years
* Tue Oct 02 2018 Michael Mraka <michael.mraka@redhat.com> 2.9.1-1
- use explicit version of python
- Bumping package versions for 2.9.
* Wed Mar 21 2018 Jiri Dostal <jdostal@redhat.com> 2.8.8-1
- Updating copyright years for 2018