Browse code

Merge branch 'master' of https://github.com/vmware/photon

archive authored on 2018/11/09 23:30:11
Showing 46 changed files
... ...
@@ -493,7 +493,7 @@ check-docker-service:
493 493
 	@docker ps >/dev/null 2>&1 || { echo "Docker service is not running. Aborting." >&2; exit 1; }
494 494
 
495 495
 check-docker-py:
496
-	@python3 -c "import docker; assert docker.__version__ == '$(PHOTON_DOCKER_PY_VER)'" >/dev/null 2>&1 || { echo "Error: Python3 package docker-py3 2.3.0 not installed.\nPlease use: pip3 install docker==2.3.0" >&2; exit 1; }
496
+	@python3 -c "import docker; assert docker.__version__ >= '$(PHOTON_DOCKER_PY_VER)'" >/dev/null 2>&1 || { echo "Error: Python3 package docker-py3 $(PHOTON_DOCKER_PY_VER) not installed.\nPlease use: pip3 install docker==$(PHOTON_DOCKER_PY_VER)" >&2; exit 1; }
497 497
 
498 498
 check-bison:
499 499
 	@command -v bison >/dev/null 2>&1 || { echo "Package bison not installed. Aborting." >&2; exit 1; }
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Apache Maven
2 2
 Name:		apache-maven
3 3
 Version:	3.5.4
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	Apache License 2.0
6 6
 URL:		http://maven.apache.org
7 7
 Group:		Applications/System
... ...
@@ -15,6 +15,7 @@ BuildRequires: apache-ant
15 15
 BuildRequires: wget >= 1.15
16 16
 Requires: openjre8
17 17
 Requires: /usr/bin/which
18
+%define ExtraBuildRequires apache-maven
18 19
 
19 20
 %define _prefix /var/opt/%{name}
20 21
 %define _bindir %{_prefix}/bin
... ...
@@ -76,6 +77,8 @@ done
76 76
 %exclude %{_libdir}/jansi-native
77 77
 
78 78
 %changelog
79
+*   Mon Oct 29 2018 Alexey Makhalov <amakhalov@vmware.com> 3.5.4-2
80
+-   Use ExtraBuildRequires
79 81
 *   Tue Sep 18 2018 Ankit Jain <ankitja@vmware.com> 3.5.4-1
80 82
 -   Updated apache-maven to version 3.5.4
81 83
 *   Fri Oct 13 2017 Alexey Makhalov <amakhalov@vmware.com> 3.5.0-5
... ...
@@ -103,18 +106,18 @@ done
103 103
 *   Fri May 20 2016 Divya Thaluru <dthaluru@vmware.com> 3.3.9-3
104 104
 -   Updated JAVA_HOME path to point to latest JDK.
105 105
 *   Tue Mar 01 2016 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 3.3.9-2
106
--   Updated the apache-ant version to 1.9.6 
106
+-   Updated the apache-ant version to 1.9.6
107 107
 *   Fri Feb 26 2016 Kumar Kaushik <kaushikk@vmware.com> 3.3.9-2
108 108
 -   Updated JAVA_HOME path to point to latest JDK.
109 109
 *   Thu Jan 21 2016 Xiaolin Li <xiaolinl@vmware.com> 3.3.9-1
110 110
 -   Updated to version 3.3.9
111 111
 *   Tue Jan 5 2016 Xiaolin Li <xiaolinl@vmware.com> 3.3.3-4
112
--   Increase build timeout from 600000 to 1200000 
112
+-   Increase build timeout from 600000 to 1200000
113 113
 *   Mon Nov 16 2015 Sharath George <sharathg@vmware.com> 3.3.3-3
114 114
 -   Change path to /var/opt.
115 115
 *   Wed Sep 16 2015 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 3.3.3-2
116 116
 -   Updated dependencies after repackaging openjdk.
117 117
 *   Thu Jul 9 2015 	Sarah Choi<sarahc@vmware.com> 3.3.3-1
118
--   Add a script to set environment variables for MAVEN 
118
+-   Add a script to set environment variables for MAVEN
119 119
 *   Fri May 22 2015 Sriram Nambakam <snambakam@vmware.com> 1.9.4
120 120
 -   Initial build.	First version
... ...
@@ -1,29 +1,16 @@
1 1
 Summary:        Bourne-Again SHell
2 2
 Name:           bash
3
-Version:        4.4.12
4
-Release:        3%{?dist}
3
+Version:        4.4.18
4
+Release:        1%{?dist}
5 5
 License:        GPLv3
6 6
 URL:            http://www.gnu.org/software/bash/
7 7
 Group:          System Environment/Base
8 8
 Vendor:         VMware, Inc.
9 9
 Distribution:   Photon
10
-Source0:        http://ftp.gnu.org/gnu/bash/%{name}-4.4.tar.gz
11
-%define sha1    bash=8de012df1e4f3e91f571c3eb8ec45b43d7c747eb
10
+Source0:        http://ftp.gnu.org/gnu/bash/%{name}-%{version}.tar.gz
11
+%define sha1    bash=6cf9b3c23930ba8a721fee177d1558e5b7cb6104
12 12
 Source1:        bash_completion
13 13
 Patch0:         bash-4.4.patch
14
-#Upstream patches
15
-Patch001:       bash44-001
16
-Patch002:       bash44-002
17
-Patch003:       bash44-003
18
-Patch004:       bash44-004
19
-Patch005:       bash44-005
20
-Patch006:       bash44-006
21
-Patch007:       bash44-007
22
-Patch008:       bash44-008
23
-Patch009:       bash44-009
24
-Patch010:       bash44-010
25
-Patch011:       bash44-011
26
-Patch012:       bash44-012
27 14
 Provides:       /bin/sh
28 15
 Provides:       /bin/bash
29 16
 BuildRequires:  readline
... ...
@@ -49,28 +36,15 @@ Requires: bash >= 4.4
49 49
 These are the additional language files of bash.
50 50
 
51 51
 %prep
52
-%setup -q -n bash-4.4
52
+%setup -q -n bash-4.4.18
53 53
 %patch0 -p1
54
-%patch001 -p0
55
-%patch002 -p0
56
-%patch003 -p0
57
-%patch004 -p0
58
-%patch005 -p0
59
-%patch006 -p0
60
-%patch007 -p0
61
-%patch008 -p0
62
-%patch009 -p0
63
-%patch010 -p0
64
-%patch011 -p0
65
-%patch012 -p0
66 54
 %build
67
-./configure \
55
+%configure \
68 56
     "CFLAGS=-fPIC" \
69
-    --prefix=%{_prefix} \
70 57
     --bindir=/bin \
71 58
     --htmldir=%{_defaultdocdir}/%{name}-%{version} \
72 59
     --without-bash-malloc \
73
-    --with-installed-readline 
60
+    --with-installed-readline
74 61
 make %{?_smp_mflags}
75 62
 %install
76 63
 make DESTDIR=%{buildroot} install
... ...
@@ -348,6 +322,8 @@ fi
348 348
 %defattr(-,root,root)
349 349
 
350 350
 %changelog
351
+*   Mon Sep 24 2018 Sujay G <gsujay@vmware.com> 4.4.18-1
352
+-   Bump bash version to 4.4.18
351 353
 *   Fri Jan 26 2018 Alexey Makhalov <amakhalov@vmware.com> 4.4.12-3
352 354
 -   Run bash_completion only for bash interactive shell
353 355
 *   Mon Dec 11 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 4.4.12-2
... ...
@@ -1,15 +1,25 @@
1 1
 Summary:        Microsoft .NET Core Runtime
2 2
 Name:           dotnet-runtime
3
-Version:        2.0.5
3
+Version:        2.1.4
4 4
 Release:        1%{?dist}
5 5
 Vendor:         VMware, Inc.
6 6
 Distribution:   Photon
7 7
 License:        MIT
8 8
 Url:            https://github.com/dotnet/core
9 9
 Group:          Development/Tools
10
-Source0:        https://download.microsoft.com/download/1/1/0/11046135-4207-40D3-A795-13ECEA741B32/dotnet-runtime-2.0.5-linux-x64.tar.gz
11
-%define sha1    dotnet-runtime=631b1f4a4c07a4488e846fc2142ce74c1b8b84a8
10
+
11
+%ifarch x86_64
12
+Source0:        https://download.microsoft.com/download/A/7/8/A78F1D25-8D5C-4411-B544-C7D527296D5E/dotnet-runtime-2.1.4-linux-x64.tar.gz
13
+%define sha1    dotnet-runtime=f92a51b5e15e0d9f48bde76519de911bd86880a0
12 14
 BuildArch:      x86_64
15
+%endif
16
+
17
+%ifarch aarch64
18
+Source0:        https://download.microsoft.com/download/A/7/8/A78F1D25-8D5C-4411-B544-C7D527296D5E/dotnet-runtime-2.1.4-linux-arm64.tar.gz
19
+%define sha1    dotnet-runtime=0470e1ed3ab4cb3e3321f6dd11f9dc7abac171d6
20
+BuildArch:      aarch64
21
+%endif
22
+
13 23
 Requires:       curl libunwind krb5 lttng-ust
14 24
 
15 25
 %description
... ...
@@ -66,5 +76,8 @@ ln -sf %{_libdir}/dotnet/dotnet %{buildroot}%{_bindir}/dotnet
66 66
     %{_libdir}/*
67 67
 
68 68
 %changelog
69
+*   Thu Sep 27 2018 Ajay Kaher <akaher@vmware.com> 2.1.4-1
70
+-   upgraded to version 2.1.4
71
+-   add aarch64 support
69 72
 *   Wed Jan 31 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.0.5-1
70 73
 -   Initial build for photon
... ...
@@ -1,22 +1,20 @@
1 1
 Summary:	OpenPGP standard implementation used for encrypted communication and data storage.
2 2
 Name:		gnupg
3
-Version:	2.1.20
4
-Release:	3%{?dist}
3
+Version:	2.2.10
4
+Release:	1%{?dist}
5 5
 License:	GPLv3+
6 6
 URL:		https://gnupg.org/index.html
7 7
 Group:		Applications/Cryptography.
8 8
 Source0:        https://gnupg.org/ftp/gcrypt/gnupg/%{name}-%{version}.tar.bz2
9
-%define sha1 gnupg=500ddae8e4225ae2e300934090f9b9a427b8def1
9
+%define sha1 gnupg=3e87504e2ca317718aa9b6299947ebf7e906b54e
10 10
 Vendor:		VMware, Inc.
11 11
 Distribution:	Photon
12 12
 BuildRequires:	zlib-devel
13 13
 BuildRequires:  bzip2-devel
14 14
 BuildRequires:  readline-devel
15
-BuildRequires:  npth
16 15
 BuildRequires:  npth-devel
17 16
 BuildRequires:  libassuan
18 17
 BuildRequires:  libksba >= 1.0.7
19
-BuildRequires:  libgcrypt >= 1.7.0
20 18
 BuildRequires:  libgcrypt-devel
21 19
 BuildRequires:  libgpg-error >= 1.24
22 20
 Requires:       libksba
... ...
@@ -30,22 +28,23 @@ Provides:       gpg
30 30
 %description
31 31
 GnuPG is a complete and free implementation of the OpenPGP standard as defined
32 32
 by RFC4880 (also known as PGP). GnuPG allows to encrypt and sign your data and
33
-communication, features a versatile key management system as well as access 
34
-modules for all kinds of public key directories. GnuPG, also known as GPG, is 
33
+communication, features a versatile key management system as well as access
34
+modules for all kinds of public key directories. GnuPG, also known as GPG, is
35 35
 a command line tool with features for easy integration with other applications.
36 36
 
37 37
 %prep
38 38
 %setup -q -n %{name}-%{version}
39 39
 
40 40
 %build
41
-./configure --prefix=%{_prefix}      \
42
-            --sysconfdir=%{_sysconfdir} \
43
-            --with-libusb=no
41
+%configure
42
+make %{?_smp_mflags}
44 43
 
45
-make
46 44
 %install
47 45
 make DESTDIR=%{buildroot} install
48 46
 
47
+%check
48
+make %{?_smp_mflags} check
49
+
49 50
 %files
50 51
 %defattr(-,root,root)
51 52
 %{_bindir}/*
... ...
@@ -59,6 +58,8 @@ make DESTDIR=%{buildroot} install
59 59
 %exclude /usr/share/doc/*
60 60
 
61 61
 %changelog
62
+*   Sat Oct 20 2018 Ankit Jain <ankitja@vmware.com> 2.2.10-1
63
+-   Update to 2.2.10
62 64
 *   Wed Aug 30 2017 Alexey Makhalov <amakhalov@vmware.com> 2.1.20-3
63 65
 -   Add requires libgcrypt
64 66
 *   Wed Jun 07 2017 Danut Moraru <dmoraru@vmware.com> 2.1.20-2
... ...
@@ -13,7 +13,7 @@
13 13
 Summary:        Go
14 14
 Name:           go
15 15
 Version:        1.10.4
16
-Release:        1%{?dist}
16
+Release:        2%{?dist}
17 17
 License:        BSD
18 18
 URL:            https://golang.org
19 19
 Group:          System Environment/Security
... ...
@@ -22,6 +22,7 @@ Distribution:   Photon
22 22
 Source0:        https://dl.google.com/go/%{name}%{version}.src.tar.gz
23 23
 %define sha1    go=adcd9d0bbbc764fa4ff20c08eb4a5a527fa95d96
24 24
 Requires:       glibc
25
+%define ExtraBuildRequires go
25 26
 
26 27
 %description
27 28
 Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
... ...
@@ -109,5 +110,7 @@ rm -rf %{buildroot}/*
109 109
 %{_bindir}/*
110 110
 
111 111
 %changelog
112
+*   Mon Oct 29 2018 Alexey Makhalov <amakhalov@vmware.com> 1.10.4-2
113
+-   Use ExtraBuildRequires
112 114
 *   Mon Sep 24 2018 Tapas Kundu <tkundu@vmware.com> 1.10.4-1
113 115
 -   Initial build for 1.10.4
... ...
@@ -14,7 +14,7 @@
14 14
 Summary:        Go
15 15
 Name:           go
16 16
 Version:        1.9.4
17
-Release:        2%{?dist}
17
+Release:        3%{?dist}
18 18
 License:        BSD
19 19
 URL:            https://golang.org
20 20
 Group:          System Environment/Security
... ...
@@ -25,6 +25,8 @@ Source0:        https://dl.google.com/go/%{name}%{version}.src.tar.gz
25 25
 Patch0:         go_imports_fix.patch
26 26
 Patch1:         CVE-2018-7187.patch
27 27
 Requires:       glibc
28
+# to avoid cyclic dependency use prebuilt publish go rpm
29
+%define ExtraBuildRequires go
28 30
 
29 31
 %description
30 32
 Go is an open source programming language that makes it easy to build simple, reliable, and efficient software
... ...
@@ -114,6 +116,8 @@ rm -rf %{buildroot}/*
114 114
 %{_bindir}/*
115 115
 
116 116
 %changelog
117
+*   Wed Oct 24 2018 Alexey Makhalov <amakhalov@vmware.com> 1.9.4-3
118
+-   Use extra build requires
117 119
 *   Mon Apr 02 2018 Dheeraj Shetty <dheerajs@vmware.com> 1.9.4-2
118 120
 -   Fix for CVE-2018-7187
119 121
 *   Thu Mar 15 2018 Xiaolin Li <xiaolinl@vmware.com> 1.9.4-1
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	High-Level Crypto API
2 2
 Name:		gpgme
3 3
 Version:	1.11.1
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	GPLv2+
6 6
 URL:		https://www.gnupg.org/(it)/related_software/gpgme/index.html
7 7
 Group:		System Environment/Security
... ...
@@ -18,7 +18,7 @@ BuildRequires:	libgpg-error-devel >= 1.32
18 18
 BuildRequires:	libassuan >= 2.2.0
19 19
 
20 20
 %description
21
-The GPGME package is a C language library that allows to add support for cryptography to a program. It is designed to make access to public key crypto engines like GnuPG or GpgSM easier for applications. GPGME provides a high-level crypto API for encryption, decryption, signing, signature verification and key management.  
21
+The GPGME package is a C language library that allows to add support for cryptography to a program. It is designed to make access to public key crypto engines like GnuPG or GpgSM easier for applications. GPGME provides a high-level crypto API for encryption, decryption, signing, signature verification and key management.
22 22
 
23 23
 %package 	devel
24 24
 Group:          Development/Libraries
... ...
@@ -33,10 +33,8 @@ Static libraries and header files from GPGME, GnuPG Made Easy.
33 33
 %setup -q
34 34
 
35 35
 %build
36
-sed -i 's/GPG = gpg/GPG = gpg2/g' tests/gpg/Makefile.am
37 36
 ./autogen.sh
38
-./configure \
39
-	--prefix=%{_prefix} \
37
+%configure \
40 38
  	--disable-fd-passing \
41 39
 	--disable-static \
42 40
 	--enable-languages=cl \
... ...
@@ -55,7 +53,7 @@ cd tests && make check-TESTS
55 55
 
56 56
 %postun	-p /sbin/ldconfig
57 57
 
58
-%files 
58
+%files
59 59
 %defattr(-,root,root)
60 60
 %{_libdir}/*.so.*
61 61
 
... ...
@@ -68,6 +66,8 @@ cd tests && make check-TESTS
68 68
 %{_datadir}/common-lisp/source/gpgme/*
69 69
 
70 70
 %changelog
71
+*   Sat Oct 20 2018 Ankit Jain <ankitja@vmware.com> 1.11.1-2
72
+-   Removed gpg2, gnupg-2.2.10 doesn't provide gpg2
71 73
 *   Tue Sep 11 2018 Anish Swaminathan <anishs@vmware.com> 1.11.1-1
72 74
 -   Update version to 1.11.1
73 75
 *   Wed Aug 30 2017 Alexey Makhalov <amakhalov@vmware.com> 1.9.0-3
74 76
deleted file mode 100644
... ...
@@ -1,49 +0,0 @@
1
-Summary:        This library exports a gssapi interface
2
-Name:           libgssglue
3
-Version:        0.4
4
-Release:        2%{?dist}
5
-License:        BSD
6
-URL:            http://www.citi.umich.edu/projects/nfsv4/linux/
7
-Group:          System Environment/Libraries
8
-Vendor:         VMware, Inc.
9
-Distribution:   Photon
10
-Source0:        http://www.citi.umich.edu/projects/nfsv4/linux/libgssglue/%{name}-%{version}.tar.gz
11
-%define sha1    libgssglue=a8edc4f6a1d4dcd80ad52d18226fc65fa8850af1
12
-
13
-%description
14
-This library exports a gssapi interface, but doesn't implement any gssapi mechanisms itself; instead it calls gssapi routines in other libraries, depending on the mechanism.
15
-
16
-%package        devel
17
-Summary:        Header and development files
18
-Requires:       %{name} = %{version}
19
-%description    devel
20
-It contains the libraries and header files to create applications 
21
-
22
-%prep
23
-%setup -q
24
-%build
25
-%configure --prefix=/usr --disable-static
26
-
27
-make %{?_smp_mflags}
28
-
29
-%install
30
-make DESTDIR=%{buildroot} install
31
-find %{buildroot}/%{_libdir} -name '*.la' -delete
32
-
33
-%post
34
-
35
-%files
36
-%defattr(-,root,root)
37
-%{_libdir}/libgssglue.so.*
38
-
39
-%files  devel
40
-%defattr(-,root,root)
41
-%{_includedir}/*
42
-%{_libdir}/libgssglue.so
43
-%{_libdir}/pkgconfig/*.pc
44
-
45
-%changelog
46
-*   Thu Jul 26 2018 Ajay Kaher <akaher@vmware.com> 0.4-2
47
--   Resolved compilation error for aarch64
48
-*   Mon Jan 22 2018 Xiaolin Li <xiaolinl@vmware.com> 0.4-1
49
--   Initial build. First version
50 1
new file mode 100644
... ...
@@ -0,0 +1,51 @@
0
+Summary:        This library exports a gssapi interface
1
+Name:           libgssglue
2
+Version:        0.4
3
+Release:        3%{?dist}
4
+License:        BSD
5
+URL:            http://www.citi.umich.edu/projects/nfsv4/linux/
6
+Group:          System Environment/Libraries
7
+Vendor:         VMware, Inc.
8
+Distribution:   Photon
9
+Source0:        http://www.citi.umich.edu/projects/nfsv4/linux/libgssglue/%{name}-%{version}.tar.gz
10
+%define sha1    libgssglue=a8edc4f6a1d4dcd80ad52d18226fc65fa8850af1
11
+
12
+%description
13
+This library exports a gssapi interface, but doesn't implement any gssapi mechanisms itself; instead it calls gssapi routines in other libraries, depending on the mechanism.
14
+
15
+%package        devel
16
+Summary:        Header and development files
17
+Requires:       %{name} = %{version}
18
+%description    devel
19
+It contains the libraries and header files to create applications
20
+
21
+%prep
22
+%setup -q
23
+%build
24
+%configure --prefix=/usr --disable-static
25
+
26
+make %{?_smp_mflags}
27
+
28
+%install
29
+make DESTDIR=%{buildroot} install
30
+find %{buildroot}/%{_libdir} -name '*.la' -delete
31
+
32
+%post
33
+
34
+%files
35
+%defattr(-,root,root)
36
+%{_libdir}/libgssglue.so.*
37
+
38
+%files  devel
39
+%defattr(-,root,root)
40
+%{_includedir}/*
41
+%{_libdir}/libgssglue.so
42
+%{_libdir}/pkgconfig/*.pc
43
+
44
+%changelog
45
+*   Thu Oct 25 2018 Ajay Kaher <akaher@vmware.com> 0.4-3
46
+-   Corrected spec file name
47
+*   Thu Jul 26 2018 Ajay Kaher <akaher@vmware.com> 0.4-2
48
+-   Resolved compilation error for aarch64
49
+*   Mon Jan 22 2018 Xiaolin Li <xiaolinl@vmware.com> 0.4-1
50
+-   Initial build. First version
... ...
@@ -1,14 +1,14 @@
1 1
 Summary:        Programs for finding and viewing man pages
2 2
 Name:           man-db
3
-Version:        2.7.6
4
-Release:        4%{?dist}
3
+Version:        2.8.4
4
+Release:        1%{?dist}
5 5
 License:        GPLv2+
6 6
 URL:            http://www.nongnu.org/man-db
7 7
 Group:          Applications/System
8 8
 Vendor:         VMware, Inc.
9 9
 Distribution:   Photon
10 10
 Source0:        %{name}-%{version}.tar.xz
11
-%define sha1    man-db=919dcb34d604faac9b18a38ead07f457d0dab501
11
+%define sha1    man-db=729096a35fec13df8b7b350fdc1b323f990b6144
12 12
 Requires:       libpipeline
13 13
 Requires:       gdbm
14 14
 Requires:       xz
... ...
@@ -27,12 +27,10 @@ BuildRequires:  groff
27 27
 The Man-DB package contains programs for finding and viewing man pages.
28 28
 
29 29
 %prep
30
-%setup -qn %{name}-%{version}.1
30
+%setup -qn %{name}-%{version}
31 31
 %build
32
-./configure \
33
-    --prefix=%{_prefix} \
32
+%configure \
34 33
     --docdir=%{_defaultdocdir}/%{name}-%{version} \
35
-    --sysconfdir=%{_sysconfdir} \
36 34
     --disable-setuid \
37 35
     --with-browser=%{_bindir}/lynx \
38 36
     --with-vgrind=%{_bindir}/vgrind \
... ...
@@ -78,6 +76,8 @@ fi
78 78
 %{_libdir}/tmpfiles.d/man-db.conf
79 79
 
80 80
 %changelog
81
+*   Mon Oct 22 2018 Sujay G <gsujay@vmware.com> 2.8.4-1
82
+-   Bump man-db version to 2.8.4
81 83
 *   Mon Sep 18 2017 Alexey Makhalov <amakhalov@vmware.com> 2.7.6-4
82 84
 -   Remove shadow from requires and use explicit tools for post actions
83 85
 *   Fri Aug 04 2017 Chang Lee <changlee@vmware.com> 2.7.6-3
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        High-performance HTTP server and reverse proxy
2 2
 Name:           nginx
3 3
 Version:        1.15.3
4
-Release:        2%{?dist}
4
+Release:        3%{?dist}
5 5
 License:        BSD-2-Clause
6 6
 URL:            http://nginx.org/download/nginx-%{version}.tar.gz
7 7
 Group:          Applications/System
... ...
@@ -53,13 +53,30 @@ install -p -m 0644 %{SOURCE1} %{buildroot}/usr/lib/systemd/system/nginx.service
53 53
 
54 54
 %files
55 55
 %defattr(-,root,root)
56
-%{_sysconfdir}/*
56
+%config(noreplace) %{_sysconfdir}/%{name}/fastcgi.conf
57
+%config(noreplace) %{_sysconfdir}/%{name}/fastcgi.conf.default
58
+%config(noreplace) %{_sysconfdir}/%{name}/fastcgi_params
59
+%config(noreplace) %{_sysconfdir}/%{name}/fastcgi_params.default
60
+%config(noreplace) %{_sysconfdir}/%{name}/koi-utf
61
+%config(noreplace) %{_sysconfdir}/%{name}/koi-win
62
+%config(noreplace) %{_sysconfdir}/%{name}/mime.types
63
+%config(noreplace) %{_sysconfdir}/%{name}/mime.types.default
64
+%config(noreplace) %{_sysconfdir}/%{name}/nginx.conf
65
+%config(noreplace) %{_sysconfdir}/%{name}/nginx.conf.default
66
+%config(noreplace) %{_sysconfdir}/%{name}/scgi_params
67
+%config(noreplace) %{_sysconfdir}/%{name}/scgi_params.default
68
+%config(noreplace) %{_sysconfdir}/%{name}/uwsgi_params
69
+%config(noreplace) %{_sysconfdir}/%{name}/uwsgi_params.default
70
+%{_sysconfdir}/%{name}/win-utf
71
+%{_sysconfdir}/%{name}/html/*
57 72
 %{_sbindir}/*
58 73
 %{_libdir}/systemd/system/nginx.service
59 74
 %dir %{_var}/opt/nginx/log
60 75
 %{_var}/log/nginx
61 76
 
62 77
 %changelog
78
+*   Wed Nov 07 2018 Ajay Kaher <akaher@vmware.com> 1.15.3-3
79
+-   mark config files as non replaceable on upgrade.
63 80
 *   Mon Sep 17 2018 Keerthana K <keerthanak@vmware.com> 1.15.3-2
64 81
 -   Adding http_auth_request_module and http_sub_module.
65 82
 *   Fri Sep 7 2018 Him Kalyan Bordoloi <bordoloih@vmware.com> 1.15.3-1
... ...
@@ -3,7 +3,7 @@
3 3
 Summary:	OpenJDK
4 4
 Name:		openjdk10
5 5
 Version:	1.10.0.23
6
-Release:	1%{?dist}
6
+Release:	2%{?dist}
7 7
 License:	GNU GPL
8 8
 URL:		https://openjdk.java.net
9 9
 Group:		Development/Tools
... ...
@@ -23,8 +23,10 @@ Requires:       openjre10 = %{version}-%{release}
23 23
 Requires:       chkconfig
24 24
 Obsoletes:      openjdk <= %{version}
25 25
 AutoReqProv: 	no
26
+%define ExtraBuildRequires icu-devel, cups, cups-devel, xorg-proto-devel, libXtst, libXtst-devel, libXfixes, libXfixes-devel, libXi, libXi-devel, openjdk, openjre, icu, alsa-lib, alsa-lib-devel, xcb-proto, libXdmcp-devel, libXau-devel, util-macros, xtrans, libxcb-devel, proto, libXdmcp, libxcb, libXau, xtrans-devel, libX11, libX11-devel, libXext, libXext-devel, libICE-devel, libSM, libICE, libSM-devel, libXt, libXmu, libXt-devel, libXmu-devel, libXrender, libXrender-devel
26 27
 %define bootstrapjdkversion 1.8.0.112
27 28
 %define jdk_major_version 1.10.0
29
+
28 30
 %description
29 31
 The OpenJDK package installs java class library and javac java compiler.
30 32
 
... ...
@@ -57,10 +59,9 @@ This package provides the runtime library class sources.
57 57
 %setup -qn openjdk-%{version}
58 58
 
59 59
 %build
60
-chmod a+x ./configure
61 60
 unset JAVA_HOME &&
62 61
 ENABLE_HEADLESS_ONLY="true" &&
63
-./configure \
62
+sh configure \
64 63
 	--with-target-bits=64 \
65 64
 	--with-boot-jdk=/var/opt/OpenJDK-%bootstrapjdkversion-bin \
66 65
 	--enable-headless-only \
... ...
@@ -83,7 +84,7 @@ make \
83 83
 
84 84
 %install
85 85
 unset JAVA_HOME &&
86
-make install 
86
+make install
87 87
 
88 88
 install -vdm755 %{buildroot}%{_libdir}/jvm/OpenJDK-%{version}
89 89
 chown -R root:root %{buildroot}%{_libdir}/jvm/OpenJDK-%{version}
... ...
@@ -219,5 +220,7 @@ rm -rf %{buildroot}/*
219 219
 %{_libdir}/jvm/OpenJDK-%{version}/lib/src.zip
220 220
 
221 221
 %changelog
222
-*   Thu Apr 23 2018 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.10.0.23-1
222
+*   Mon Oct 29 2018 Alexey Makhalov <amakhalov@vmware.com> 1.10.0.23-2
223
+-   Use ExtraBuildRequires
224
+*   Mon Apr 23 2018 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.10.0.23-1
223 225
 -   Initial build. First version
... ...
@@ -2,15 +2,15 @@
2 2
 %global security_hardening none
3 3
 Summary:	OpenJDK
4 4
 Name:		openjdk8
5
-Version:	1.8.0.181
6
-Release:	1%{?dist}
5
+Version:	1.8.0.192
6
+Release:	2%{?dist}
7 7
 License:	GNU GPL
8 8
 URL:		https://openjdk.java.net
9 9
 Group:		Development/Tools
10 10
 Vendor:		VMware, Inc.
11 11
 Distribution:   Photon
12 12
 Source0:	http://www.java.net/download/openjdk/jdk8/promoted/b162/openjdk-%{version}.tar.gz
13
-%define sha1 openjdk=c4b9a0d9820f58cd8aa9acd191727eabea62faf6
13
+%define sha1 openjdk=e8df20e8bb8fad4ed08867cbc42202039b356b2d
14 14
 Patch0:		Awt_build_headless_only.patch
15 15
 Patch1:		check-system-ca-certs.patch
16 16
 BuildRequires:  pcre-devel
... ...
@@ -25,7 +25,9 @@ Requires:       openjre8 = %{version}-%{release}
25 25
 Requires:       chkconfig
26 26
 Obsoletes:      openjdk <= %{version}
27 27
 AutoReqProv: 	no
28
+%define ExtraBuildRequires icu-devel, cups, cups-devel, xorg-proto-devel, libXtst, libXtst-devel, libXfixes, libXfixes-devel, libXi, libXi-devel, openjdk, openjre, icu, alsa-lib, alsa-lib-devel, xcb-proto, libXdmcp-devel, libXau-devel, util-macros, xtrans, libxcb-devel, proto, libXdmcp, libxcb, libXau, xtrans-devel, libX11, libX11-devel, libXext, libXext-devel, libICE-devel, libSM, libICE, libSM-devel, libXt, libXmu, libXt-devel, libXmu-devel, libXrender, libXrender-devel
28 29
 %define bootstrapjdkversion 1.8.0.112
30
+
29 31
 %description
30 32
 The OpenJDK package installs java class library and javac java compiler.
31 33
 
... ...
@@ -84,7 +86,8 @@ unset JAVA_HOME &&
84 84
 	--with-extra-cflags="-std=gnu++98 -fno-delete-null-pointer-checks -Wno-error -fno-lifetime-dse" \
85 85
 	--with-freetype-include=/usr/include/freetype2 \
86 86
 	--with-freetype-lib=/usr/lib \
87
-	--with-stdc++lib=dynamic
87
+	--with-stdc++lib=dynamic \
88
+	--disable-zip-debug-info
88 89
 
89 90
 make \
90 91
     DEBUG_BINARIES=true \
... ...
@@ -238,6 +241,10 @@ rm -rf %{buildroot}/*
238 238
 %{_libdir}/jvm/OpenJDK-%{version}/src.zip
239 239
 
240 240
 %changelog
241
+*   Mon Oct 29 2018 Alexey Makhalov <amakhalov@vmware.com> 1.8.0.192-2
242
+-   Use ExtraBuildRequires
243
+*   Thu Oct 18 2018 Tapas Kundu <tkundu@vmware.com> 1.8.0.192-1
244
+-   Upgraded to version 1.8.0.192
241 245
 *   Fri Sep 21 2018 Srinidhi Rao <srinidhir@vmware.com> 1.8.0.181-1
242 246
 -   Upgraded to 1.8.0.181 version.
243 247
 *   Mon Apr 23 2018 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.8.0.172-1
... ...
@@ -8,7 +8,7 @@
8 8
 Summary:	OpenJDK
9 9
 Name:		openjdk8
10 10
 Version:	1.8.0.151
11
-Release:	1%{?dist}
11
+Release:	2%{?dist}
12 12
 License:	GNU GPL
13 13
 URL:		http://hg.openjdk.java.net/aarch64-port/jdk8u/
14 14
 Group:		Development/Tools
... ...
@@ -44,7 +44,9 @@ Requires:       openjre8 = %{version}-%{release}
44 44
 Requires:       chkconfig
45 45
 Obsoletes:      openjdk <= %{version}
46 46
 AutoReqProv: 	no
47
+%define ExtraBuildRequires icu-devel, openjdk8, openjre8, icu, alsa-lib, alsa-lib-devel, xcb-proto, libXdmcp-devel, libXau-devel, util-macros, xtrans, libxcb-devel, proto, libXdmcp, libxcb, libXau, xtrans-devel, libX11, libX11-devel, libXext, libXext-devel, libICE-devel, libSM, libICE, libSM-devel, libXt, libXmu, libXt-devel, libXmu-devel, libXrender, libXrender-devel
47 48
 %define bootstrapjdk /usr/lib/jvm/OpenJDK-1.8.0.151
49
+
48 50
 %description
49 51
 The OpenJDK package installs java class library and javac java compiler.
50 52
 
... ...
@@ -95,9 +97,8 @@ sed -i "s#\"ft2build.h\"#<ft2build.h>#g" jdk/src/share/native/sun/font/freetypeS
95 95
 sed -i '0,/BUILD_LIBMLIB_SRC/s/BUILD_LIBMLIB_SRC/BUILD_HEADLESS_ONLY := 1\nOPENJDK_TARGET_OS := linux\n&/' jdk/make/lib/Awt2dLibraries.gmk
96 96
 
97 97
 %build
98
-chmod a+x ./configure
99 98
 unset JAVA_HOME &&
100
-./configure \
99
+sh configure \
101 100
 	CUPS_NOT_NEEDED=yes \
102 101
 	--with-target-bits=64 \
103 102
 	--with-boot-jdk=%{bootstrapjdk} \
... ...
@@ -260,6 +261,8 @@ rm -rf %{buildroot}/*
260 260
 %{_libdir}/jvm/OpenJDK-%{version}/src.zip
261 261
 
262 262
 %changelog
263
+*   Mon Oct 29 2018 Alexey Makhalov <amakhalov@vmware.com> 1.8.0.151-2
264
+-   Use ExtraBuildRequires
263 265
 *   Thu Dec 21 2017 Alexey Makhalov <amakhalov@vmware.com> 1.8.0.151-1
264 266
 -   Initial version of OpenJDK for aarch64. SPEC file was forked from
265 267
     openjdk8-1.8.0.152-1 of x86_64
... ...
@@ -3,7 +3,7 @@
3 3
 Summary:	OpenJDK
4 4
 Name:		openjdk9
5 5
 Version:	1.9.0.181
6
-Release:	1%{?dist}
6
+Release:	2%{?dist}
7 7
 License:	GNU GPL
8 8
 URL:		https://openjdk.java.net
9 9
 Group:		Development/Tools
... ...
@@ -23,8 +23,10 @@ Requires:       openjre9 = %{version}-%{release}
23 23
 Requires:       chkconfig
24 24
 Obsoletes:      openjdk <= %{version}
25 25
 AutoReqProv: 	no
26
+%define ExtraBuildRequires icu-devel, cups, cups-devel, xorg-proto-devel, libXtst, libXtst-devel, libXfixes, libXfixes-devel, libXi, libXi-devel, openjdk, openjre, icu, alsa-lib, alsa-lib-devel, xcb-proto, libXdmcp-devel, libXau-devel, util-macros, xtrans, libxcb-devel, proto, libXdmcp, libxcb, libXau, xtrans-devel, libX11, libX11-devel, libXext, libXext-devel, libICE-devel, libSM, libICE, libSM-devel, libXt, libXmu, libXt-devel, libXmu-devel, libXrender, libXrender-devel
26 27
 %define bootstrapjdkversion 1.8.0.112
27 28
 %define jdk_major_version 1.9.0
29
+
28 30
 %description
29 31
 The OpenJDK package installs java class library and javac java compiler.
30 32
 
... ...
@@ -57,10 +59,9 @@ This package provides the runtime library class sources.
57 57
 %setup -qn openjdk-%{version}
58 58
 
59 59
 %build
60
-chmod a+x ./configure
61 60
 unset JAVA_HOME &&
62 61
 ENABLE_HEADLESS_ONLY="true" &&
63
-./configure \
62
+sh configure \
64 63
 	--with-target-bits=64 \
65 64
 	--with-boot-jdk=/var/opt/OpenJDK-%bootstrapjdkversion-bin \
66 65
 	--enable-headless-only \
... ...
@@ -223,5 +224,7 @@ rm -rf %{buildroot}/*
223 223
 %{_libdir}/jvm/OpenJDK-%{version}/lib/src.zip
224 224
 
225 225
 %changelog
226
+*   Mon Oct 29 2018 Alexey Makhalov <amakhalov@vmware.com> 1.9.0.181-2
227
+-   Use ExtraBuildRequires
226 228
 *   Thu Apr 19 2018 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.9.0.181-1
227 229
 -   Initial build. First version
... ...
@@ -2,7 +2,7 @@
2 2
 Summary:	OpenLdap-2.4.43
3 3
 Name:		openldap
4 4
 Version:	2.4.46
5
-Release:	1%{?dist}
5
+Release:	2%{?dist}
6 6
 License:	OpenLDAP
7 7
 URL:		http://cyrusimap.web.cmu.edu/
8 8
 Group:		System Environment/Security
... ...
@@ -37,7 +37,8 @@ autoconf
37 37
 
38 38
 sed -i '/6.0.20/ a\\t__db_version_compat' configure
39 39
 
40
-CPPFLAGS="-D_REENTRANT -DLDAP_CONNECTIONLESS -D_GNU_SOURCE -D_AVL_H" \
40
+export CPPFLAGS="-D_REENTRANT -DLDAP_CONNECTIONLESS -D_GNU_SOURCE -D_AVL_H"
41
+
41 42
 %configure \
42 43
         --disable-static    \
43 44
         --disable-debug     \
... ...
@@ -74,6 +75,8 @@ rm -rf %{buildroot}/*
74 74
 /etc/openldap/*
75 75
 
76 76
 %changelog
77
+*   Mon Nov 5 2018 Sriram Nambakam <snambakam@vmware.com> 2.4.46-2
78
+-   export CPPFLAGS before invoking configure
77 79
 *   Mon Sep 10 2018 Him Kalyan Bordoloi <bordoloih@vmware.com> 2.4.46-1
78 80
 -   Upgrade to 2.4.46
79 81
 *   Fri Oct 13 2017 Alexey Makhalov <amakhalov@vmware.com> 2.4.44-3
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        PowerShell is an automation and configuration management platform.
2 2
 Name:           powershell
3 3
 Version:        6.0.1
4
-Release:        1%{?dist}
4
+Release:        2%{?dist}
5 5
 Vendor:         VMware, Inc.
6 6
 Distribution:   Photon
7 7
 License:        MIT
... ...
@@ -12,7 +12,7 @@ Source0:        %{name}-%{version}.tar.gz
12 12
 Source1:        build.sh
13 13
 BuildArch:      x86_64
14 14
 BuildRequires:  dotnet-sdk = 2.1.4
15
-BuildRequires:  dotnet-runtime = 2.0.5
15
+BuildRequires:  dotnet-runtime = 2.1.4
16 16
 BuildRequires:  cmake
17 17
 BuildRequires:  clang
18 18
 BuildRequires:  git
... ...
@@ -50,5 +50,7 @@ ln -sf %{_libdir}/powershell/pwsh %{buildroot}%{_bindir}/pwsh
50 50
     %{_docdir}/*
51 51
 
52 52
 %changelog
53
+*   Thu Sep 27 2018 Ajay Kaher <akaher@vmware.com> 6.0.1-2
54
+-   upgrade version of dotnet-runtime
53 55
 *   Wed Jan 31 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 6.0.1-1
54 56
 -   Initial build for photon
... ...
@@ -1,11 +1,11 @@
1 1
 Summary:	Very fast, header only, C++ logging library.
2 2
 Name:		spdlog
3
-Version:	0.13.0
3
+Version:	1.1.0
4 4
 Release:	1%{?dist}
5 5
 License:	MIT
6 6
 URL:		https://github.com/gabime/spdlog
7
-Source0:	%{name}-v%{version}.tar.gz
8
-%define sha1    spdlog=e9968ab555f9f7bb86d6257e98d7a92313a91297
7
+Source0:	%{name}-%{version}.tar.gz
8
+%define sha1    spdlog=9b428a0eb4ace8f4916896dd2b3c021a9dc77f79
9 9
 Group:		Development/Tools
10 10
 Vendor:		VMware, Inc.
11 11
 Distribution: 	Photon
... ...
@@ -34,9 +34,11 @@ make DESTDIR=%{buildroot} install
34 34
 %files
35 35
 %defattr(-,root,root)
36 36
 %{_includedir}/%{name}/*
37
-%{_libdir}/cmake/%{name}/*.cmake
38
-%{_libdir}/pkgconfig/spdlog.pc
37
+%{_lib64dir}/cmake/%{name}/*.cmake
38
+%{_lib64dir}/pkgconfig/spdlog.pc
39 39
 
40 40
 %changelog
41
+*    Fri Sep 21 2018 Srinidhi Rao <srinidhir@vmware.com> 1.1.0-1
42
+-    Updating the version to 1.1.0-1.
41 43
 *    Wed Jul 05 2017 Vinay Kulkarni <kulkarniv@vmware.com> 0.13.0-1
42 44
 -    Initial version of spdlog package for Photon.
... ...
@@ -141,9 +141,9 @@ class Installer(object):
141 141
             if versionindex == -1:
142 142
                 raise Exception("Invalid pkg name: " + pkg)
143 143
             package = pkg[:versionindex]
144
-            if package in pkg_to_rpm_map:
145
-                if pkg_to_rpm_map[package]['rpm'] is not None:
146
-                    name = pkg_to_rpm_map[package]['rpm']
144
+            if pkg in pkg_to_rpm_map:
145
+                if pkg_to_rpm_map[pkg]['rpm'] is not None:
146
+                    name = pkg_to_rpm_map[pkg]['rpm']
147 147
                     basename = os.path.basename(name)
148 148
                     self.rpms_tobeinstalled.append({'filename': basename, 'path': name,
149 149
                                                     'package' : package})
150 150
deleted file mode 100644
... ...
@@ -1,47 +0,0 @@
1
-# pylint: disable=invalid-name,missing-docstring
2
-import os.path
3
-from Logger import Logger
4
-from CommandUtils import CommandUtils
5
-from constants import constants
6
-
7
-class ChrootUtils(object):
8
-
9
-    def __init__(self, logName=None, logPath=None):
10
-        if logName is None:
11
-            logName = "ChrootUtils"
12
-        if logPath is None:
13
-            logPath = constants.logPath
14
-        self.logName = logName
15
-        self.logPath = logPath
16
-        self.logger = Logger.getLogger(logName, logPath, constants.logLevel)
17
-
18
-    def createChroot(self, chrootName):
19
-        chrootID = constants.buildRootPath + "/" + chrootName
20
-        if os.path.isdir(chrootID):
21
-            if not self.destroyChroot(chrootID):
22
-                self.logger.error("Given chroot " + chrootID +
23
-                                  " is already exists. unable to destroy it ")
24
-                return False, None
25
-        # need to add timeout for this step
26
-        # http://stackoverflow.com/questions/1191374/subprocess-with-timeout
27
-        cmdUtils = CommandUtils()
28
-        returnVal = cmdUtils.runCommandInShell("mkdir -p " + chrootID)
29
-        if not returnVal:
30
-            self.logger.error("Unable to create chroot:" + chrootID + ".Unknown error.")
31
-            return False, None
32
-        return True, chrootID
33
-
34
-    def destroyChroot(self, chrootID):
35
-        # need to add timeout for this step
36
-        # http://stackoverflow.com/questions/1191374/subprocess-with-timeout
37
-        cmdUtils = CommandUtils()
38
-        returnVal = cmdUtils.runCommandInShell("./clean-up-chroot.py " + chrootID)
39
-        if not returnVal:
40
-            self.logger.error("Unable to destroy chroot:" + chrootID + ".Unknown error.")
41
-            return False
42
-
43
-        returnVal = cmdUtils.runCommandInShell("rm -rf " + chrootID)
44
-        if not returnVal:
45
-            self.logger.error("Unable to destroy chroot:" + chrootID + ".Unknown error.")
46
-            return False
47
-        return True
... ...
@@ -2,12 +2,11 @@
2 2
 import subprocess
3 3
 import os
4 4
 
5
-class CommandUtils(object):
6
-    def __init__(self):
7
-        self.findBinary = "find"
5
+class CommandUtils:
8 6
 
9
-    def findFile(self, filename, sourcePath):
10
-        process = subprocess.Popen([self.findBinary, "-L", sourcePath, "-name", filename,
7
+    @staticmethod
8
+    def findFile(filename, sourcePath):
9
+        process = subprocess.Popen(["find", "-L", sourcePath, "-name", filename,
11 10
                                     "-not", "-type", "d"], stdout=subprocess.PIPE)
12 11
         # We don't check the return val here because find could return 1 but still be
13 12
         # able to find
... ...
@@ -26,23 +25,17 @@ class CommandUtils(object):
26 26
         return result.decode().split()
27 27
 
28 28
     @staticmethod
29
-    def runCommandInShell(cmd, logfilePath=None, chrootCmd=None):
30
-        if chrootCmd is not None:
31
-            cmd = chrootCmd + " " + cmd
32
-        if logfilePath is None:
33
-            logfilePath = os.devnull
34
-        with open(logfilePath, "w") as logfile:
35
-            process = subprocess.Popen("%s" %cmd, shell=True, stdout=logfile, stderr=logfile)
29
+    def runCommandInShell(cmd, logfile=None, logfn=None):
30
+        retval = 0
31
+        if logfn:
32
+            process = subprocess.Popen("%s" %cmd, shell=True, stdout=subprocess.PIPE)
36 33
             retval = process.wait()
37
-            if retval == 0:
38
-                return True
39
-        return False
40
-    @staticmethod
41
-    def runCommandInShell2(cmd, chrootCmd=None):
42
-        if chrootCmd is not None:
43
-            cmd = chrootCmd + " " + cmd
44
-        process = subprocess.Popen("%s" %cmd, shell=True, stdout=subprocess.PIPE)
45
-        retval = process.wait()
46
-        if retval != 0:
47
-            return None
48
-        return process.communicate()[0]
34
+            logfn(process.communicate()[0].decode())
35
+        else:
36
+            if logfile is None:
37
+                logfile = os.devnull
38
+            with open(logfile, "w") as f:
39
+                process = subprocess.Popen("%s" %cmd, shell=True, stdout=f, stderr=f)
40
+            retval = process.wait()
41
+        return retval
42
+
... ...
@@ -216,7 +216,7 @@ def buildSRPMList(srpmPath, yamlDir, blackListPkgs, dist_tag, logger, singleFile
216 216
                 srpmName = os.path.basename(srpmFullPath)
217 217
                 cpcmd = "cp " + srpmFullPath + " " + yamlSrpmDir + "/"
218 218
                 returnVal = cmdUtils.runCommandInShell(cpcmd)
219
-                if not returnVal:
219
+                if returnVal != 0:
220 220
                     logger.error("Copy SRPM File is failed for package:" + ossname)
221 221
             else:
222 222
                 logger.error("SRPM file is not found:" + ossname)
223 223
deleted file mode 100644
... ...
@@ -1,36 +0,0 @@
1
-import os.path
2
-
3
-class MiscUtils(object):
4
-
5
-    @staticmethod
6
-    def isOutdated(listInputFiles, listOutputFiles):
7
-        thresholdTimeStamp = None
8
-        if not listInputFiles:
9
-            return False
10
-        if not listOutputFiles:
11
-            return True
12
-        for f in listOutputFiles:
13
-            t = os.path.getmtime(f)
14
-            if thresholdTimeStamp is None:
15
-                thresholdTimeStamp = t
16
-            if t < thresholdTimeStamp:
17
-                thresholdTimeStamp = t
18
-        for f in listInputFiles:
19
-            t = os.path.getmtime(f)
20
-            if t > thresholdTimeStamp:
21
-                return True
22
-        return False
23
-
24
-    @staticmethod
25
-    def getListSpecFiles(listSpecFiles, path):
26
-        for dirEntry in os.listdir(path):
27
-            dirEntryPath = os.path.join(path, dirEntry)
28
-            if os.path.isfile(dirEntryPath) and dirEntryPath.endswith(".spec"):
29
-                listSpecFiles.append(dirEntryPath)
30
-            elif os.path.isdir(dirEntryPath):
31
-                MiscUtils.getListSpecFiles(listSpecFiles, dirEntryPath)
32
-
33
-if __name__ == "__main__":
34
-    inputFiles = ["SpecParser.py", "Logger.py"]
35
-    outputFiles = ["builder.py"]
36
-    print(MiscUtils.isOutdated(inputFiles, outputFiles))
... ...
@@ -2,14 +2,12 @@ import sys
2 2
 import os.path
3 3
 from PackageUtils import PackageUtils
4 4
 from Logger import Logger
5
-from ChrootUtils import ChrootUtils
6 5
 from ToolChainUtils import ToolChainUtils
7 6
 from CommandUtils import CommandUtils
8 7
 from constants import constants
9 8
 from SpecData import SPECS
10
-import docker
11
-from distutils.version import LooseVersion
12 9
 from StringUtils import StringUtils
10
+from Sandbox import Chroot, Container
13 11
 
14 12
 class PackageBuilderBase(object):
15 13
     def __init__(self, mapPackageToCycles, pkgBuildType):
... ...
@@ -63,12 +61,9 @@ class PackageBuilderBase(object):
63 63
         pkg = rpmfile[0:releaseindex]
64 64
         return pkg
65 65
 
66
-    def _findInstalledPackages(self, instanceID):
66
+    def _findInstalledPackages(self, sandbox):
67 67
         pkgUtils = PackageUtils(self.logName, self.logPath)
68
-        if self.pkgBuildType == "chroot":
69
-            listInstalledRPMs = pkgUtils.findInstalledRPMPackages(instanceID)
70
-        elif self.pkgBuildType == "container":
71
-            listInstalledRPMs = pkgUtils.findInstalledRPMPackagesInContainer(instanceID)
68
+        listInstalledRPMs = pkgUtils.findInstalledRPMPackages(sandbox)
72 69
         listInstalledPackages = []
73 70
         for installedRPM in listInstalledRPMs:
74 71
             pkg = self._findPackageNameAndVersionFromRPMFile(installedRPM)
... ...
@@ -96,7 +91,7 @@ class PackageBuilderBase(object):
96 96
     def _findBuildTimeCheckRequiredPackages(self):
97 97
         return SPECS.getData().getCheckBuildRequiresForPackage(self.package, self.version)
98 98
 
99
-    def _installPackage(self, pkgUtils, package,packageVersion, instanceID, destLogPath,
99
+    def _installPackage(self, pkgUtils, package, packageVersion, sandbox, destLogPath,
100 100
                         listInstalledPackages, listInstalledRPMs):
101 101
         rpmfile = pkgUtils.findRPMFileForGivenPackage(package,packageVersion);
102 102
         if rpmfile is None:
... ...
@@ -109,19 +104,16 @@ class PackageBuilderBase(object):
109 109
         # mark it as installed -  to avoid cyclic recursion
110 110
         listInstalledPackages.append(pkg)
111 111
         listInstalledRPMs.append(specificRPM)
112
-        self._installDependentRunTimePackages(pkgUtils, package, packageVersion, instanceID, destLogPath,
112
+        self._installDependentRunTimePackages(pkgUtils, package, packageVersion, sandbox, destLogPath,
113 113
                                               listInstalledPackages, listInstalledRPMs)
114 114
         noDeps = False
115 115
         if (package in self.mapPackageToCycles or
116 116
                 package in self.listNodepsPackages or
117 117
                 package in constants.noDepsPackageList):
118 118
             noDeps = True
119
-        if self.pkgBuildType == "chroot":
120
-            pkgUtils.installRPM(package, packageVersion,instanceID, noDeps, destLogPath)
121
-        elif self.pkgBuildType == "container":
122
-            pkgUtils.prepRPMforInstallInContainer(package,packageVersion, instanceID, noDeps, destLogPath)
119
+        pkgUtils.prepRPMforInstall(package,packageVersion, noDeps, destLogPath)
123 120
 
124
-    def _installDependentRunTimePackages(self, pkgUtils, package, packageVersion, instanceID, destLogPath,
121
+    def _installDependentRunTimePackages(self, pkgUtils, package, packageVersion, sandbox, destLogPath,
125 122
                                          listInstalledPackages, listInstalledRPMs):
126 123
         listRunTimeDependentPackages = self._findRunTimeRequiredRPMPackages(package, packageVersion)
127 124
         if listRunTimeDependentPackages:
... ...
@@ -133,10 +125,10 @@ class PackageBuilderBase(object):
133 133
                     pkgUtils.findRPMFileForGivenPackage(packageName, packageVersion)).replace(".rpm", "")
134 134
                 if pkg in listInstalledPackages and latestPkgRPM in listInstalledRPMs:
135 135
                     continue
136
-                self._installPackage(pkgUtils, packageName,packageVersion, instanceID, destLogPath,listInstalledPackages, listInstalledRPMs)
136
+                self._installPackage(pkgUtils, packageName,packageVersion, sandbox, destLogPath,listInstalledPackages, listInstalledRPMs)
137 137
 
138
-    def _findDependentPackagesAndInstalledRPM(self, instanceID):
139
-        listInstalledPackages, listInstalledRPMs = self._findInstalledPackages(instanceID)
138
+    def _findDependentPackagesAndInstalledRPM(self, sandbox):
139
+        listInstalledPackages, listInstalledRPMs = self._findInstalledPackages(sandbox)
140 140
         self.logger.debug(listInstalledPackages)
141 141
         listDependentPackages = self._findBuildTimeRequiredPackages()
142 142
         listTestPackages=[]
... ...
@@ -158,181 +150,77 @@ class PackageBuilderBase(object):
158 158
 
159 159
 class PackageBuilderContainer(PackageBuilderBase):
160 160
     def __init__(self, mapPackageToCycles, pkgBuildType):
161
-        self.buildContainerImage = "photon_build_container:latest"
162
-        self.dockerClient = docker.from_env(version="auto")
163
-
164 161
         PackageBuilderBase.__init__(self, mapPackageToCycles, pkgBuildType)
165 162
 
166
-    def _prepareBuildContainer(self, containerTaskName, packageName, packageVersion,
167
-                               isToolChainPackage=False):
168
-        # Prepare an empty chroot environment to let docker use the BUILD folder.
169
-        # This avoids docker using overlayFS which will cause make check failure.
170
-        chrootName = packageName + "-" + packageVersion
171
-        chrUtils = ChrootUtils(self.logName, self.logPath)
172
-        returnVal, chrootID = chrUtils.createChroot(chrootName)
173
-        if not returnVal:
174
-            raise Exception("Unable to prepare build root")
175
-        cmdUtils = CommandUtils()
176
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath)
177
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/BUILD")
178
-
179
-        containerID = None
180
-        mountVols = {
181
-            constants.prevPublishRPMRepo: {'bind': '/publishrpms', 'mode': 'ro'},
182
-            constants.prevPublishXRPMRepo: {'bind': '/publishxrpms', 'mode': 'ro'},
183
-            constants.tmpDirPath: {'bind': '/tmp', 'mode': 'rw'},
184
-            constants.rpmPath: {'bind': constants.topDirPath + "/RPMS", 'mode': 'rw'},
185
-            constants.sourceRpmPath: {'bind': constants.topDirPath + "/SRPMS", 'mode': 'rw'},
186
-            constants.logPath + "/" + self.logName: {'bind': constants.topDirPath + "/LOGS",
187
-                                                     'mode': 'rw'},
188
-            chrootID + constants.topDirPath + "/BUILD": {'bind': constants.topDirPath + "/BUILD",
189
-                                                         'mode': 'rw'},
190
-            constants.dockerUnixSocket: {'bind': constants.dockerUnixSocket, 'mode': 'rw'}
191
-            }
192
-
193
-        containerName = containerTaskName
194
-        containerName = containerName.replace("+", "p")
195
-        try:
196
-            oldContainerID = self.dockerClient.containers.get(containerName)
197
-            if oldContainerID is not None:
198
-                oldContainerID.remove(force=True)
199
-        except docker.errors.NotFound:
200
-            try:
201
-                sys.exc_clear()
202
-            except:
203
-                pass
204
-
205
-        try:
206
-            self.logger.debug("BuildContainer-prepareBuildContainer: " +
207
-                             "Starting build container: " + containerName)
208
-            #TODO: Is init=True equivalent of --sig-proxy?
209
-            privilegedDocker = False
210
-            cap_list = ['SYS_PTRACE']
211
-            if packageName in constants.listReqPrivilegedDockerForTest:
212
-                privilegedDocker = True
213
-
214
-            containerID = self.dockerClient.containers.run(self.buildContainerImage,
215
-                                                           detach=True,
216
-                                                           cap_add=cap_list,
217
-                                                           privileged=privilegedDocker,
218
-                                                           name=containerName,
219
-                                                           network_mode="host",
220
-                                                           volumes=mountVols,
221
-                                                           command="/bin/bash -l -c /wait.sh")
222
-
223
-            self.logger.debug("Started Photon build container for task " + containerTaskName +
224
-                              " ID: " + containerID.short_id)
225
-            if not containerID:
226
-                raise Exception("Unable to start Photon build container for task " +
227
-                                containerTaskName)
228
-        except Exception as e:
229
-            self.logger.debug("Unable to start Photon build container for task " +
230
-                              containerTaskName)
231
-            raise e
232
-        return containerID, chrootID
233
-
234 163
     def _buildPackage(self):
235 164
         #should initialize a logger based on package name
236
-        containerTaskName = "build-" + self.package
237
-        containerID = None
238
-        chrootID = None
239
-        isToolChainPackage = False
240
-        if self.package in constants.listToolChainPackages:
241
-            isToolChainPackage = True
242
-        destLogPath = constants.logPath + "/build-" + self.package
165
+        containerTaskName = "build-" + self.package + "-" + self.version
166
+        container = None
243 167
         try:
244
-            containerID, chrootID = self._prepareBuildContainer(
245
-                containerTaskName, self.package, self.version, isToolChainPackage)
168
+            container = Container(self.logger)
169
+            container.create(containerTaskName)
246 170
 
247 171
             tcUtils = ToolChainUtils(self.logName, self.logPath)
248
-            if self.package in constants.perPackageToolChain:
249
-                self.logger.debug(constants.perPackageToolChain[self.package])
250
-                tcUtils.installCustomToolChainRPMSinContainer(
251
-                    containerID,
252
-                    constants.perPackageToolChain[self.package].get(platform.machine(), []),
253
-                    self.package)
172
+            tcUtils.installCustomToolChainRPMS(container, self.package, self.version)
254 173
 
255 174
             listDependentPackages, listTestPackages, listInstalledPackages, listInstalledRPMs = (
256
-                self._findDependentPackagesAndInstalledRPM(containerID))
175
+                self._findDependentPackagesAndInstalledRPM(container))
257 176
 
258 177
             pkgUtils = PackageUtils(self.logName, self.logPath)
178
+
259 179
             if listDependentPackages:
260
-                self.logger.debug("BuildContainer-buildPackage: " +
261
-                                 "Installing dependent packages..")
262
-                self.logger.debug(listDependentPackages)
180
+                self.logger.debug("Installing the build time dependent packages......")
263 181
                 for pkg in listDependentPackages:
264 182
                     packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
265
-                    self._installPackage(pkgUtils, packageName, packageVersion, containerID, destLogPath,listInstalledPackages, listInstalledRPMs)
183
+                    self._installPackage(pkgUtils, packageName, packageVersion, container, self.logPath,listInstalledPackages, listInstalledRPMs)
266 184
                 for pkg in listTestPackages:
267
-                    packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
268 185
                     flag = False
186
+                    packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
269 187
                     for depPkg in listDependentPackages:
270 188
                         depPackageName, depPackageVersion = StringUtils.splitPackageNameAndVersion(depPkg)
271 189
                         if depPackageName == packageName:
272 190
                             flag = True
273 191
                             break;
274 192
                     if flag == False:
275
-                        self._installPackage(pkgUtils, packageName,packageVersion, containerID, destLogPath,listInstalledPackages, listInstalledRPMs)
276
-                pkgUtils.installRPMSInAOneShotInContainer(containerID, destLogPath)
193
+                        self._installPackage(pkgUtils, packageName,packageVersion, container, self.logPath,listInstalledPackages, listInstalledRPMs)
194
+                pkgUtils.installRPMSInOneShot(container)
277 195
                 self.logger.debug("Finished installing the build time dependent packages....")
278 196
 
279 197
             self.logger.debug("BuildContainer-buildPackage: Start building the package: " +
280 198
                              self.package)
281
-            pkgUtils.adjustGCCSpecsInContainer(self.package, self.version, containerID, destLogPath)
282
-            pkgUtils.buildRPMSForGivenPackageInContainer(
283
-                self.package,
284
-                self.version,
285
-                containerID,
286
-                destLogPath)
199
+            pkgUtils.adjustGCCSpecs(container, self.package, self.version)
200
+            pkgUtils.buildRPMSForGivenPackage(container, self.package, self.version, self.logPath)
287 201
             self.logger.debug("BuildContainer-buildPackage: Successfully built the package: " +
288 202
                              self.package)
289 203
         except Exception as e:
290 204
             self.logger.error("Failed while building package:" + self.package)
291
-            if containerID is not None:
292
-                self.logger.debug("Container " + containerID.short_id +
205
+            if container is not None:
206
+                self.logger.debug("Container " + container.getID() +
293 207
                                   " retained for debugging.")
294
-            logFileName = os.path.join(destLogPath, self.package + ".log")
208
+            logFileName = os.path.join(self.logPath, self.package + ".log")
295 209
             fileLog = os.popen('tail -n 20 ' + logFileName).read()
296 210
             self.logger.debug(fileLog)
297 211
             raise e
298 212
 
299 213
         # Remove the container
300
-        if containerID is not None:
301
-            containerID.remove(force=True)
302
-        # Remove the dummy chroot
303
-        if chrootID is not None:
304
-            chrUtils = ChrootUtils(self.logName, self.logPath)
305
-            chrUtils.destroyChroot(chrootID)
214
+        if container:
215
+            container.destroy()
306 216
 
307 217
 class PackageBuilderChroot(PackageBuilderBase):
308 218
     def __init__(self, mapPackageToCycles, pkgBuildType):
309 219
         PackageBuilderBase.__init__(self, mapPackageToCycles, pkgBuildType)
310 220
 
311
-    def _prepareBuildRoot(self):
312
-        chrootID = None
313
-        chrootName = self.package + "-" + self.version
221
+    def _buildPackage(self):
222
+        chroot = None
314 223
         try:
315
-            chrUtils = ChrootUtils(self.logName, self.logPath)
316
-            returnVal, chrootID = chrUtils.createChroot(chrootName)
317
-            self.logger.debug("Created new chroot: " + chrootID)
318
-            if not returnVal:
319
-                raise Exception("Unable to prepare build root")
224
+            chroot = Chroot(self.logger)
225
+            chroot.create(self.package + "-" + self.version)
226
+
320 227
             tUtils = ToolChainUtils(self.logName, self.logPath)
321
-            tUtils.installToolChainRPMS(self.package, self.version, chrootID, self.logPath)
322
-        except Exception as e:
323
-            if chrootID is not None:
324
-                self.logger.debug("Deleting chroot: " + chrootID)
325
-                chrUtils.destroyChroot(chrootID)
326
-            raise e
327
-        return chrootID
228
+            tUtils.installToolChainRPMS(chroot, self.package, self.version, self.logPath)
328 229
 
329
-    def _buildPackage(self):
330
-        chrUtils = ChrootUtils(self.logName, self.logPath)
331
-        chrootID = None
332
-        try:
333
-            chrootID = self._prepareBuildRoot()
334 230
             listDependentPackages, listTestPackages, listInstalledPackages, listInstalledRPMs = (
335
-                self._findDependentPackagesAndInstalledRPM(chrootID))
231
+                self._findDependentPackagesAndInstalledRPM(chroot))
336 232
 
337 233
             pkgUtils = PackageUtils(self.logName, self.logPath)
338 234
 
... ...
@@ -340,31 +228,31 @@ class PackageBuilderChroot(PackageBuilderBase):
340 340
                 self.logger.debug("Installing the build time dependent packages......")
341 341
                 for pkg in listDependentPackages:
342 342
                     packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
343
-                    self._installPackage(pkgUtils, packageName, packageVersion, chrootID, self.logPath,listInstalledPackages, listInstalledRPMs)
343
+                    self._installPackage(pkgUtils, packageName, packageVersion, chroot, self.logPath,listInstalledPackages, listInstalledRPMs)
344 344
                 for pkg in listTestPackages:
345 345
                     flag = False
346 346
                     packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
347 347
                     for depPkg in listDependentPackages:
348 348
                         depPackageName, depPackageVersion = StringUtils.splitPackageNameAndVersion(depPkg)
349 349
                         if depPackageName == packageName:
350
-                                flag = True
351
-                                break;
350
+                            flag = True
351
+                            break;
352 352
                     if flag == False:
353
-                        self._installPackage(pkgUtils, packageName,packageVersion, chrootID, self.logPath,listInstalledPackages, listInstalledRPMs)
354
-                pkgUtils.installRPMSInAOneShot(chrootID, self.logPath)
353
+                        self._installPackage(pkgUtils, packageName,packageVersion, chroot, self.logPath,listInstalledPackages, listInstalledRPMs)
354
+                pkgUtils.installRPMSInOneShot(chroot)
355 355
                 self.logger.debug("Finished installing the build time dependent packages....")
356 356
 
357
-            pkgUtils.adjustGCCSpecs(self.package, self.version, chrootID, self.logPath)
358
-            pkgUtils.buildRPMSForGivenPackage(self.package, self.version, chrootID,
357
+            pkgUtils.adjustGCCSpecs(chroot, self.package, self.version)
358
+            pkgUtils.buildRPMSForGivenPackage(chroot, self.package, self.version,
359 359
                                               self.logPath)
360 360
             self.logger.debug("Successfully built the package:" + self.package)
361 361
         except Exception as e:
362 362
             self.logger.error("Failed while building package:" + self.package)
363
-            self.logger.debug("Chroot with ID: " + chrootID +
363
+            self.logger.debug("Chroot: " + chroot.getPath() +
364 364
                               " not deleted for debugging.")
365 365
             logFileName = os.path.join(self.logPath, self.package + ".log")
366 366
             fileLog = os.popen('tail -n 100 ' + logFileName).read()
367 367
             self.logger.info(fileLog)
368 368
             raise e
369
-        if chrootID is not None:
370
-            chrUtils.destroyChroot(chrootID)
369
+        if chroot:
370
+            chroot.destroy()
... ...
@@ -21,7 +21,6 @@ class PackageInfo(object):
21 21
     def loadPackagesData(self):
22 22
         listPackages = SPECS.getData().getListPackages()
23 23
         listPackages.sort()
24
-        listRPMFiles = []
25 24
         cmdUtils = CommandUtils()
26 25
         for package in listPackages:
27 26
             for version in SPECS.getData().getVersions(package):
... ...
@@ -39,13 +38,12 @@ class PackageInfo(object):
39 39
                     debugrpmFile = debugrpmFiles[0]
40 40
                 pkgUtils = PackageUtils(self.logName, self.logPath)
41 41
                 for rpmPkg in listRPMPackages:
42
-                    rpmFile = pkgUtils.findRPMFileForGivenPackage(rpmPkg)
42
+                    rpmFile = pkgUtils.findRPMFileForGivenPackage(rpmPkg, version)
43 43
                     if rpmFile is not None:
44
-                        listRPMFiles.append(rpmFile)
45 44
                         listPkgAttributes = {"sourcerpm":srpmFile, "rpm":rpmFile,
46 45
                                              "debugrpm":debugrpmFile}
47
-                        self.pkgList[rpmPkg] = listPkgAttributes
48
-                        self.logger.debug("Added " + rpmPkg + " rpm package to the list")
46
+                        self.pkgList[rpmPkg+"-"+version] = listPkgAttributes
47
+                        self.logger.debug("Added " + rpmPkg + "-" + version + " to the package info json")
49 48
                     else:
50 49
                         self.logger.debug("Missing rpm file for package:" + rpmPkg)
51 50
 
... ...
@@ -5,7 +5,6 @@ from PackageBuildDataGenerator import PackageBuildDataGenerator
5 5
 from Logger import Logger
6 6
 from constants import constants
7 7
 import docker
8
-from ChrootUtils import ChrootUtils
9 8
 from CommandUtils import CommandUtils
10 9
 from PackageUtils import PackageUtils
11 10
 from ToolChainUtils import ToolChainUtils
... ...
@@ -13,6 +12,7 @@ from Scheduler import Scheduler
13 13
 from ThreadPool import ThreadPool
14 14
 from SpecData import SPECS
15 15
 from StringUtils import StringUtils
16
+from Sandbox import Chroot, Container
16 17
 
17 18
 class PackageManager(object):
18 19
 
... ...
@@ -49,7 +49,7 @@ class PackageManager(object):
49 49
         if self.pkgBuildType == "container":
50 50
             # Stage 1 build container
51 51
             #TODO image name constants.buildContainerImageName
52
-            if pkgCount > 0 or not self.dockerClient.images.list("photon_build_container:latest"):
52
+            if pkgCount > 0 or not self.dockerClient.images.list(constants.buildContainerImage):
53 53
                 self._createBuildContainer()
54 54
         self.logger.info("Step 2 : Building stage 2 of the toolchain...")
55 55
         self.logger.info(constants.listToolChainPackages)
... ...
@@ -104,7 +104,7 @@ class PackageManager(object):
104 104
                 packageIsAlreadyBuilt=True
105 105
                 listRPMPackages = SPECS.getData().getRPMPackages(package, version)
106 106
                 for rpmPkg in listRPMPackages:
107
-                    if pkgUtils.findRPMFileForGivenPackage(rpmPkg) is None:
107
+                    if pkgUtils.findRPMFileForGivenPackage(rpmPkg, version) is None:
108 108
                         packageIsAlreadyBuilt=False
109 109
                         break;
110 110
                 if packageIsAlreadyBuilt:
... ...
@@ -229,46 +229,41 @@ class PackageManager(object):
229 229
         self.logger.debug("Generating photon build container..")
230 230
         try:
231 231
             #TODO image name constants.buildContainerImageName
232
-            self.dockerClient.images.remove("photon_build_container:latest", force=True)
232
+            self.dockerClient.images.remove(constants.buildContainerImage, force=True)
233 233
         except Exception as e:
234 234
             #TODO - better handling
235 235
             self.logger.debug("Photon build container image not found.")
236 236
 
237 237
         # Create toolchain chroot and install toolchain RPMs
238
-        chrootID = None
238
+        chroot = None
239 239
         try:
240 240
             #TODO: constants.tcrootname
241
-            chrUtils = ChrootUtils("toolchain-chroot", self.logPath)
242
-            returnVal, chrootID = chrUtils.createChroot("toolchain-chroot")
243
-            self.logger.debug("Created tool-chain chroot: " + chrootID)
244
-            if not returnVal:
245
-                raise Exception("Unable to prepare tool-chain chroot")
241
+            chroot = Chroot(self.logger)
242
+            chroot.create("toolchain-chroot")
246 243
             tcUtils = ToolChainUtils("toolchain-chroot", self.logPath)
247
-            tcUtils.installToolChainRPMS(chrootID, "dummy")
244
+            tcUtils.installToolChainRPMS(chroot)
248 245
         except Exception as e:
249
-            if chrootID is not None:
250
-                self.logger.debug("Deleting chroot: " + chrootID)
251
-                chrUtils.destroyChroot(chrootID)
246
+            if chroot:
247
+                chroot.destroy()
252 248
             raise e
253
-        self.logger.debug("createBuildContainer: chrootID: " + chrootID)
249
+        self.logger.debug("createBuildContainer: " + chroot.getPath())
254 250
 
255 251
         # Create photon build container using toolchain chroot
252
+        chroot.unmountAll()
256 253
         #TODO: Coalesce logging
257 254
         cmdUtils = CommandUtils()
258
-        cmd = "./umount-build-root.sh " + chrootID
259
-        cmdUtils.runCommandInShell(cmd, self.logPath + "/toolchain-chroot1.log")
260
-        cmd = "cd " + chrootID + " && tar -czvf ../tcroot.tar.gz ."
261
-        cmdUtils.runCommandInShell(cmd, self.logPath + "/toolchain-chroot2.log")
262
-        cmd = "mv " + chrootID + "/../tcroot.tar.gz ."
263
-        cmdUtils.runCommandInShell(cmd, self.logPath + "/toolchain-chroot3.log")
255
+        cmd = "cd " + chroot.getPath() + " && tar -czf ../tcroot.tar.gz ."
256
+        cmdUtils.runCommandInShell(cmd, logfn=self.logger.debug)
257
+        cmd = "mv " + chroot.getPath() + "/../tcroot.tar.gz ."
258
+        cmdUtils.runCommandInShell(cmd, logfn=self.logger.debug)
264 259
         #TODO: Container name, docker file name from constants.
265
-        self.dockerClient.images.build(tag="photon_build_container:latest",
260
+        self.dockerClient.images.build(tag=constants.buildContainerImage,
266 261
                                        path=".",
267 262
                                        rm=True,
268 263
                                        dockerfile="Dockerfile.photon_build_container")
269 264
 
270 265
         # Cleanup
271 266
         cmd = "rm -f ./tcroot.tar.gz"
272
-        cmdUtils.runCommandInShell(cmd, self.logPath + "/toolchain-chroot4.log")
273
-        chrUtils.destroyChroot(chrootID)
267
+        cmdUtils.runCommandInShell(cmd, logfn=self.logger.debug)
268
+        chroot.destroy()
274 269
         self.logger.debug("Photon build container successfully created.")
... ...
@@ -21,8 +21,6 @@ class PackageUtils(object):
21 21
         self.logName = logName
22 22
         self.logPath = logPath
23 23
         self.logger = Logger.getLogger(logName, logPath, constants.logLevel)
24
-        self.runInChrootCommand = ("./run-in-chroot.sh " + constants.sourcePath +
25
-                                   " " + constants.rpmPath)
26 24
         self.rpmBinary = "rpm"
27 25
         self.installRPMPackageOptions = "-Uvh"
28 26
         self.nodepsRPMPackageOptions = "--nodeps"
... ...
@@ -39,73 +37,81 @@ class PackageUtils(object):
39 39
         self.packagesToInstallInAOneShot = ""
40 40
         self.noDepsRPMFilesToInstallInAOneShot = ""
41 41
         self.noDepsPackagesToInstallInAOneShot = ""
42
-        self.rpmFilesToReInstallInAOneShot = ""
43
-        self.noDepsRPMFilesToReInstallInAOneShot = ""
42
+        self.logfnvalue = None
44 43
 
45
-    def installRPM(self, package,version, chrootID, noDeps=False, destLogPath=None):
46
-
47
-        rpmfile = self.findRPMFileForGivenPackage(package,version)
44
+    def prepRPMforInstall(self, package, version, noDeps=False, destLogPath=None):
45
+        rpmfile = self.findRPMFileForGivenPackage(package, version)
48 46
         if rpmfile is None:
49
-            self.logger.error("No rpm file found for package:" + package)
50
-            raise Exception("Missing rpm file: " + package)
47
+            self.logger.error("No rpm file found for package: " + package)
48
+            raise Exception("Missing rpm file")
49
+
50
+        rpmName = os.path.basename(rpmfile)
51
+        #TODO: path from constants
52
+        if "PUBLISHRPMS" in rpmfile:
53
+            rpmDestFile = "/publishrpms/"
54
+        elif "PUBLISHXRPMS" in rpmfile:
55
+            rpmDestFile = "/publishxrpms/"
56
+        else:
57
+            rpmDestFile = constants.topDirPath + "/RPMS/"
58
+        if "noarch" in rpmfile:
59
+            rpmDestFile += "noarch/"
60
+        else:
61
+            rpmDestFile += platform.machine()+"/"
62
+        rpmDestFile += rpmName
51 63
 
52
-        rpmDestFile = self._copyRPM(rpmfile, chrootID + constants.topDirPath + "/RPMS")
53
-        rpmFile = rpmDestFile.replace(chrootID, "")
54 64
         if noDeps:
55
-            self.noDepsRPMFilesToInstallInAOneShot += " " + rpmFile
65
+            self.noDepsRPMFilesToInstallInAOneShot += " " + rpmDestFile
56 66
             self.noDepsPackagesToInstallInAOneShot += " " + package
57 67
         else:
58
-            self.rpmFilesToInstallInAOneShot += " " + rpmFile
68
+            self.rpmFilesToInstallInAOneShot += " " + rpmDestFile
59 69
             self.packagesToInstallInAOneShot += " " + package
60 70
 
61
-    def installRPMSInAOneShot(self, chrootID, destLogPath):
62
-        chrootCmd = self.runInChrootCommand + " " + chrootID
71
+    def installRPMSInOneShot(self, sandbox):
63 72
         rpmInstallcmd = self.rpmBinary + " " + self.installRPMPackageOptions
64
-        cmdUtils = CommandUtils()
73
+        # TODO: Container sandbox might need  + self.forceRpmPackageOptions
65 74
         if self.noDepsRPMFilesToInstallInAOneShot != "":
66 75
             self.logger.debug("Installing nodeps rpms: " +
67 76
                              self.noDepsPackagesToInstallInAOneShot)
68
-            logFile = destLogPath + "/install_rpms_nodeps.log"
69 77
             cmd = (rpmInstallcmd+" "+self.nodepsRPMPackageOptions + " " +
70 78
                    self.noDepsRPMFilesToInstallInAOneShot)
71
-            returnVal = cmdUtils.runCommandInShell(cmd, logFile, chrootCmd)
72
-            if not returnVal:
79
+            returnVal = sandbox.run(cmd, logfn=self.logger.debug)
80
+            if returnVal != 0:
73 81
                 self.logger.debug("Command Executed:" + cmd)
74
-                self.logger.error("Unable to install rpms")
82
+                self.logger.error("Unable to install rpms. Error {}".format(returnVal))
75 83
                 raise Exception("RPM installation failed")
76 84
         if self.rpmFilesToInstallInAOneShot != "":
77 85
             self.logger.debug("Installing rpms: " + self.packagesToInstallInAOneShot)
78
-            logFile = destLogPath+"/install_rpms.log"
79 86
             cmd = rpmInstallcmd+" "+self.rpmFilesToInstallInAOneShot
80
-            returnVal = cmdUtils.runCommandInShell(cmd, logFile, chrootCmd)
81
-            if not returnVal:
87
+            returnVal = sandbox.run(cmd, logfn=self.logger.debug)
88
+            if returnVal != 0:
82 89
                 self.logger.debug("Command Executed:" + cmd)
83 90
                 self.logger.error("Unable to install rpms")
84 91
                 raise Exception("RPM installation failed")
85 92
 
86
-    def buildRPMSForGivenPackage(self, package, version, chrootID, destLogPath=None):
93
+    def buildRPMSForGivenPackage(self, sandbox, package, version, destLogPath):
87 94
         self.logger.info("Building package : " + package)
88 95
 
89 96
         listSourcesFiles = SPECS.getData().getSources(package, version)
90 97
         listPatchFiles = SPECS.getData().getPatches(package, version)
91 98
         specFile = SPECS.getData().getSpecFile(package, version)
92 99
         specName = SPECS.getData().getSpecName(package) + ".spec"
93
-
94
-        chrootSourcePath = chrootID + constants.topDirPath + "/SOURCES/"
95
-        chrootSpecPath = constants.topDirPath + "/SPECS/"
96
-        chrootLogsFilePath = chrootID + constants.topDirPath + "/LOGS/" + package + ".log"
97
-        chrootCmd = self.runInChrootCommand + " " + chrootID
98
-        shutil.copyfile(specFile, chrootID + chrootSpecPath + specName)
100
+        sourcePath = constants.topDirPath + "/SOURCES/"
101
+        specPath = constants.topDirPath + "/SPECS/"
102
+        if (constants.rpmCheck and
103
+                package in constants.testForceRPMS and
104
+                SPECS.getData().isCheckAvailable(package)):
105
+            logFilePath = destLogPath + "/" + package + "-test.log"
106
+        else:
107
+            logFilePath = destLogPath + "/" + package + ".log"
108
+        sandbox.put(specFile, specPath + specName)
99 109
 
100 110
         sources_urls, macros = self._getAdditionalBuildOptions(package)
101 111
         self.logger.debug("Extra macros for " + package + ": " + str(macros))
102 112
         self.logger.debug("Extra source URLs for " + package + ": " + str(sources_urls))
103 113
         constants.setExtraSourcesURLs(package, sources_urls)
104 114
 
105
-        # FIXME: some sources are located in SPECS/.. how to mount?
106
-        #        if os.geteuid()==0:
107
-        self._copySourcesTobuildroot(listSourcesFiles, package, version, chrootSourcePath)
108
-        self._copySourcesTobuildroot(listPatchFiles, package, version, chrootSourcePath)
115
+        self._copySources(sandbox, listSourcesFiles, package, version, sourcePath)
116
+        self._copySources(sandbox, listPatchFiles, package, version, sourcePath)
109 117
 
110 118
         #Adding rpm macros
111 119
         listRPMMacros = constants.userDefinedMacros
... ...
@@ -115,9 +121,8 @@ class PackageUtils(object):
115 115
         listRPMFiles = []
116 116
         listSRPMFiles = []
117 117
         try:
118
-            listRPMFiles, listSRPMFiles = self._buildRPM(chrootSpecPath + specName,
119
-                                                         chrootLogsFilePath, chrootCmd,
120
-                                                         package, macros)
118
+            listRPMFiles, listSRPMFiles = self._buildRPM(sandbox, specPath + specName,
119
+                                                         logFilePath, package, macros)
121 120
             logmsg = package + " build done - RPMs : [ "
122 121
             for f in listRPMFiles:
123 122
                 logmsg += (os.path.basename(f) + " ")
... ...
@@ -127,26 +132,13 @@ class PackageUtils(object):
127 127
             self.logger.error("Failed while building rpm:" + package)
128 128
             raise e
129 129
         finally:
130
-            if destLogPath is not None:
131
-                if (constants.rpmCheck and
132
-                        package in constants.testForceRPMS and
133
-                        SPECS.getData().isCheckAvailable(package)):
134
-                    cmd = ("sed -i '/^Executing(%check):/,/^Processing files:/{//!b};d' " +
135
-                           chrootLogsFilePath)
136
-                    logFile = destLogPath + "/adjustTestFile.log"
137
-                    returnVal = CommandUtils().runCommandInShell(cmd, logFile)
138
-                    testLogFile = destLogPath + "/" + package + "-test.log"
139
-                    shutil.copyfile(chrootLogsFilePath, testLogFile)
140
-                else:
141
-                    shutil.copy2(chrootLogsFilePath, destLogPath)
130
+            if (constants.rpmCheck and
131
+                    package in constants.testForceRPMS and
132
+                    SPECS.getData().isCheckAvailable(package)):
133
+                cmd = ("sed -i '/^Executing(%check):/,/^Processing files:/{//!b};d' " + logFilePath)
134
+                CommandUtils().runCommandInShell(cmd, logfn=self.logger.debug)
142 135
         self.logger.debug("RPM build is successful")
143 136
 
144
-        for rpmFile in listRPMFiles:
145
-            self._copyRPM(chrootID + "/" + rpmFile, constants.rpmPath)
146
-
147
-        for srpmFile in listSRPMFiles:
148
-            srpmDestFile = self._copyRPM(chrootID + "/" + srpmFile, constants.sourceRpmPath)
149
-
150 137
     def findRPMFileForGivenPackage(self, package,version="*"):
151 138
         cmdUtils = CommandUtils()
152 139
         if version == "*":
... ...
@@ -171,268 +163,33 @@ class PackageUtils(object):
171 171
                               " : " + str(listFoundRPMFiles))
172 172
             raise Exception("Multiple rpm files found")
173 173
 
174
-    def findInstalledRPMPackages(self, chrootID):
174
+    def findInstalledRPMPackages(self, sandbox):
175
+        rpms = None
176
+        def setOutValue(data):
177
+            nonlocal rpms
178
+            rpms = data
175 179
         cmd = self.rpmBinary + " " + self.queryRpmPackageOptions
176
-        chrootCmd = self.runInChrootCommand + " " + chrootID
177
-        cmdUtils = CommandUtils()
178
-        result = cmdUtils.runCommandInShell2(cmd, chrootCmd)
179
-        if result is not None:
180
-            return result.decode().split()
181
-        return result
180
+        sandbox.run(cmd, logfn=setOutValue)
181
+        return rpms.split()
182 182
 
183
-    def adjustGCCSpecs(self, package, version, chrootID, logPath):
183
+    def adjustGCCSpecs(self, sandbox, package, version):
184 184
         opt = " " + SPECS.getData().getSecurityHardeningOption(package, version)
185
-        cmdUtils = CommandUtils()
186
-        cpcmd = ("cp " + self.adjustGCCSpecScript + " " + chrootID +
187
-                 "/tmp/" + self.adjustGCCSpecScript)
185
+        sandbox.put(self.adjustGCCSpecScript, "/tmp")
188 186
         cmd = "/tmp/" + self.adjustGCCSpecScript + opt
189
-        logFile = logPath + "/adjustGCCSpecScript.log"
190
-        chrootCmd = self.runInChrootCommand + " " + chrootID
191
-        returnVal = cmdUtils.runCommandInShell(cpcmd, logFile)
192
-        if not returnVal:
193
-            self.logger.error("Error during copying the file adjust gcc spec")
194
-            raise Exception("Failed while copying adjust gcc spec file")
195
-        returnVal = cmdUtils.runCommandInShell(cmd, logFile, chrootCmd)
196
-        if returnVal:
187
+        returnVal = sandbox.run(cmd, logfn=self.logger.debug)
188
+        if returnVal == 0:
197 189
             return
198 190
 
199
-        self.logger.debug(cmdUtils.runCommandInShell2("ls -la " + chrootID +
200
-                                                      "/tmp/" + self.adjustGCCSpecScript))
201
-        self.logger.debug(cmdUtils.runCommandInShell2("lsof " + chrootID + "/tmp/" +
202
-                                                      self.adjustGCCSpecScript))
203
-        self.logger.debug(cmdUtils.runCommandInShell2("ps ax"))
204
-
205
-        self.logger.error("Failed while adjusting gcc specs")
206
-        raise Exception("Failed while adjusting gcc specs")
207
-
208
-    def prepRPMforInstallInContainer(self, package,version, containerID, noDeps=False, destLogPath=None):
209
-        rpmfile = self.findRPMFileForGivenPackage(package,version)
210
-        if rpmfile is None:
211
-            self.logger.error("No rpm file found for package: " + package)
212
-            raise Exception("Missing rpm file")
213
-
214
-        rpmDestFile = self._getRPMPathInContainer(rpmfile, containerID)
215
-        if noDeps:
216
-            self.noDepsRPMFilesToInstallInAOneShot += " " + rpmDestFile
217
-            self.noDepsPackagesToInstallInAOneShot += " " + package
218
-            if package in constants.listReInstallPackages:
219
-                self.noDepsRPMFilesToReInstallInAOneShot += " " + rpmDestFile
220
-        else:
221
-            self.rpmFilesToInstallInAOneShot += " " + rpmDestFile
222
-            self.packagesToInstallInAOneShot += " " + package
223
-            if package in constants.listReInstallPackages:
224
-                self.rmpFilesToReInstallInAOneShot += " " + rpmDestFile
225
-
226
-    def installRPMSInAOneShotInContainer(self, containerID, destLogPath):
227
-        rpmInstallcmd = (self.rpmBinary + " " + self.installRPMPackageOptions + " " +
228
-                         self.forceRpmPackageOptions)
229
-
230
-        if self.noDepsRPMFilesToInstallInAOneShot != "":
231
-            self.logger.debug("PackageUtils-installRPMSInAOneShotInContainer: " +
232
-                             "Installing nodeps rpms: " +
233
-                             self.noDepsPackagesToInstallInAOneShot)
234
-            logFile = destLogPath + "/install_rpms_nodeps.log"
235
-            cmd = (rpmInstallcmd + " " + self.nodepsRPMPackageOptions + " " +
236
-                   self.noDepsRPMFilesToInstallInAOneShot)
237
-            cmd = "/bin/bash -l -c '" + cmd + "'"
238
-            #self.logger.debug("VDBG-PU-installRPMSInAOneShotInContainer: " +
239
-            #                  "Install nodeps cmd: " + cmd)
240
-            #TODO: Error code from exec_run
241
-            installLog = containerID.exec_run(cmd)
242
-            if not installLog:
243
-                self.logger.error("Unable to install nodeps rpms")
244
-                raise Exception("nodeps RPM installation failed")
245
-            with open(logFile, 'w') as logfile:
246
-                logfile.write(installLog.decode())
247
-
248
-            if self.noDepsRPMFilesToReInstallInAOneShot != "":
249
-                cmd = (rpmInstallcmd + " " + self.nodepsRPMPackageOptions + " " +
250
-                       self.forceRpmPackageOptions + " " +
251
-                       self.noDepsRPMFilesToReInstallInAOneShot)
252
-                cmd = "/bin/bash -l -c '" + cmd + "'"
253
-                #self.logger.debug("VDBG-PU-installRPMSInAOneShotInContainer: " +
254
-                #                  "ReInstall nodeps cmd: " + cmd)
255
-                #TODO: Error code from exec_run
256
-                installLog = containerID.exec_run(cmd)
257
-                if not installLog:
258
-                    self.logger.error("Unable to re-install nodeps rpms")
259
-                    raise Exception("nodeps RPM re-installation failed")
260
-                with open(logFile, 'a') as logfile:
261
-                    logfile.write(installLog.decode())
262
-
263
-        if self.rpmFilesToInstallInAOneShot != "":
264
-            self.logger.debug("PackageUtils-installRPMSInAOneShotInContainer: Installing rpms: " +
265
-                             self.packagesToInstallInAOneShot)
266
-            logFile = destLogPath + "/install_rpms.log"
267
-            cmd = rpmInstallcmd + " " + self.rpmFilesToInstallInAOneShot
268
-            cmd = "/bin/bash -l -c '" + cmd + "'"
269
-            #self.logger.debug("VDBG-PU-installRPMSInAOneShotInContainer: Install cmd: " + cmd)
270
-            #TODO: Error code from exec_run
271
-            installLog = containerID.exec_run(cmd)
272
-            if not installLog:
273
-                self.logger.error("Unable to install rpms")
274
-                raise Exception("RPM installation failed")
275
-            with open(logFile, 'w') as logfile:
276
-                logfile.write(installLog.decode())
277
-
278
-            if self.rpmFilesToReInstallInAOneShot != "":
279
-                cmd = (rpmInstallcmd + " " + self.forceRpmPackageOptions + " " +
280
-                       self.rpmFilesToReInstallInAOneShot)
281
-                cmd = "/bin/bash -l -c '" + cmd + "'"
282
-                #self.logger.debug("VDBG-PU-installRPMSInAOneShotInContainer: " +
283
-                #                  "ReInstall cmd: " + cmd)
284
-                #TODO: Error code from exec_run
285
-                installLog = containerID.exec_run(cmd)
286
-                if not installLog:
287
-                    self.logger.error("Unable to re-install rpms")
288
-                    raise Exception("RPM re-installation failed")
289
-                with open(logFile, 'a') as logfile:
290
-                    logfile.write(installLog.decode())
291
-
292
-    def findInstalledRPMPackagesInContainer(self, containerID):
293
-        cmd = self.rpmBinary + " " + self.queryRpmPackageOptions
294
-        cmd = "/bin/bash -l -c '" + cmd + "'"
295
-        #TODO: Error code from exec_run
296
-        result = containerID.exec_run(cmd)
297
-        if result is not None:
298
-            return result.decode().split()
299
-        return result
300
-
301
-    def adjustGCCSpecsInContainer(self, package, version, containerID, logPath):
302
-        opt = " " + SPECS.getData().getSecurityHardeningOption(package, version)
303
-        adjustCmd = "/" + self.adjustGCCSpecScript + opt
304
-        adjustCmd = "/bin/bash -l -c '" + adjustCmd + "'"
305
-        logFile = logPath + "/adjustGCCSpecScript.log"
306
-
307
-        #TODO: Error code from exec_run
308
-        scriptLog = containerID.exec_run(adjustCmd)
309
-        if scriptLog:
310
-            with open(logFile, 'w') as logfile:
311
-                logfile.write(scriptLog.decode())
312
-            return
191
+        # in debugging ...
192
+        sandbox.run("ls -la /tmp/" + self.adjustGCCSpecScript,
193
+                    logfn=self.logger.debug)
194
+        sandbox.run("lsof /tmp/" + self.adjustGCCSpecScript,
195
+                    logfn=self.logger.debug)
196
+        sandbox.run("ps ax", logfn=self.logger.debug)
313 197
 
314
-        self.logger.debug(containerID.exec_run("ls -la /tmp/" + self.adjustGCCSpecScript))
315
-        self.logger.debug(containerID.exec_run("lsof /tmp/" + self.adjustGCCSpecScript))
316
-        self.logger.debug(containerID.exec_run("ps ax"))
317 198
         self.logger.error("Failed while adjusting gcc specs")
318 199
         raise Exception("Failed while adjusting gcc specs")
319 200
 
320
-    def buildRPMSForGivenPackageInContainer(self, package, version, containerID, destLogPath=None):
321
-        self.logger.debug("Building rpms for package " + package + " in container " +
322
-                         containerID.short_id)
323
-
324
-        listSourcesFiles = SPECS.getData().getSources(package, version)
325
-        listPatchFiles = SPECS.getData().getPatches(package, version)
326
-        specFile = SPECS.getData().getSpecFile(package, version)
327
-        specName = SPECS.getData().getSpecName(package) + ".spec"
328
-        sourcePath = constants.topDirPath + "/SOURCES/"
329
-        specPath = constants.topDirPath + "/SPECS/"
330
-        rpmLogFile = constants.topDirPath + "/LOGS/" + package + ".log"
331
-        destLogFile = destLogPath + "/" + package + ".log"
332
-        cmdUtils = CommandUtils()
333
-
334
-        #TODO: mount it in, don't copy
335
-        cpSpecCmd = "docker cp " + specFile + " " + containerID.short_id \
336
-                        + ":" + specPath + specName
337
-        returnVal = cmdUtils.runCommandInShell(cpSpecCmd)
338
-        if not returnVal:
339
-            self.logger.error("Error copying source SPEC file to container")
340
-            raise Exception("Failed copying source SPEC to container")
341
-
342
-        macros = []
343
-        sources_urls, macros = self._getAdditionalBuildOptions(package)
344
-        constants.setExtraSourcesURLs(package, sources_urls)
345
-
346
-        #FIXME: some sources are located in SPECS/.. how to mount?
347
-        #        if os.geteuid()==0:
348
-        #TODO: mount it in, don't copy
349
-        self._copySourcesToContainer(listSourcesFiles, package, version, containerID, sourcePath)
350
-        #TODO: mount it in, don't copy
351
-        self._copySourcesToContainer(listPatchFiles, package, version, containerID, sourcePath)
352
-
353
-        # Add rpm macros
354
-        listRPMMacros = constants.userDefinedMacros
355
-        for macroName, value in listRPMMacros.items():
356
-            macros.append(macroName + " " + value)
357
-
358
-        # Build RPMs
359
-        listRPMFiles = []
360
-        listSRPMFiles = []
361
-        try:
362
-            listRPMFiles, listSRPMFiles = self._buildRPMinContainer(
363
-                specPath + specName,
364
-                rpmLogFile,
365
-                destLogFile,
366
-                containerID,
367
-                package,
368
-                version,
369
-                macros)
370
-            logmsg = "Successfully built " + package + " - RPMs : [" + "".join(os.path.basename(listRPMFiles)) + "]"
371
-            self.logger.info(logmsg)
372
-        except Exception as e:
373
-            self.logger.error("Failed while building rpm: " + package)
374
-            raise e
375
-        finally:
376
-            if destLogPath is not None:
377
-                rpmLog = destLogPath + "/" + package + ".log"
378
-                if (constants.rpmCheck and
379
-                        package in constants.testForceRPMS and
380
-                        SPECS.getData().isCheckAvailable(package, version)):
381
-                    cmd = "sed -i '/^Executing(%check):/,/^Processing files:/{//!b};d' " + rpmLog
382
-                    logFile = destLogPath + "/adjustTestFile.log"
383
-                    returnVal = CommandUtils().runCommandInShell(cmd, logFile)
384
-                    testLogFile = destLogPath + "/" + package + "-test.log"
385
-                    shutil.copyfile(rpmLog, testLogFile)
386
-        self.logger.debug("RPM build is successful")
387
-
388
-        # Verify RPM and SRPM files exist as success criteria
389
-        for rpmFile in listRPMFiles:
390
-            rpmName = os.path.basename(rpmFile)
391
-            rpmDestDir = self._getRPMDestDir(rpmName, constants.rpmPath)
392
-            rpmDestFile = rpmDestDir + "/" + rpmName
393
-            if not os.path.isfile(rpmDestFile):
394
-                self.logger.error("Could not find RPM file: " + rpmDestFile)
395
-                raise Exception("Built RPM file not found.")
396
-
397
-        for srpmFile in listSRPMFiles:
398
-            srpmName = os.path.basename(srpmFile)
399
-            srpmDestDir = self._getRPMDestDir(os.path.basename(srpmFile), constants.sourceRpmPath)
400
-            srpmDestFile = srpmDestDir + "/" + srpmName
401
-            if not os.path.isfile(srpmDestFile):
402
-                self.logger.error("Could not find RPM file: " + srpmDestFile)
403
-                raise Exception("Built SRPM file not found.")
404
-
405
-    def _getRPMArch(self, rpmName):
406
-        arch = ""
407
-        if "x86_64" in rpmName:
408
-            arch = "x86_64"
409
-        elif "aarch64" in rpmName:
410
-            arch = "aarch64"
411
-        elif "noarch" in rpmName:
412
-            arch = "noarch"
413
-        return arch
414
-
415
-    def _getRPMDestDir(self, rpmName, rpmDir):
416
-        arch = self._getRPMArch(rpmName)
417
-        rpmDestDir = rpmDir + "/" + arch
418
-        return rpmDestDir
419
-
420
-    def _copyRPM(self, rpmFile, destDir):
421
-        cmdUtils = CommandUtils()
422
-        rpmName = os.path.basename(rpmFile)
423
-        rpmDestDir = self._getRPMDestDir(rpmName, destDir)
424
-        # shutil is not atomic. copy & move to ensure atomicity.
425
-        rpmDestPath = rpmDestDir + "/" + rpmName
426
-        rpmDestPathTemp = (rpmDestDir + "/." +
427
-                           ''.join([random.choice(string.ascii_letters +
428
-                                                  string.digits) for n in range(10)]))
429
-        if os.geteuid() == 0:
430
-            if not os.path.isdir(rpmDestDir):
431
-                cmdUtils.runCommandInShell("mkdir -p " + rpmDestDir)
432
-            shutil.copyfile(rpmFile, rpmDestPathTemp)
433
-            shutil.move(rpmDestPathTemp, rpmDestPath)
434
-        return rpmDestPath
435
-
436 201
     def _verifyShaAndGetSourcePath(self, source, package, version):
437 202
         cmdUtils = CommandUtils()
438 203
         # Fetch/verify sources if sha1 not None.
... ...
@@ -462,12 +219,13 @@ class PackageUtils(object):
462 462
             raise Exception("Multiple sources found")
463 463
         return sourcePath
464 464
 
465
-    def _copySourcesTobuildroot(self, listSourceFiles, package, version, destDir):
465
+    def _copySources(self, sandbox, listSourceFiles, package, version, destDir):
466
+        # Fetch and verify sha1 if missing
466 467
         for source in listSourceFiles:
467 468
             sourcePath = self._verifyShaAndGetSourcePath(source, package, version)
468 469
             self.logger.debug("Copying... Source path :" + source +
469 470
                              " Source filename: " + sourcePath[0])
470
-            shutil.copy2(sourcePath[0], destDir)
471
+            sandbox.put(sourcePath[0], destDir)
471 472
 
472 473
     def _getAdditionalBuildOptions(self, package):
473 474
         pullsources_urls = []
... ...
@@ -479,8 +237,7 @@ class PackageUtils(object):
479 479
         return pullsources_urls, macros
480 480
 
481 481
 
482
-    def _buildRPM(self, specFile, logFile, chrootCmd, package, macros):
483
-
482
+    def _buildRPM(self, sandbox, specFile, logFile, package, macros):
484 483
         rpmBuildcmd = self.rpmbuildBinary + " " + self.rpmbuildBuildallOption
485 484
 
486 485
         if constants.rpmCheck and package in constants.testForceRPMS:
... ...
@@ -500,34 +257,36 @@ class PackageUtils(object):
500 500
             rpmBuildcmd += " " + self.rpmbuildNocheckOption
501 501
 
502 502
         for macro in macros:
503
-            rpmBuildcmd += ' --define \\\"%s\\\"' % macro
503
+            rpmBuildcmd += ' --define \"%s\"' % macro
504 504
         rpmBuildcmd += " " + specFile
505 505
 
506
-        cmdUtils = CommandUtils()
507 506
         self.logger.debug("Building rpm....")
508 507
         self.logger.debug(rpmBuildcmd)
509
-        returnVal = cmdUtils.runCommandInShell(rpmBuildcmd, logFile, chrootCmd)
508
+
509
+        returnVal = sandbox.run(rpmBuildcmd, logfile = logFile)
510
+
510 511
         if constants.rpmCheck and package in constants.testForceRPMS:
511 512
             if not SPECS.getData().isCheckAvailable(package):
512 513
                 constants.testLogger.debug(package + " : N/A")
513
-            elif returnVal:
514
+            elif returnVal == 0:
514 515
                 constants.testLogger.debug(package + " : PASS")
515 516
             else:
516 517
                 constants.testLogger.debug(package + " : FAIL")
517 518
 
518 519
         if constants.rpmCheck:
519
-            if not returnVal and constants.rpmCheckStopOnError:
520
+            if returnVal != 0 and constants.rpmCheckStopOnError:
520 521
                 self.logger.error("Checking rpm is failed " + specFile)
521 522
                 raise Exception("RPM check failed")
522 523
         else:
523
-            if not returnVal:
524
+            if returnVal != 0:
524 525
                 self.logger.error("Building rpm is failed " + specFile)
525 526
                 raise Exception("RPM build failed")
526 527
 
527 528
         #Extracting rpms created from log file
528 529
         listRPMFiles = []
529 530
         listSRPMFiles = []
530
-        with open(logFile, 'r') as logfile:
531
+        stageLogFile = logFile.replace(constants.topDirPath + "/LOGS", constants.logPath )
532
+        with open(stageLogFile, 'r') as logfile:
531 533
             fileContents = logfile.readlines()
532 534
             for i in range(0, len(fileContents)):
533 535
                 if re.search("^Wrote:", fileContents[i]):
... ...
@@ -542,103 +301,3 @@ class PackageUtils(object):
542 542
                         listSRPMFiles.append(listcontents[1])
543 543
         return listRPMFiles, listSRPMFiles
544 544
 
545
-
546
-    def _copySourcesToContainer(self, listSourceFiles, package, version, containerID, destDir):
547
-        cmdUtils = CommandUtils()
548
-        for source in listSourceFiles:
549
-            sourcePath = self._verifyShaAndGetSourcePath(source, package, version)
550
-            self.logger.debug("Copying source file: " + sourcePath[0])
551
-            copyCmd = "docker cp " + sourcePath[0] + " " + containerID.short_id + ":" + destDir
552
-            cmdUtils.runCommandInShell(copyCmd)
553
-
554
-    def _getRPMPathInContainer(self, rpmFile, containerID):
555
-        rpmName = os.path.basename(rpmFile)
556
-        #TODO: Container path from constants
557
-        if "PUBLISHRPMS" in rpmFile:
558
-            rpmPath = "/publishrpms/"
559
-        elif "PUBLISHXRPMS" in rpmFile:
560
-            rpmPath = "/publishxrpms/"
561
-        else:
562
-            rpmPath = constants.topDirPath + "/RPMS/"
563
-        if "noarch" in rpmFile:
564
-            rpmPath += "noarch/"
565
-        else:
566
-            rpmPath += platform.machine()+"/"
567
-        rpmPath += rpmName
568
-        return rpmPath
569
-
570
-
571
-    def _buildRPMinContainer(self, specFile, rpmLogFile, destLogFile, containerID, package, version, macros):
572
-
573
-        rpmBuildCmd = self.rpmbuildBinary + " " + self.rpmbuildBuildallOption
574
-
575
-        if constants.rpmCheck and package in constants.testForceRPMS:
576
-            self.logger.debug("#" * (68 + 2 * len(package)))
577
-            if not SPECS.getData().isCheckAvailable(package, version):
578
-                self.logger.debug("####### " + package +
579
-                                 " MakeCheck is not available. Skipping MakeCheck TEST for " +
580
-                                 package + " #######")
581
-                rpmBuildCmd = self.rpmbuildBinary + " --clean"
582
-            else:
583
-                self.logger.debug("####### " + package +
584
-                                 " MakeCheck is available. Running MakeCheck TEST for " +
585
-                                 package + " #######")
586
-                rpmBuildCmd = self.rpmbuildBinary + " " + self.rpmbuildCheckOption
587
-            self.logger.debug("#" * (68 + 2 * len(package)))
588
-        else:
589
-            rpmBuildCmd += " "+self.rpmbuildNocheckOption
590
-
591
-        for macro in macros:
592
-            rpmBuildCmd += ' --define \"%s\"' % macro
593
-        rpmBuildCmd += " " + specFile
594
-        rpmBuildCmd = "/bin/bash -l -c '" + rpmBuildCmd + " > " + rpmLogFile + " 2>&1'"
595
-        rpmBuildCmd = "docker exec -t " + str(containerID.short_id) + " " + rpmBuildCmd
596
-
597
-        cmdUtils = CommandUtils()
598
-        self.logger.debug("Building rpm for package: " + package)
599
-        #TODO: Show running log of rpmbuildcmd
600
-        #TODO: Get exit status of rpmBuildCmd
601
-        #containerID.exec_run(rpmBuildCmd)
602
-        returnVal = cmdUtils.runCommandInShell(rpmBuildCmd)
603
-
604
-        if not os.path.isfile(destLogFile):
605
-            self.logger.error("RPM build not file not found. Building rpm failed for: " + specFile)
606
-            raise Exception("RPM Build failed")
607
-
608
-        if constants.rpmCheck and package in constants.testForceRPMS:
609
-            if not SPECS.getData().isCheckAvailable(package, version):
610
-                constants.testLogger.info(package + " : N/A")
611
-            elif returnVal:
612
-                constants.testLogger.info(package + " : PASS")
613
-            else:
614
-                constants.testLogger.error(package + " : FAIL")
615
-
616
-        if constants.rpmCheck:
617
-            if not returnVal and constants.rpmCheckStopOnError:
618
-                self.logger.error("Checking rpm is failed " + specFile)
619
-                raise Exception("RPM check failed")
620
-        else:
621
-            if not returnVal:
622
-                self.logger.error("Building rpm is failed " + specFile)
623
-                raise Exception("RPM build failed")
624
-
625
-        #Extracting rpms created from log file
626
-        listRPMFiles = []
627
-        listSRPMFiles = []
628
-        with open(destLogFile, 'r') as logfile:
629
-            rpmBuildLogLines = logfile.readlines()
630
-            for i in range(0, len(rpmBuildLogLines)):
631
-                if re.search("^Wrote:", rpmBuildLogLines[i]):
632
-                    listcontents = rpmBuildLogLines[i].split()
633
-                    if ((len(listcontents) == 2) and
634
-                            listcontents[1].strip().endswith(".rpm") and
635
-                            "/RPMS/" in listcontents[1]):
636
-                        listRPMFiles.append(listcontents[1])
637
-                    if ((len(listcontents) == 2) and
638
-                            listcontents[1].strip().endswith(".src.rpm") and
639
-                            "/SRPMS/" in listcontents[1]):
640
-                        listSRPMFiles.append(listcontents[1])
641
-        #if not listRPMFiles:
642
-        #    self.logger.error("Building rpm failed for " + specFile)
643
-        #    raise Exception("RPM Build failed")
644
-        return listRPMFiles, listSRPMFiles
645 545
new file mode 100644
... ...
@@ -0,0 +1,234 @@
0
+import sys
1
+import os.path
2
+import subprocess
3
+import shutil
4
+import docker
5
+from constants import constants
6
+from Logger import Logger
7
+from CommandUtils import CommandUtils
8
+
9
+class Sandbox(object):
10
+    def __init__(self, logger):
11
+        self.logger = logger
12
+
13
+    def create(self, name):
14
+        pass
15
+
16
+    def destroy(self):
17
+        pass
18
+
19
+    def run(self, logfile, logfn):
20
+        pass
21
+
22
+    def put(self, src, dest):
23
+        pass
24
+
25
+class Chroot(Sandbox):
26
+    def __init__(self, logger):
27
+        Sandbox.__init__(self, logger)
28
+        self.chrootID = None
29
+        self.prepareBuildRootCmd = "./prepare-build-root.sh"
30
+        self.runInChrootCommand = ("./run-in-chroot.sh " + constants.sourcePath +
31
+                                   " " + constants.rpmPath)
32
+        self.chrootCmdPrefix = None
33
+
34
+    def getPath(self):
35
+        return self.chrootID
36
+
37
+    def create(self, chrootName):
38
+        if self.chrootID:
39
+            raise Exception("Unable to create: " + chrootName + ". Chroot is already active: " + self.chrootID)
40
+
41
+        chrootID = constants.buildRootPath + "/" + chrootName
42
+        if os.path.isdir(chrootID):
43
+            self._destroy(chrootID)
44
+
45
+        # need to add timeout for this step
46
+        # http://stackoverflow.com/questions/1191374/subprocess-with-timeout
47
+        cmdUtils = CommandUtils()
48
+        returnVal = cmdUtils.runCommandInShell("mkdir -p " + chrootID)
49
+        if returnVal != 0:
50
+            raise Exception("Unable to create chroot: " + chrootID + ". Unknown error.")
51
+        self.logger.debug("Created new chroot: " + chrootID)
52
+
53
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/dev")
54
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/etc")
55
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/proc")
56
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/run")
57
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/sys")
58
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/tmp")
59
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/publishrpms")
60
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/publishxrpms")
61
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath)
62
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/RPMS")
63
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/SRPMS")
64
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/SOURCES")
65
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/SPECS")
66
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/LOGS")
67
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/BUILD")
68
+        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/BUILDROOT")
69
+
70
+        prepareChrootCmd = self.prepareBuildRootCmd + " " + chrootID
71
+        returnVal = cmdUtils.runCommandInShell(prepareChrootCmd, logfn=self.logger.debug)
72
+        if returnVal != 0:
73
+            self.logger.error("Prepare build root script failed.Unable to prepare chroot.")
74
+            raise Exception("Prepare build root script failed")
75
+
76
+        if os.geteuid() == 0:
77
+            cmdUtils.runCommandInShell("mount --bind " + constants.rpmPath + " " +
78
+                                        chrootID + constants.topDirPath + "/RPMS")
79
+            cmdUtils.runCommandInShell("mount --bind " + constants.sourceRpmPath + " " +
80
+                                        chrootID + constants.topDirPath + "/SRPMS")
81
+            cmdUtils.runCommandInShell("mount -o ro --bind " + constants.prevPublishRPMRepo + " " +
82
+                                        chrootID + "/publishrpms")
83
+            cmdUtils.runCommandInShell("mount -o ro --bind " + constants.prevPublishXRPMRepo + " " +
84
+                                        chrootID + "/publishxrpms")
85
+
86
+        self.logger.debug("Successfully created chroot:" + chrootID)
87
+
88
+        self.chrootID = chrootID
89
+        self.chrootCmdPrefix = self.runInChrootCommand + " " + chrootID + " "
90
+
91
+    def destroy(self):
92
+        self._destroy(self.chrootID)
93
+        self.chrootID = None
94
+
95
+    def _destroy(self, chrootID):
96
+        if not chrootID:
97
+            return
98
+        self.logger.debug("Deleting chroot: " + chrootID)
99
+        self._unmountAll(chrootID)
100
+        self._removeChroot(chrootID)
101
+
102
+    def run(self, cmd, logfile=None, logfn=None):
103
+        self.logger.debug("Chroot.run() cmd: " + self.chrootCmdPrefix + cmd)
104
+        cmd = cmd.replace('"', '\\"')
105
+        return CommandUtils.runCommandInShell(self.chrootCmdPrefix + cmd, logfile, logfn)
106
+
107
+    def put(self, src, dest):
108
+        shutil.copy2(src, self.chrootID + dest)
109
+
110
+    def _removeChroot(self, chrootPath):
111
+        cmd = "rm -rf " + chrootPath
112
+        process = subprocess.Popen("%s" %cmd, shell=True,
113
+                                   stdout=subprocess.PIPE,
114
+                                   stderr=subprocess.PIPE)
115
+        retval = process.wait()
116
+        if retval != 0:
117
+            raise Exception("Unable to remove files from chroot " + chrootPath)
118
+
119
+    def unmountAll(self):
120
+        self._unmountAll(self.chrootID)
121
+
122
+    def _unmountAll(self, chrootID):
123
+        listmountpoints = self._findmountpoints(chrootID)
124
+        if listmountpoints is None:
125
+            return True
126
+        for mountpoint in listmountpoints:
127
+            cmd = "umount " + mountpoint
128
+            process = subprocess.Popen("%s" %cmd, shell=True, stdout=subprocess.PIPE,
129
+                                       stderr=subprocess.PIPE)
130
+            retval = process.wait()
131
+            if retval != 0:
132
+                raise Exception("Unable to unmount " + mountpoint)
133
+
134
+    def _findmountpoints(self, chrootPath):
135
+        if not chrootPath.endswith("/"):
136
+            chrootPath = chrootPath + "/"
137
+        cmd = "mount | grep " + chrootPath + " | cut -d' ' -s -f3"
138
+        process = subprocess.Popen("%s" %cmd, shell=True,
139
+                                   stdout=subprocess.PIPE,
140
+                                   stderr=subprocess.PIPE)
141
+        retval = process.wait()
142
+        if retval != 0:
143
+            raise Exception("Unable to find mountpoints in chroot")
144
+
145
+        mountpoints = process.communicate()[0].decode()
146
+        mountpoints = mountpoints.replace("\n", " ").strip()
147
+        if mountpoints == "":
148
+            self.logger.debug("No mount points found")
149
+            return None
150
+        listmountpoints = mountpoints.split(" ")
151
+        sorted(listmountpoints)
152
+        listmountpoints.reverse()
153
+        return listmountpoints
154
+
155
+
156
+class Container(Sandbox):
157
+    def __init__(self, logger):
158
+        Sandbox.__init__(self, logger)
159
+        self.containerID = None
160
+        self.dockerClient = docker.from_env(version="auto")
161
+
162
+    def getID(self):
163
+        return self.containerID.short_id
164
+
165
+    def create(self, containerName):
166
+        containerID = None
167
+        mountVols = {
168
+            constants.prevPublishRPMRepo: {'bind': '/publishrpms', 'mode': 'ro'},
169
+            constants.prevPublishXRPMRepo: {'bind': '/publishxrpms', 'mode': 'ro'},
170
+            constants.tmpDirPath: {'bind': '/tmp', 'mode': 'rw'},
171
+            constants.rpmPath: {'bind': constants.topDirPath + "/RPMS", 'mode': 'rw'},
172
+            constants.sourceRpmPath: {'bind': constants.topDirPath + "/SRPMS", 'mode': 'rw'},
173
+#            constants.logPath: {'bind': constants.topDirPath + "/LOGS", 'mode': 'rw'},
174
+        # Prepare an empty chroot environment to let docker use the BUILD folder.
175
+        # This avoids docker using overlayFS which will cause make check failure.
176
+
177
+#            chroot.getPath() + constants.topDirPath + "/BUILD": {'bind': constants.topDirPath + "/BUILD",
178
+#                                                         'mode': 'rw'},
179
+            constants.dockerUnixSocket: {'bind': constants.dockerUnixSocket, 'mode': 'rw'}
180
+            }
181
+
182
+        containerName = containerName.replace("+", "p")
183
+        try:
184
+            oldContainerID = self.dockerClient.containers.get(containerName)
185
+            if oldContainerID is not None:
186
+                oldContainerID.remove(force=True)
187
+        except docker.errors.NotFound:
188
+            try:
189
+                sys.exc_clear()
190
+            except:
191
+                pass
192
+
193
+        #TODO: Is init=True equivalent of --sig-proxy?
194
+        privilegedDocker = False
195
+        cap_list = ['SYS_PTRACE']
196
+#            if packageName in constants.listReqPrivilegedDockerForTest:
197
+#                privilegedDocker = True
198
+
199
+        containerID = self.dockerClient.containers.run(constants.buildContainerImage,
200
+                                                       detach=True,
201
+                                                       cap_add=cap_list,
202
+#                                                           privileged=privilegedDocker,
203
+                                                       privileged=False,
204
+                                                       name=containerName,
205
+                                                       network_mode="host",
206
+                                                       volumes=mountVols,
207
+                                                       command="tail -f /dev/null")
208
+
209
+        if not containerID:
210
+            raise Exception("Unable to start Photon build container for task " +
211
+                            containerTaskName)
212
+        self.logger.debug("Successfully created container:" + containerID.short_id)
213
+        self.containerID = containerID
214
+
215
+    def destroy(self):
216
+        self.containerID.remove(force=True)
217
+        self.containerID = None
218
+
219
+    def run(self, cmd, logfile=None, logfn=None):
220
+        result = self.containerID.exec_run(cmd)
221
+        if result.output:
222
+            if logfn:
223
+                logfn(result.output.decode())
224
+            elif logfile:
225
+                with open(logfile, "w") as f:
226
+                    f.write(result.output.decode())
227
+                    f.flush()
228
+        return result.exit_code
229
+
230
+    def put(self, src, dest):
231
+        copyCmd = "docker cp " + src + " " + self.containerID.short_id + ":" + dest
232
+        CommandUtils.runCommandInShell(copyCmd)
233
+
... ...
@@ -51,6 +51,7 @@ class SpecObjectsUtils(object):
51 51
             specObj = SpecObject()
52 52
             specObj.name = specName
53 53
             specObj.buildRequiresAllPackages = spec.getBuildRequiresAllPackages()
54
+            specObj.extraBuildRequires = spec.getExtraBuildRequires()
54 55
             specObj.installRequiresAllPackages = spec.getRequiresAllPackages()
55 56
             specObj.checkBuildRequirePackages = spec.getCheckBuildRequiresAllPackages()
56 57
             specObj.listPackages = spec.getPackageNames()
... ...
@@ -140,12 +141,18 @@ class SpecObjectsUtils(object):
140 140
 
141 141
     def getBuildRequiresForPackage(self, package, version):
142 142
         buildRequiresList=[]
143
-        buildRequiresPackages = self._getSpecObjField(package, version, field=lambda x : x.buildRequiresAllPackages)
144
-        for pkg in buildRequiresPackages:
143
+        for pkg in self._getSpecObjField(package, version, field=lambda x : x.buildRequiresAllPackages):
145 144
             properVersion = self._getProperVersion(pkg)
146 145
             buildRequiresList.append(pkg.package+"-"+properVersion)
147 146
         return buildRequiresList
148 147
 
148
+    def getExtraBuildRequiresForPackage(self, package, version):
149
+        packages=[]
150
+        for pkg in self._getSpecObjField(package, version, field=lambda x : x.extraBuildRequires):
151
+            # no version deps for publishrpms - use just name
152
+            packages.append(pkg.package)
153
+        return packages
154
+
149 155
     def getBuildRequiresForPkg(self, pkg):
150 156
         package, version = StringUtils.splitPackageNameAndVersion(pkg)
151 157
         return self.getBuildRequiresForPackage(package, version)
... ...
@@ -153,8 +160,7 @@ class SpecObjectsUtils(object):
153 153
     # Returns list of [ "pkg1-vers1", "pkg2-vers2",.. ]
154 154
     def getRequiresAllForPackage(self, package, version):
155 155
         requiresList=[]
156
-        requiresPackages = self._getSpecObjField(package, version, field=lambda x : x.installRequiresAllPackages)
157
-        for pkg in requiresPackages:
156
+        for pkg in self._getSpecObjField(package, version, field=lambda x : x.installRequiresAllPackages):
158 157
             properVersion = self._getProperVersion(pkg)
159 158
             requiresList.append(pkg.package+"-"+properVersion)
160 159
         return requiresList
... ...
@@ -208,7 +208,7 @@ def main():
208 208
     logger = Logger.getLogger("SpecDeps", options.log_path, options.log_level)
209 209
 
210 210
     if not os.path.isdir(options.output_dir):
211
-        cmdUtils.runCommandInShell2("mkdir -p "+options.output_dir)
211
+        cmdUtils.runCommandInShell("mkdir -p "+options.output_dir)
212 212
 
213 213
     if not options.input_data_dir.endswith('/'):
214 214
         options.input_data_dir += '/'
... ...
@@ -224,7 +224,7 @@ def main():
224 224
                 for p in SPECS.getData().getPackages(package,version):
225 225
                     buildarch=SPECS.getData().getBuildArch(p, version)
226 226
                     rpmFile = "stage/RPMS/" + buildarch + "/" + p + "-" + version + "-" + release + ".*" + buildarch+".rpm"
227
-                    cmdUtils.runCommandInShell2("rm -f "+rpmFile)
227
+                    cmdUtils.runCommandInShell("rm -f "+rpmFile)
228 228
         elif options.input_type == "print-upward-deps":
229 229
             whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option)
230 230
             logger.info("Upward dependencies: " + str(whoNeedsList))
... ...
@@ -81,6 +81,8 @@ class SpecParser(object):
81 81
                     self._readSecurityHardening(line)
82 82
                 elif self._isChecksum(line):
83 83
                     self._readChecksum(line, self.packages[currentPkg])
84
+                elif self._isExtraBuildRequires(line):
85
+                    self._readExtraBuildRequires(line, self.packages[currentPkg])
84 86
                 elif self._isDefinition(line):
85 87
                     self._readDefinition(line)
86 88
                 elif self._isConditionalCheckMacro(line):
... ...
@@ -263,6 +265,11 @@ class SpecParser(object):
263 263
             return True
264 264
         return False
265 265
 
266
+    def _isExtraBuildRequires(self, line):
267
+        if re.search('^%define *extrabuildrequires', line, flags=re.IGNORECASE):
268
+            return True
269
+        return False
270
+
266 271
     def _isChecksum(self, line):
267 272
         if re.search('^%define *sha1', line, flags=re.IGNORECASE):
268 273
             return True
... ...
@@ -417,6 +424,18 @@ class SpecParser(object):
417 417
         self.globalSecurityHardening = words[2]
418 418
         return True
419 419
 
420
+    def _readExtraBuildRequires(self, line, pkg):
421
+        data = line.strip()
422
+        words = data.split(" ", 2)
423
+        if len(words) != 3:
424
+            print("Error: Unable to parse line: " + line)
425
+            return False
426
+        dpkg = self._readDependentPackageData(words[2])
427
+        if dpkg is None:
428
+            return False
429
+        pkg.extrabuildrequires.extend(dpkg)
430
+        return True
431
+
420 432
     def _readChecksum(self, line, pkg):
421 433
         strUtils = StringUtils()
422 434
         line = self._replaceMacros(line)
... ...
@@ -45,6 +45,7 @@ class Package(object):
45 45
         self.buildrequires = []
46 46
         self.buildprovides = []
47 47
         self.checkbuildrequires = []
48
+        self.extrabuildrequires = []
48 49
 
49 50
         self.requires = []
50 51
         self.provides = []
... ...
@@ -102,20 +102,16 @@ class Specutils(object):
102 102
     def _getRequiresTypeAllPackages(self, requiresType):
103 103
         dependentPackages = []
104 104
         for pkg in self.spec.packages.values():
105
-            pkgRequires = []
106 105
             if requiresType == "build":
107
-                pkgRequires = pkg.buildrequires
106
+                dependentPackages.extend(pkg.buildrequires)
108 107
             elif requiresType == "install":
109
-                pkgRequires = pkg.requires
110
-            for dpkg in pkgRequires:
111
-                dependentPackages.append(dpkg)
112
-        listDependentPackages = list(set(dependentPackages))
108
+                dependentPackages.extend(pkg.requires)
109
+        listDependentPackages = dependentPackages.copy()
113 110
         packageNames = self.getPackageNames()
114 111
         for pkgName in packageNames:
115 112
             for objName in listDependentPackages:
116 113
                 if objName.package == pkgName:
117 114
                         dependentPackages.remove(objName)
118
-        dependentPackages = list(set(dependentPackages))
119 115
         return dependentPackages
120 116
 
121 117
     def getBuildRequiresAllPackages(self):
... ...
@@ -127,17 +123,20 @@ class Specutils(object):
127 127
     def getCheckBuildRequiresAllPackages(self):
128 128
         dependentPackages = []
129 129
         for pkg in self.spec.packages.values():
130
-            for dpkg in pkg.checkbuildrequires:
131
-                dependentPackages.append(dpkg)
132
-        dependentPackages = list(set(dependentPackages))
130
+            dependentPackages.extend(pkg.checkbuildrequires)
131
+        return dependentPackages
132
+
133
+    def getExtraBuildRequires(self):
134
+        dependentPackages = []
135
+        for pkg in self.spec.packages.values():
136
+            dependentPackages.extend(pkg.extrabuildrequires)
133 137
         return dependentPackages
134 138
 
135 139
     def getRequires(self, pkgName):
136 140
         dependentPackages = []
137 141
         for pkg in self.spec.packages.values():
138 142
             if pkg.name == pkgName:
139
-                for dpkg in pkg.requires:
140
-                    dependentPackages.append(dpkg)
143
+                dependentPackages.extend(pkg.requires)
141 144
         return dependentPackages
142 145
 
143 146
     def getProvides(self, packageName):
... ...
@@ -3,12 +3,12 @@ import platform
3 3
 import traceback
4 4
 import re
5 5
 from CommandUtils import CommandUtils
6
-from ChrootUtils import ChrootUtils
7 6
 from Logger import Logger
8 7
 from PackageUtils import PackageUtils
9 8
 from constants import constants
10 9
 from SpecData import SPECS
11 10
 from StringUtils import StringUtils
11
+from Sandbox import Chroot, Container
12 12
 
13 13
 class ToolChainUtils(object):
14 14
 
... ...
@@ -20,47 +20,14 @@ class ToolChainUtils(object):
20 20
         self.logName = logName
21 21
         self.logPath = logPath
22 22
         self.logger = Logger.getLogger(logName, logPath, constants.logLevel)
23
-        self.adjustToolChainScript = "adjust-tool-chain.sh"
24
-        self.localegenScript = "./locale-gen.sh"
25
-        self.localegenConfig = "./locale-gen.conf"
26
-        self.prepareBuildRootCmd = "./prepare-build-root.sh"
27 23
         self.rpmbuildCommand = "rpmbuild"
28 24
         if os.geteuid() == 0:
29 25
             self.rpmCommand = "rpm"
30 26
         else:
31 27
             self.rpmCommand = "fakeroot-ng rpm"
32 28
 
33
-    def prepareBuildRoot(self, chrootID):
34
-        self.logger.debug("Preparing build environment")
35
-        cmdUtils = CommandUtils()
36
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/dev")
37
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/etc")
38
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/proc")
39
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/run")
40
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/sys")
41
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/tmp")
42
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath)
43
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath +
44
-                                   "/RPMS/" + platform.machine())
45
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/RPMS/noarch")
46
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/SOURCES")
47
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/SPECS")
48
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/LOGS")
49
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/BUILD")
50
-        cmdUtils.runCommandInShell("mkdir -p " + chrootID + constants.topDirPath + "/BUILDROOT")
51
-
52
-        prepareChrootCmd = self.prepareBuildRootCmd + " " + chrootID
53
-        logFile = self.logPath + "/prepareBuildRoot.log"
54
-        returnVal = cmdUtils.runCommandInShell(prepareChrootCmd, logFile)
55
-        if not returnVal:
56
-            self.logger.error("Prepare build root script failed.Unable to prepare chroot.")
57
-            raise Exception("Prepare build root script failed")
58
-
59
-        self.logger.debug("Successfully prepared chroot:" + chrootID)
60
-
61 29
     def findRPMFileInGivenLocation(self, package, rpmdirPath):
62
-        cmdUtils = CommandUtils()
63
-        listFoundRPMFiles = cmdUtils.findFile(package + "-*.rpm", rpmdirPath)
30
+        listFoundRPMFiles = CommandUtils.findFile(package + "-*.rpm", rpmdirPath)
64 31
         listFilterRPMFiles = []
65 32
         for f in listFoundRPMFiles:
66 33
             rpmFileName = os.path.basename(f)
... ...
@@ -81,7 +48,7 @@ class ToolChainUtils(object):
81 81
         self.logger.info("Step 1 : Building the core toolchain packages.....")
82 82
         self.logger.info(constants.listCoreToolChainPackages)
83 83
         self.logger.info("")
84
-        chrootID = None
84
+        chroot = None
85 85
         pkgCount = 0
86 86
         try:
87 87
             pkgUtils = PackageUtils(self.logName, self.logPath)
... ...
@@ -100,28 +67,20 @@ class ToolChainUtils(object):
100 100
                 self.logger.info("Core toolchain packages are already available")
101 101
 
102 102
             for package in coreToolChainYetToBuild:
103
-                version = SPECS.getData().getHighestVersion(package)
104 103
                 self.logger.debug("Building core toolchain package : " + package)
105
-                chrUtils = ChrootUtils(self.logName, self.logPath)
106
-                chrootName = "build-"+package
107
-                destLogPath = constants.logPath + "/build-" + package
104
+                version = SPECS.getData().getHighestVersion(package)
105
+                destLogPath = constants.logPath + "/" + package + "-" + version
108 106
                 if not os.path.isdir(destLogPath):
109
-                    cmdUtils = CommandUtils()
110
-                    cmdUtils.runCommandInShell("mkdir -p " + destLogPath)
111
-                returnVal, chrootID = chrUtils.createChroot(chrootName)
112
-                if not returnVal:
113
-                    self.logger.error("Creating chroot failed")
114
-                    raise Exception("creating chroot failed")
115
-                self.installToolChainRPMS(package, version, chrootID, destLogPath)
116
-                pkgUtils.adjustGCCSpecs(package, version, chrootID, destLogPath)
117
-                pkgUtils.buildRPMSForGivenPackage(package, version, chrootID, destLogPath)
107
+                    CommandUtils.runCommandInShell("mkdir -p " + destLogPath)
108
+                chroot = Chroot(self.logger)
109
+                chroot.create(package + "-" + version)
110
+                self.installToolChainRPMS(chroot, package, version, destLogPath)
111
+                pkgUtils.adjustGCCSpecs(chroot, package, version)
112
+                pkgUtils.buildRPMSForGivenPackage(chroot, package, version, destLogPath)
118 113
                 pkgCount += 1
119
-                chrUtils.destroyChroot(chrootID)
120
-                chrootID = None
114
+                chroot.destroy()
121 115
             self.logger.debug("Successfully built toolchain")
122 116
             self.logger.info("-" * 45 + "\n")
123
-            if chrootID is not None:
124
-                chrUtils.destroyChroot(chrootID)
125 117
         except Exception as e:
126 118
             self.logger.error("Unable to build tool chain.")
127 119
             # print stacktrace
... ...
@@ -134,15 +93,15 @@ class ToolChainUtils(object):
134 134
         listBuildRequiresPkg.extend(SPECS.getData().getCheckBuildRequiresForPackage(package, version))
135 135
         return listBuildRequiresPkg
136 136
 
137
-    def installToolChainRPMS(self, packageName, packageVersion, chrootID, logPath=None):
137
+    def installToolChainRPMS(self, chroot, packageName=None, packageVersion=None, logPath=None):
138 138
         if logPath is None:
139 139
             logPath = self.logPath
140
-        cmdUtils = CommandUtils()
141
-        self.prepareBuildRoot(chrootID)
142 140
         self.logger.debug("Installing Tool Chain RPMS.......")
143 141
         rpmFiles = ""
144 142
         packages = ""
145
-        listBuildRequiresPackages = self.getListDependentPackages(packageName, packageVersion)
143
+        listBuildRequiresPackages = []
144
+        if packageName:
145
+            listBuildRequiresPackages = self.getListDependentPackages(packageName, packageVersion)
146 146
         for package in constants.listToolChainRPMsToInstall:
147 147
             pkgUtils = PackageUtils(self.logName, self.logPath)
148 148
             rpmFile = None
... ...
@@ -153,11 +112,11 @@ class ToolChainUtils(object):
153 153
                         version=depPkgVersion
154 154
             if constants.rpmCheck:
155 155
                 rpmFile = pkgUtils.findRPMFileForGivenPackage(package, version)
156
-            else:
157
-                if (packageName not in constants.listToolChainRPMsToInstall or
158
-                        constants.listToolChainRPMsToInstall.index(packageName) >
156
+            elif (packageName is None or 
157
+                    packageName not in constants.listToolChainRPMsToInstall or
158
+                    constants.listToolChainRPMsToInstall.index(packageName) >
159 159
                         constants.listToolChainRPMsToInstall.index(package)):
160
-                    rpmFile = pkgUtils.findRPMFileForGivenPackage(package, version)
160
+                rpmFile = pkgUtils.findRPMFileForGivenPackage(package, version)
161 161
             if rpmFile is None:
162 162
                 # sqlite-autoconf package was renamed, but it still published as sqlite-autoconf
163 163
                 if (package == "sqlite") and (platform.machine() == "x86_64"):
... ...
@@ -176,128 +135,45 @@ class ToolChainUtils(object):
176 176
 
177 177
         self.logger.debug(packages)
178 178
         cmd = (self.rpmCommand + " -i -v --nodeps --noorder --force --root " +
179
-               chrootID +" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles)
180
-        retVal = cmdUtils.runCommandInShell(cmd, logPath + "/install_toolchain_rpms.log")
181
-        if not retVal:
179
+               chroot.getPath() +" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles)
180
+        retVal = CommandUtils.runCommandInShell(cmd, logfn=self.logger.debug)
181
+        if retVal != 0:
182 182
             self.logger.debug("Command Executed:" + cmd)
183 183
             self.logger.error("Installing tool chain  failed")
184 184
             raise Exception("RPM installation failed")
185
-        self.logger.debug("Successfully installed default Tool Chain RPMS in Chroot:" + chrootID)
186
-        if packageName in constants.perPackageToolChain:
187
-            self.logger.debug(constants.perPackageToolChain[packageName])
188
-            self.installCustomToolChainRPMS(chrootID,
189
-                                            constants.perPackageToolChain[packageName].get(platform.machine(), []),
190
-                                            packageName)
191
-
192
-    def installCustomToolChainRPMS(self, chrootID, listOfToolChainPkgs, packageName):
185
+        self.logger.debug("Successfully installed default Tool Chain RPMS in Chroot:" + chroot.getPath())
186
+        if packageName:
187
+            self.installCustomToolChainRPMS(chroot, packageName, packageVersion)
188
+
189
+    def installCustomToolChainRPMS(self, sandbox, packageName, packageVersion):
190
+        listOfToolChainPkgs = SPECS.getData().getExtraBuildRequiresForPackage(packageName, packageVersion)
191
+        if not listOfToolChainPkgs:
192
+            return
193 193
         self.logger.debug("Installing package specific tool chain RPMs for " + packageName +
194
-                         ".......")
194
+                         ": " + str(listOfToolChainPkgs))
195 195
         rpmFiles = ""
196 196
         packages = ""
197
-        cmdUtils = CommandUtils()
198 197
         for package in listOfToolChainPkgs:
199 198
             pkgUtils = PackageUtils(self.logName, self.logPath)
200 199
             if re.match("openjre*", packageName) is not None or re.match("openjdk*", packageName):
201
-                # x86_64 has openjdk/jre as a published rpms but aarch64 has openjdk8/jre8
202
-                # Remove this condition after publishxrpms for x86_^4 got updated
203
-                if ((package == "openjdk" or package == "openjre") and
204
-                        platform.machine() == "aarch64"):
205
-                    package = package + "8"
206
-                rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishXRPMRepo)
200
+                path = constants.prevPublishXRPMRepo
201
+                sandboxPath = "/publishxrpms"
207 202
             else:
208
-                rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
203
+                path = constants.prevPublishRPMRepo
204
+                sandboxPath = "/publishrpms"
205
+            rpmFile = self.findRPMFileInGivenLocation(package, path)
209 206
             if rpmFile is None:
210 207
                 self.logger.error("Unable to find rpm "+ package +
211 208
                                   " in current and previous versions")
212 209
                 raise Exception("Input Error")
213
-            rpmFiles += " " + rpmFile
210
+            rpmFiles += " " + rpmFile.replace(path, sandboxPath)
214 211
             packages += " " + package
215 212
 
216 213
         self.logger.debug("Installing custom rpms:" + packages)
217
-        cmd = (self.rpmCommand + " -i -v --nodeps --noorder --force --root " +
218
-               chrootID + " --define \'_dbpath /var/lib/rpm\' " + rpmFiles)
219
-        retVal = cmdUtils.runCommandInShell(cmd, self.logPath +
220
-                                            "/install_custom_toolchain_rpms.log")
221
-        if not retVal:
214
+        cmd = (self.rpmCommand + " -i -v --nodeps --noorder --force " + rpmFiles)
215
+        retVal = sandbox.run(cmd, logfn=self.logger.debug)
216
+        if retVal != 0:
222 217
             self.logger.debug("Command Executed:" + cmd)
223
-            self.logger.error("Installing tool chain  failed")
218
+            self.logger.error("Installing custom toolchains failed")
224 219
             raise Exception("RPM installation failed")
225
-        self.logger.debug("Successfully installed all Tool Chain X RPMS")
226
-
227
-    def installToolChainRPMSinContainer(self, containerID):
228
-        self.logger.debug("Installing tool-chain RPMS in container: " + containerID.short_id)
229
-        rpmFiles = ""
230
-        packages = ""
231
-        pkgUtils = PackageUtils(self.logName, self.logPath)
232
-        for package in constants.listToolChainRPMPkgsToInstall:
233
-            version = SPECS.getData().getHighestVersion(package)
234
-            rpmFile = pkgUtils.findRPMFileForGivenPackage(package, version)
235
-            if rpmFile is None:
236
-                # sqlite-autoconf package was renamed, but it still published as sqlite-autoconf
237
-#                if (package == "sqlite") and (platform.machine() == "x86_64"):
238
-#                    package = "sqlite-autoconf"
239
-                rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
240
-                if rpmFile is None:
241
-                    if package in constants.listOfRPMsProvidedAfterBuild:
242
-                        self.logger.debug("No old version of " + package +
243
-                                         " exists, skip until the new version is built")
244
-                        continue
245
-                    self.logger.error("Unable to find rpm " + package +
246
-                                      " in current and previous versions")
247
-                    raise Exception("Input Error")
248
-            if rpmFile.find("stage/PUBLISHRPMS"):
249
-                rpmFile = rpmFile.replace(constants.prevPublishRPMRepo, "/publishrpms")
250
-            if rpmFile.find("stage/PUBLISHXRPMS"):
251
-                rpmFile = rpmFile.replace(constants.prevPublishXRPMRepo, "/publishxrpms")
252
-            if rpmFile.find("stage/RPMS"):
253
-                rpmFile = rpmFile.replace(constants.rpmPath, constants.topDirPath + "/RPMS")
254
-            rpmFiles += " " + rpmFile
255
-            packages += " " + package
256
-
257
-        self.logger.debug("Installing tool-chain rpms: " + packages)
258
-
259
-        cmd = "/usr/bin/bash -l -c '/usr/bin/rpm -Uvh --force --nodeps " + rpmFiles + "'"
260
-        self.logger.debug("installToolChainRPMSinContainer: Installing rpms cmd: " + cmd)
261
-        tcInstallLog = containerID.exec_run(cmd)
262
-        # TODO: Find a way to collect exit status of the command that was run.
263
-        if not tcInstallLog:
264
-            self.logger.error("Installing tool chain in container failed")
265
-            raise Exception("RPM installation in container failed")
266
-        self.logger.debug(tcInstallLog)
267
-        self.logger.debug("Successfully installed default tool-chain RPMS in container: " +
268
-                         containerID.short_id)
269
-
270
-    def installCustomToolChainRPMSinContainer(self, containerID, listOfToolChainPkgs, packageName):
271
-        self.logger.debug("Installing package specific tool chain RPMs for " + packageName)
272
-        rpmFiles = ""
273
-        packages = ""
274
-        for package in listOfToolChainPkgs:
275
-            if re.match("openjre*", packageName) is not None or re.match("openjdk*", packageName):
276
-                rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishXRPMRepo)
277
-            else:
278
-                rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
279
-            if rpmFile is None:
280
-                self.logger.error("Unable to find rpm " + package +
281
-                                  " in current and previous versions")
282
-                raise Exception("Input Error")
283
-            if rpmFile.find("stage/PUBLISHRPMS"):
284
-                rpmFile = rpmFile.replace(constants.prevPublishRPMRepo, "/publishrpms")
285
-            if rpmFile.find("stage/PUBLISHXRPMS"):
286
-                rpmFile = rpmFile.replace(constants.prevPublishXRPMRepo, "/publishxrpms")
287
-            if rpmFile.find("stage/RPMS"):
288
-                rpmFile = rpmFile.replace(constants.rpmPath, constants.topDirPath + "/RPMS")
289
-            rpmFiles += " " + rpmFile
290
-            packages += " " + package
291 220
 
292
-        self.logger.debug("Installing rpms: " + packages)
293
-        cmd = "rpm -Uvh --nodeps --force " + rpmFiles
294
-        self.logger.debug("VDBG-TCU-installCustomToolChainRPMSinContainer: Installing rpms cmd: " +
295
-                          cmd)
296
-        tcInstallLog = containerID.exec_run(cmd)
297
-        # TODO: Find a way to collect exit status of the command that was run.
298
-        if not tcInstallLog:
299
-            self.logger.error("Installing tool chain in container failed")
300
-            raise Exception("RPM installation in container failed")
301
-        self.logger.debug(tcInstallLog)
302
-        self.logger.debug("Successfully installed all tool-chain XRPMS in container: " +
303
-                         containerID.short_id)
304 221
deleted file mode 100755
... ...
@@ -1,8 +0,0 @@
1
-#!/bin/bash
2
-/sbin/locale-gen.sh
3
-mv -v /tools/bin/{ld,ld-old}
4
-mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
5
-cp -v /tools/bin/{ld-new,ld}
6
-ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
7
-gcc -dumpspecs | sed -e 's@/tools@@g' -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > `dirname $(gcc --print-libgcc-file-name)`/specs
8
-
... ...
@@ -16,8 +16,7 @@ from SpecData import SPECS
16 16
 from PackageInfo import PackageInfo
17 17
 
18 18
 def main():
19
-    usage = "Usage: %prog [options] <package name>"
20
-    parser = ArgumentParser(usage)
19
+    parser = ArgumentParser()
21 20
     parser.add_argument("-s", "--spec-path", dest="specPath", default="../../SPECS")
22 21
     parser.add_argument("-x", "--source-path", dest="sourcePath",
23 22
                         default="../../stage/SOURCES")
... ...
@@ -55,7 +54,7 @@ def main():
55 55
     parser.add_argument("-bd", "--publish-build-dependencies", dest="publishBuildDependencies",
56 56
                         default=False)
57 57
     parser.add_argument("-pw", "--package-weights-path", dest="packageWeightsPath", default=None)
58
-    parser.add_argument("-bt", "--build-type", dest="pkgBuildType", default="chroot")
58
+    parser.add_argument("-bt", "--build-type", dest="pkgBuildType", choices=['chroot', 'container'], default="chroot")
59 59
     parser.add_argument("-F", "--kat-build", dest="katBuild", default=None)
60 60
     parser.add_argument("-pj", "--packages-json-input", dest="pkgJsonInput", default=None)
61 61
     parser.add_argument("PackageName", nargs='?')
... ...
@@ -96,8 +95,7 @@ def main():
96 96
         logger.error("Given X RPMS Path is missing noarch sub-directory:"+
97 97
                      options.publishXRPMSPath)
98 98
         errorFlag = True
99
-    if not os.path.isfile(options.pkgBuildOptionFile):
100
-        logger.warning("Given JSON File is not a file:"+options.pkgBuildOptionFile)
99
+
101 100
 
102 101
     if options.inputRPMSPath is not None and not os.path.isdir(options.inputRPMSPath):
103 102
         logger.error("Given input RPMS Path is not a directory:"+options.inputRPMSPath)
... ...
@@ -21,7 +21,7 @@ def cleanUpChroot(chrootPath):
21 21
     return True
22 22
 
23 23
 def removeAllFilesFromChroot(chrootPath):
24
-    cmd = "rm -rf " + chrootPath + "/*"
24
+    cmd = "rm -rf " + chrootPath
25 25
     process = subprocess.Popen("%s" %cmd, shell=True,
26 26
                                stdout=subprocess.PIPE,
27 27
                                stderr=subprocess.PIPE)
28 28
deleted file mode 100755
... ...
@@ -1,24 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#	Title:	cleanup-build-root.sh				#
4
-#        Date:	2015-02-26          			#
5
-#     Version:	1.0				                #
6
-#      Author:	sharathg@vmware.com             #
7
-#     Options:					                #
8
-#################################################
9
-set -o errexit
10
-set -o nounset
11
-set +h
12
-
13
-if [ $# -lt 1 ]; then
14
-    fail "${PRGNAME}: No build root specified. Usage : ${PRGNAME} <build-root>"
15
-fi
16
-
17
-#Clean up our build root first
18
-BUILDROOT=$1
19
-
20
-./umount-build-root.sh $1
21
-
22
-rm -rf ${BUILDROOT}/*
23
-
24
-exit 0
... ...
@@ -19,6 +19,7 @@ class constants(object):
19 19
     publishBuildDependencies = False
20 20
     packageWeightsPath = None
21 21
     dockerUnixSocket = "/var/run/docker.sock"
22
+    buildContainerImage = "photon_build_container:latest"
22 23
     userDefinedMacros = {}
23 24
     dist = None
24 25
     buildNumber = None
... ...
@@ -97,7 +98,6 @@ class constants(object):
97 97
         "libtool",
98 98
         "flex",
99 99
         "bison",
100
-        "lua",
101 100
         "popt",
102 101
         "nspr",
103 102
         "nspr-devel",
... ...
@@ -183,8 +183,6 @@ class constants(object):
183 183
         "flex-devel",
184 184
         "bison",
185 185
         "readline-devel",
186
-        "lua",
187
-        "lua-devel",
188 186
         "popt",
189 187
         "popt-devel",
190 188
         "nspr",
... ...
@@ -221,103 +219,7 @@ class constants(object):
221 221
         "rpm-libs",
222 222
         "groff",
223 223
         "man-pages",
224
-        "cpio",
225
-        "go"]
226
-
227
-    perPackageToolChain = dict.fromkeys(
228
-        ["openjdk8",
229
-         "openjdk8-doc",
230
-         "openjdk8-src",
231
-         "openjdk8-sample",
232
-         "openjre8",
233
-         "openjdk9",
234
-         "openjdk9-doc",
235
-         "openjdk9-src",
236
-         "openjre9",
237
-         "openjdk10",
238
-         "openjdk10-doc",
239
-         "openjdk10-src",
240
-         "openjre10"],
241
-          {
242
-          "x86_64":[
243
-            "icu-devel",
244
-            "cups",
245
-            "cups-devel",
246
-            "xorg-proto-devel",
247
-            "libXtst",
248
-            "libXtst-devel",
249
-            "libXfixes",
250
-            "libXfixes-devel",
251
-            "libXi",
252
-            "libXi-devel",
253
-            "openjdk",
254
-            "openjre",
255
-            "icu",
256
-            "alsa-lib",
257
-            "alsa-lib-devel",
258
-            "xcb-proto",
259
-            "libXdmcp-devel",
260
-            "libXau-devel",
261
-            "util-macros",
262
-            "xtrans",
263
-            "libxcb-devel",
264
-            "proto",
265
-            "libXdmcp",
266
-            "libxcb",
267
-            "libXau",
268
-            "xtrans-devel",
269
-            "libX11",
270
-            "libX11-devel",
271
-            "libXext",
272
-            "libXext-devel",
273
-            "libICE-devel",
274
-            "libSM",
275
-            "libICE",
276
-            "libSM-devel",
277
-            "libXt",
278
-            "libXmu",
279
-            "libXt-devel",
280
-            "libXmu-devel",
281
-            "libXrender",
282
-            "libXrender-devel"],
283
-         "aarch64":[
284
-            "icu-devel",
285
-            "openjdk",
286
-            "openjre",
287
-            "icu",
288
-            "alsa-lib",
289
-            "alsa-lib-devel",
290
-            "xcb-proto",
291
-            "libXdmcp-devel",
292
-            "libXau-devel",
293
-            "util-macros",
294
-            "xtrans",
295
-            "libxcb-devel",
296
-            "proto",
297
-            "libXdmcp",
298
-            "libxcb",
299
-            "libXau",
300
-            "xtrans-devel",
301
-            "libX11",
302
-            "libX11-devel",
303
-            "libXext",
304
-            "libXext-devel",
305
-            "libICE-devel",
306
-            "libSM",
307
-            "libICE",
308
-            "libSM-devel",
309
-            "libXt",
310
-            "libXmu",
311
-            "libXt-devel",
312
-            "libXmu-devel",
313
-            "libXrender",
314
-            "libXrender-devel"]
315
-          })
316
-
317
-    perPackageToolChain["apache-maven"] = {
318
-          "x86_64":["apache-maven"],
319
-          "aarch64":["apache-maven"]
320
-          }
224
+        "cpio"]
321 225
 
322 226
     # List of RPMs which are not published. They will be created during the
323 227
     # build process
... ...
@@ -391,9 +293,6 @@ class constants(object):
391 391
         "gnupg",
392 392
         "ncurses-terminfo"]
393 393
 
394
-    listReInstallPackages = [
395
-        "go"]
396
-
397 394
     # List of packages that requires privileged docker
398 395
     # to run make check.
399 396
     listReqPrivilegedDockerForTest = [
400 397
deleted file mode 100644
... ...
@@ -1,26 +0,0 @@
1
- 
2
-# Configuration file for locale-gen
3
-#
4
-# lists of locales that are to be generated by the locale-gen command.
5
-#
6
-# Each line is of the form:
7
-#
8
-#     <locale> <charset>
9
-#
10
-#  where <locale> is one of the locales given in /usr/share/i18n/locales
11
-#  and <charset> is one of the character sets listed in /usr/share/i18n/charmaps
12
-#
13
-#  Examples:
14
-#  en_US ISO-8859-1
15
-#  en_US.UTF-8 UTF-8
16
-#  de_DE ISO-8859-1
17
-#  de_DE@euro ISO-8859-15
18
-#
19
-#  The locale-gen command will generate all the locales,
20
-#  placing them in /usr/lib/locale.
21
-#
22
-#  A list of supported locales is included in this file.
23
-#  Uncomment the ones you need.
24
-#
25
-en_US		ISO-8859-1
26
-en_US.UTF-8	UTF-8
27 1
deleted file mode 100755
... ...
@@ -1,34 +0,0 @@
1
-#!/bin/sh
2
-set -e
3
-LOCALEGEN=/etc/locale-gen.conf
4
-LOCALES=/usr/share/i18n/locales
5
-if [ -n "$POSIXLY_CORRECT" ]; then
6
-  unset POSIXLY_CORRECT
7
-fi
8
-[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
9
-# Remove all old locale dir and locale-archive before generating new
10
-# locale data.
11
-rm -rf /usr/lib/locale/* || true
12
-umask 022
13
-is_entry_ok() {
14
-  if [ -n "$locale" -a -n "$charset" ] ; then
15
-    true
16
-  else
17
-    echo "error: Bad entry '$locale $charset'"
18
-    false
19
-  fi
20
-}
21
-echo "Generating locales..."
22
-while read locale charset; do \
23
-	case $locale in \#*) continue;; "") continue;; esac; \
24
-	is_entry_ok || continue
25
-	echo -n "  `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
26
-	echo -n ".$charset"; \
27
-	echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
28
-	echo -n '...'; \
29
-        if [ -f $LOCALES/$locale ]; then input=$locale; else \
30
-        input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
31
-	localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
32
-	echo ' done'; \
33
-done < $LOCALEGEN
34
-echo "Generation complete."
35 1
\ No newline at end of file
... ...
@@ -20,16 +20,11 @@ fi
20 20
 BUILDROOT=$1
21 21
 PARENT=/usr/src/photon
22 22
 
23
-
24 23
 if mountpoint ${BUILDROOT}/run	>/dev/null 2>&1; then umount ${BUILDROOT}/run; fi
25 24
 if mountpoint ${BUILDROOT}/sys	>/dev/null 2>&1; then umount ${BUILDROOT}/sys; fi
26 25
 if mountpoint ${BUILDROOT}/proc	>/dev/null 2>&1; then umount ${BUILDROOT}/proc; fi
27 26
 if mountpoint ${BUILDROOT}/dev	>/dev/null 2>&1; then umount -R ${BUILDROOT}/dev; fi
28 27
 
29
-
30
-#copy localegen files.
31
-cp ./locale* ${BUILDROOT}${PARENT}/
32
-
33 28
 cp /etc/resolv.conf ${BUILDROOT}/etc/
34 29
 
35 30
 if [ ${EUID} -eq 0 ] ; then
... ...
@@ -32,7 +32,7 @@ if [ ${EUID} -eq 0 ] ; then
32 32
     CHROOT_CMD=chroot
33 33
 else
34 34
 #    CHROOT_CMD="contain -b $SOURCES:usr/src/photon/SOURCES,$RPMS:usr/src/photon/RPMS -c"
35
-    CHROOT_CMD="contain -b $RPMS:usr/src/photon/RPMS -c -n"
35
+    CHROOT_CMD="contain -b $RPMS:usr/src/photon/RPMS,$RPMS/../SRPMS:usr/src/photon/SRPMS,$RPMS/../PUBLISHRPMS:publishrpms,$RPMS/../PUBLISHXRPMS:publishxrpms -c -n"
36 36
 fi
37 37
 
38 38
 
39 39
deleted file mode 100755
... ...
@@ -1,33 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#	Title:	cleanup-build-root.sh				#
4
-#        Date:	2015-02-26          			#
5
-#     Version:	1.0				                #
6
-#      Author:	sharathg@vmware.com             #
7
-#     Options:					                #
8
-#################################################
9
-set -o errexit
10
-set -o nounset
11
-set +h
12
-
13
-source common.inc
14
-
15
-LOGFILE="$(date +%Y-%m-%d).log"
16
-PRGNAME=${0##*/}
17
-LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"
18
-if [ $# -lt 1 ]; then
19
-    fail "${PRGNAME}: No build root specified. Usage : ${PRGNAME} <build-root>"
20
-fi
21
-
22
-#Clean up our build root first
23
-BUILDROOT=$1
24
-
25
-[ -z ${BUILDROOT} ]		&& fail "${PRGNAME}: BUILDROOT not set: FAILURE"
26
-if [ ${EUID} -eq 0 ] ; then
27
-    if mountpoint ${BUILDROOT}/run	>/dev/null 2>&1; then umount ${BUILDROOT}/run; fi
28
-    if mountpoint ${BUILDROOT}/sys	>/dev/null 2>&1; then umount ${BUILDROOT}/sys; fi
29
-    if mountpoint ${BUILDROOT}/proc	>/dev/null 2>&1; then umount ${BUILDROOT}/proc; fi
30
-    if mountpoint ${BUILDROOT}/dev	>/dev/null 2>&1; then umount -R ${BUILDROOT}/dev; fi
31
-fi
32
-
33
-exit 0
... ...
@@ -57,7 +57,7 @@ function check-for-bogus-dates()
57 57
   do
58 58
     day=$(date --date="$m $d $y" '+%a')
59 59
     if [ "${D}" != "${day}" ]; then
60
-      echo "ERROR in $1: bogus date $m $d $y found - actual day is $D, but found $day"
60
+      echo "ERROR in $1: bogus date $m $d $y found - actual day is $day, but found $D"
61 61
       exit 1
62 62
     fi
63 63
     epoch_seconds=$(date --date "$m $d $y" +%s)