Skip to content

Commit 8bd0468

Browse files
committed
Improvements to packaging
1 parent 13e8d4b commit 8bd0468

File tree

1 file changed

+45
-26
lines changed

1 file changed

+45
-26
lines changed

python-sscg.spec

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
%endif
66
%endif
77

8-
Name: python-sscg
8+
%global srcname sscg
9+
10+
Name: python-%{srcname}
911
Version: 0.2
1012
Release: 1%{?dist}
1113
Summary: Self-signed certificate generator
1214

13-
License: PSF
14-
URL: https://github.com/sgallagher/sscg
15-
Source0: https://github.com/sgallagher/sscg/releases/download/sscg-%{version}/sscg-%{version}.tar.gz
15+
License: BSD
16+
URL: https://github.com/sgallagher/%{srcname}
17+
Source0: https://github.com/sgallagher/%{srcname}/releases/download/%{srcname}-%{version}/%{srcname}-%{version}.tar.gz
1618

1719
BuildArch: noarch
1820
Requires: pyOpenSSL
@@ -31,7 +33,7 @@ up a full PKI environment and without exposing the machine to a risk of
3133
false signatures from the service certificate.
3234

3335
%if 0%{?with_python3}
34-
%package -n python3-sscg
36+
%package -n python3-%{srcname}
3537
Summary: Self-signed certificate generator
3638
Requires: python3-pyOpenSSL
3739
Requires: python3-pyasn1
@@ -40,7 +42,7 @@ BuildRequires: python3-setuptools
4042
BuildRequires: python3-pyOpenSSL
4143
BuildRequires: python3-pyasn1
4244

43-
%description -n python3-sscg
45+
%description -n python3-%{srcname}
4446
A utility to aid in the creation of more secure "self-signed"
4547
certificates. The certificates created by this tool are generated in a
4648
way so as to create a CA certificate that can be safely imported into a
@@ -50,63 +52,80 @@ false signatures from the service certificate.
5052
%endif #0%{?with_python3}
5153

5254
%prep
53-
%setup -q -n sscg-%{version}
55+
%setup -qc -n %{srcname}-%{version}
56+
57+
mv %{srcname}-%{version} python2
58+
find python2 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
5459

5560
%if 0%{?with_python3}
56-
rm -rf %{py3dir}
57-
cp -a . %{py3dir}
61+
rm -rf python3
62+
cp -a python2 python3
63+
find python3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
5864
%endif #0%{?with_python3}
5965

6066
%build
61-
# Remove CFLAGS=... for noarch packages (unneeded)
62-
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
67+
# Ensure egg-info is regenerated
68+
rm -rf src/*.egg-info
69+
70+
pushd python2
71+
%{__python2} setup.py build
72+
popd
6373

6474
%if 0%{?with_python3}
65-
pushd %{py3dir}
66-
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
75+
pushd python3
76+
%{__python3} setup.py build
6777
popd
6878
%endif # with_python3
6979

7080
%install
7181
rm -rf $RPM_BUILD_ROOT
82+
83+
pushd python2
7284
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
73-
mv $RPM_BUILD_ROOT/%{_bindir}/sscg \
74-
$RPM_BUILD_ROOT/%{_bindir}/sscg-%{python2_version}
85+
mv $RPM_BUILD_ROOT/%{_bindir}/%{srcname} \
86+
$RPM_BUILD_ROOT/%{_bindir}/%{srcname}-%{python2_version}
87+
popd
7588

7689
%if 0%{?with_python3}
77-
pushd %{py3dir}
90+
pushd python3
7891
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
79-
mv $RPM_BUILD_ROOT/%{_bindir}/sscg \
80-
$RPM_BUILD_ROOT/%{_bindir}/sscg-%{python3_version}
92+
mv $RPM_BUILD_ROOT/%{_bindir}/%{srcname} \
93+
$RPM_BUILD_ROOT/%{_bindir}/%{srcname}-%{python3_version}
94+
popd
8195
%endif # with_python3
8296

8397
# On platforms where python3 is preferred, symlink that version
84-
# to /usr/bin/sscg
98+
# to /usr/bin/%{srcname}
8599
%if 0%{?use_python3}
86-
ln -s sscg-%{python3_version} $RPM_BUILD_ROOT/%{_bindir}/sscg
100+
ln -s %{srcname}-%{python3_version} $RPM_BUILD_ROOT/%{_bindir}/%{srcname}
87101
%else
88-
ln -s sscg-%{python2_version} $RPM_BUILD_ROOT/%{_bindir}/sscg
102+
ln -s %{srcname}-%{python2_version} $RPM_BUILD_ROOT/%{_bindir}/%{srcname}
89103
%endif #use_python3
90104

91105
%files
92106
%doc
93107
# For noarch packages: sitelib
94108
%{python2_sitelib}/*
95-
%{_bindir}/sscg-%{python2_version}
109+
%{_bindir}/%{srcname}-%{python2_version}
96110
%if !0%{?use_python3}
97-
%{_bindir}/sscg
111+
%{_bindir}/%{srcname}
98112
%endif
99113

100114
%if 0%{?with_python3}
101-
%files -n python3-sscg
115+
%files -n python3-%{srcname}
102116
%{python3_sitelib}/*
103-
%{_bindir}/sscg-%{python3_version}
117+
%{_bindir}/%{srcname}-%{python3_version}
104118
%if 0%{?use_python3}
105-
%{_bindir}/sscg
119+
%{_bindir}/%{srcname}
106120
%endif #use_python3
107121
%endif #with_python3
108122

109123
%changelog
124+
* Tue Mar 17 2015 Stephen Gallagher <[email protected]> 0.2-1
125+
- Add support for namedConstraints
126+
- Add support for subjectAltNames
127+
- Fix packaging issues from Fedora package review
128+
110129
* Mon Mar 16 2015 Stephen Gallagher <[email protected]> 0.1-2
111130
- Update BuildRequires
112131

0 commit comments

Comments
 (0)