Browse code

fix installer with one rpm transaction

Change-Id: I787450a8404767eefe1abe126b695f95b37c83dd
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2874
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Xiaolin Li <xiaolinl@vmware.com>

Bo Gan authored on 2017/06/06 10:36:39
Showing 15 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Bourne-Again SHell
2 2
 Name:		bash
3 3
 Version:	4.4
4
-Release:	2%{?dist}
4
+Release:	3%{?dist}
5 5
 License:	GPLv3
6 6
 URL:		http://www.gnu.org/software/bash/
7 7
 Group:		System Environment/Base
... ...
@@ -15,6 +15,10 @@ Provides:	/bin/sh
15 15
 Provides:	/bin/bash
16 16
 BuildRequires:  readline
17 17
 Requires:       readline
18
+Requires(post):    grep
19
+Requires(post):    /bin/cp
20
+Requires(postun):  grep
21
+Requires(postun):  /bin/mv
18 22
 %description
19 23
 The package contains the Bourne-Again SHell
20 24
 
... ...
@@ -292,6 +296,8 @@ fi
292 292
 %defattr(-,root,root)
293 293
 
294 294
 %changelog
295
+*   Sun Jun 4 2017 Bo Gan <ganb@vmware.com> 4.4-3
296
+-   Fix dependency
295 297
 *   Thu Feb 2 2017 Divya Thaluru <dthaluru@vmware.com> 4.4-2
296 298
 -   Modified bash entry in /etc/shells
297 299
 *   Fri Jan 13 2017 Dheeraj Shetty <dheerajs@vmware.com> 4.4-1
... ...
@@ -5,7 +5,7 @@
5 5
 Summary:        A password strength-checking library.
6 6
 Name:           cracklib
7 7
 Version:        2.9.6
8
-Release:        6%{?dist}
8
+Release:        7%{?dist}
9 9
 Group:          System Environment/Libraries
10 10
 Source:         cracklib-%{version}.tar.gz
11 11
 %define sha1    cracklib-%{version}=9199e7b8830717565a844430653f5a90a04fcd65
... ...
@@ -16,6 +16,9 @@ URL:            http://sourceforge.net/projects/cracklib/
16 16
 License:        GPL
17 17
 Vendor:         VMware, Inc.
18 18
 Distribution:   Photon
19
+Requires:         /bin/ln
20
+Requires(post):   /bin/ln
21
+Requires(postun): /bin/rm
19 22
 
20 23
 %description
21 24
 CrackLib tests passwords to determine whether they match certain
... ...
@@ -206,6 +209,8 @@ rm -f %{_datadir}/cracklib/pw_dict.pwi
206 206
 %{_datadir}/locale/*
207 207
 
208 208
 %changelog
209
+*   Sun Jun 04 2017 Bo Gan <ganb@vmware.com> 2.9.6-7
210
+-   Fix script dependency
209 211
 *   Thu May 18 2017 Xiaolin Li <xiaolinl@vmware.com> 2.9.6-6
210 212
 -   Move python2 requires to python subpackage and added python3.
211 213
 *   Thu Apr 13 2017 Bo Gan <ganb@vmware.com> 2.9.6-5
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	gptfdisk-1.0.1
2 2
 Name:		gptfdisk
3 3
 Version:	1.0.1
4
-Release:	3%{?dist}
4
+Release:	4%{?dist}
5 5
 License:	GPLv2+
6 6
 URL:		http://sourceforge.net/projects/gptfdisk/
7 7
 Group:		System Environment/Filesystem and Disk management
... ...
@@ -14,6 +14,7 @@ Requires: 	popt >= 1.16
14 14
 BuildRequires:	popt-devel
15 15
 BuildRequires:	ncurses-devel
16 16
 Requires:	ncurses
17
+Requires:	libstdc++
17 18
 %description
18 19
 The gptfdisk package is a set of programs for creation and maintenance of GUID Partition 
19 20
 Table (GPT) disk drives. A GPT partitioned disk is required for drives greater than 2 TB 
... ...
@@ -38,6 +39,8 @@ rm -rf %{buildroot}/*
38 38
 /sbin/*
39 39
 %{_mandir}/man8/*
40 40
 %changelog
41
+*	Mon Jun 05 2017 Bo Gan <ganb@vmware.com> 1.0.1-4
42
+-	Fix dependency
41 43
 *       Wed Oct 05 2016 ChangLee <changlee@vmware.com> 1.0.1-3
42 44
 -       Modified %check
43 45
 *	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0.1-2
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Libraries for terminal handling of character screens
2 2
 Name:		ncurses
3 3
 Version:	6.0
4
-Release:	7%{?dist}
4
+Release:	8%{?dist}
5 5
 License:	MIT
6 6
 URL:		http://www.gnu.org/software/ncurses
7 7
 Group:		Applications/System
... ...
@@ -9,11 +9,19 @@ Vendor:		VMware, Inc.
9 9
 Distribution: 	Photon
10 10
 Source0:	ftp://ftp.gnu.org/gnu/ncurses/%{name}-%{version}.tar.gz
11 11
 %define sha1 ncurses=acd606135a5124905da770803c05f1f20dd3b21c
12
-Provides:       libncurses.so.6()(64bit)
12
+Requires:	ncurses-libs = %{version}-%{release}
13 13
 %description
14 14
 The Ncurses package contains libraries for terminal-independent
15 15
 handling of character screens.
16 16
 
17
+%package libs
18
+Summary: Ncurses Libraries
19
+Group: System Environment/Libraries
20
+Provides:       libncurses.so.6()(64bit)
21
+
22
+%description libs
23
+This package contains ncurses libraries
24
+
17 25
 %package compat
18 26
 Summary: Ncurses compatibility libraries
19 27
 Group: System Environment/Libraries
... ...
@@ -98,8 +106,8 @@ cd test
98 98
 ./configure
99 99
 make
100 100
 
101
-%post	-p /sbin/ldconfig
102
-%postun	-p /sbin/ldconfig
101
+%post libs -p /sbin/ldconfig
102
+%postun	libs -p /sbin/ldconfig
103 103
 %post compat -p /sbin/ldconfig
104 104
 %postun compat -p /sbin/ldconfig
105 105
 %files
... ...
@@ -115,13 +123,15 @@ make
115 115
 %{_bindir}/tput
116 116
 %{_bindir}/infotocap
117 117
 %{_bindir}/toe
118
-%{_libdir}/lib*.so.6*
119
-%{_datadir}/tabset/*
120 118
 %{_mandir}/man7/*
121 119
 %{_mandir}/man1/*
122 120
 %{_mandir}/man5/*
121
+
122
+%files libs
123 123
 %{_datadir}/terminfo/l/linux
124
+%{_datadir}/tabset/*
124 125
 %{_libdir}/terminfo
126
+%{_libdir}/lib*.so.6*
125 127
 
126 128
 %files compat
127 129
 %{_libdir}/lib*.so.5*
... ...
@@ -170,6 +180,8 @@ make
170 170
 %exclude %{_datadir}/terminfo/l/linux
171 171
 
172 172
 %changelog
173
+*   Mon Jun 05 2017 Bo Gan <ganb@vmware.com> 6.0-8
174
+-   Fix bash dependency
173 175
 *   Sun Jun 04 2017 Bo Gan <ganb@vmware.com> 6.0-7
174 176
 -   Fix symlink
175 177
 *   Wed Mar 29 2017 Alexey Makhalov <amakhalov@vmware.com> 6.0-6
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        Usermode tools for VmWare virts
2 2
 Name:           open-vm-tools
3 3
 Version:        10.1.5
4
-Release:        4%{?dist}
4
+Release:        5%{?dist}
5 5
 License:        LGPLv2+
6 6
 URL:            https://github.com/vmware/open-vm-tools
7 7
 Group:          Applications/System
... ...
@@ -38,6 +38,7 @@ Requires:       glib
38 38
 Requires:       xml-security-c
39 39
 Requires:       openssl
40 40
 Requires:       systemd
41
+Requires:	libstdc++
41 42
 %description
42 43
 VmWare virtualization user mode tools
43 44
 %prep
... ...
@@ -107,6 +108,8 @@ fi
107 107
 
108 108
 
109 109
 %changelog
110
+*	Mon Jun 05 2017 Bo Gan <ganb@vmware.com> 10.1.5-5
111
+-	Fix dependency
110 112
 *       Thu Apr 20 2017 Kumar Kaushik <kaushikk@vmware.com> 10.1.5-4
111 113
 -       Timezone customization, PR # 1684889
112 114
 *       Fri Apr 07 2017 Kumar Kaushik <kaushikk@vmware.com> 10.1.5-3
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        A high-level scripting language
2 2
 Name:           python2
3 3
 Version:        2.7.13
4
-Release:        5%{?dist}
4
+Release:        6%{?dist}
5 5
 License:        PSF
6 6
 URL:            http://www.python.org/
7 7
 Group:          System Environment/Programming
... ...
@@ -44,6 +44,7 @@ Requires:       expat >= 2.1.0
44 44
 Requires:       libffi >= 3.0.13
45 45
 Requires:       ncurses
46 46
 Requires:       coreutils
47
+Requires:       gdbm
47 48
 
48 49
 # Needed for ctypes, to load libraries, worked around for Live CDs size
49 50
 # Requires: binutils
... ...
@@ -222,6 +223,8 @@ rm -rf %{buildroot}/*
222 222
 %exclude %{_bindir}/idle*
223 223
 
224 224
 %changelog
225
+*   Sun Jun 04 2017 Bo Gan <ganb@vmware.com> 2.7.13-6
226
+-   Fix dependency for libs
225 227
 *   Tue May 16 2017 Kumar Kaushik <kaushikk@vmware.com> 2.7.13-5
226 228
 -   Fixing python issue 29188, backport random.c from 3.5 to 2.7.
227 229
 *   Fri Apr 28 2017 Harish Udaiya <hudaiyakumar@vmware.com> 2.7.13-4
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Command-line editing and history capabilities
2 2
 Name:		readline
3 3
 Version:	7.0
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	GPLv3+
6 6
 URL:		http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
7 7
 Group:		Applications/System
... ...
@@ -10,7 +10,7 @@ Distribution: 	Photon
10 10
 Source0:	http://ftp.gnu.org/gnu/readline/%{name}-%{version}.tar.gz
11 11
 %define sha1 readline=d9095fa14a812495052357e1d678b3f2ac635463
12 12
 BuildRequires:	ncurses-devel
13
-Requires:	ncurses
13
+Requires:	ncurses-libs
14 14
 %description
15 15
 The Readline package is a set of libraries that offers command-line
16 16
 editing and history capabilities.
... ...
@@ -96,6 +96,8 @@ make %{?_smp_mflags} check
96 96
 %{_mandir}/man3/history.3.gz
97 97
 %{_mandir}/man3/readline.3.gz
98 98
 %changelog
99
+*       Sun Jun 04 2017 Bo Gan <ganb@vmware.com> 7.0-2
100
+-       Fix dependency
99 101
 *       Fri Jan 13 2017 Dheeraj Shetty <dheerajs@vmware.com> 7.0-1
100 102
 -       Updated to version 7.0
101 103
 *       Wed Nov 16 2016 Alexey Makhalov <amakhalov@vmware.com> 6.3-6
... ...
@@ -4,7 +4,7 @@
4 4
 Summary:        Package manager
5 5
 Name:           rpm
6 6
 Version:        4.13.0.1
7
-Release:        2%{?dist}
7
+Release:        3%{?dist}
8 8
 License:        GPLv2+
9 9
 URL:            http://rpm.org
10 10
 Group:          Applications/System
... ...
@@ -20,6 +20,7 @@ Patch1:         find-debuginfo-do-not-generate-dir-entries.patch
20 20
 Requires:       bash
21 21
 Requires:       libdb
22 22
 Requires:       rpm-libs = %{version}-%{release}
23
+Requires:       libarchive
23 24
 BuildRequires:  libarchive-devel
24 25
 BuildRequires:  libdb-devel
25 26
 BuildRequires:  popt-devel
... ...
@@ -259,6 +260,8 @@ rm -rf %{buildroot}
259 259
 %{python3_sitelib}/*
260 260
 
261 261
 %changelog
262
+*   Mon Jun 05 2017 Bo Gan <ganb@vmware.com> 4.13.0.1-3
263
+-   Fix Dependency
262 264
 *   Thu May 18 2017 Xiaolin Li <xiaolinl@vmware.com> 4.13.0.1-2
263 265
 -   Remove python2 from requires of rpm-devel subpackages.
264 266
 *   Wed May 10 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 4.13.0.1-1
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	C++ xml parser.
2 2
 Name:		xerces-c
3 3
 Version:	3.1.4
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	Apache License
6 6
 URL:		http://xerces.apache.org
7 7
 Group:		Applications/System
... ...
@@ -9,14 +9,18 @@ Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10 10
 Source0:	http://mirrors.advancedhosters.com/apache//xerces/c/3/sources/%{name}-%{version}.tar.xz
11 11
 %define sha1 xerces-c=df52c67ad958460d4357b9305b49fda6876f6975
12
+Requires:	libstdc++
12 13
 %description
13 14
 Xerces-C++ is a validating XML parser written in a portable subset of C++
15
+
14 16
 %package	devel
15 17
 Summary:	XML library headers
16 18
 Group:         	Development/Libraries
17 19
 Requires:       %{name} = %{version}-%{release}
20
+
18 21
 %description	devel
19 22
 This package contains development headers and static library for xml parser.
23
+
20 24
 %prep
21 25
 %setup -q
22 26
 %build
... ...
@@ -43,6 +47,8 @@ make %{?_smp_mflags} check
43 43
 %{_libdir}/*.la
44 44
 
45 45
 %changelog
46
+*	Mon Jun 05 2017 Bo Gan <ganb@vmware.com> 3.1.4-2
47
+-	Fix dependency
46 48
 *	Wed Mar 15 2017 Dheeraj Shetty <dheerajs@vmware.com> 3.1.4-1
47 49
 -	Upgrade to latest version to handle CVE-2016-2099
48 50
 *       Wed Oct 05 2016 ChangLee <changlee@vmware.com> 3.1.3-3
... ...
@@ -9,7 +9,7 @@
9 9
                 "open-vm-tools",
10 10
                 "docker","bridge-utils",
11 11
                 "cloud-init",
12
-                "krb5", "which", "tzdata", "motd"]
12
+                "krb5", "which", "tzdata", "motd", "gdbm"]
13 13
 }
14 14
 
15 15
 
... ...
@@ -131,7 +131,6 @@ class Installer(object):
131 131
                         retval = process.poll()
132 132
                         if retval is not None:
133 133
                             break
134
-                    modules.commons.log(modules.commons.LOG_INFO, "[tdnf] {0}".format(output))
135 134
                     if state == 0:
136 135
                         if output == 'Installing:\n':
137 136
                             state = 1
... ...
@@ -149,28 +148,31 @@ class Installer(object):
149 149
                             self.progress_bar.update_message('Preparing ...')
150 150
                             state = 3
151 151
                     elif state == 3:
152
+                        self.progress_bar.update_message(output)
152 153
                         if output == 'Running transaction\n':
153 154
                             state = 4
154 155
                     else:
156
+                        modules.commons.log(modules.commons.LOG_INFO, "[tdnf] {0}".format(output))
155 157
                         prefix = 'Installing/Updating: '
156 158
                         if output.startswith(prefix):
157 159
                             package = output[len(prefix):].rstrip('\n')
158 160
                             self.progress_bar.increment(packages_to_install[package])
159 161
                         self.progress_bar.update_message(output)
160
-                            #packages_to_install[package]))
161 162
                 # 0 : succeed; 137 : package already installed; 65 : package not found in repo.
162 163
                 if retval != 0 and retval != 137:
163 164
                     modules.commons.log(modules.commons.LOG_ERROR, "Failed to install some packages, refer to {0}".format(modules.commons.TDNF_LOG_FILE_NAME))
164 165
                     self.exit_gracefully(None, None)
165 166
         else:
166 167
         #install packages
168
+            rpms = []
167 169
             for rpm in self.rpms_tobeinstalled:
168 170
                 # We already installed the filesystem in the preparation
169 171
                 if rpm['package'] == 'filesystem':
170 172
                     continue
171
-                return_value = self.install_package(rpm['filename'])
172
-                if return_value != 0:
173
-                    self.exit_gracefully(None, None)
173
+                rpms.append(rpm['filename'])
174
+            return_value = self.install_package(rpms)
175
+            if return_value != 0:
176
+                self.exit_gracefully(None, None)
174 177
 
175 178
 
176 179
         if self.iso_installer:
... ...
@@ -289,6 +291,8 @@ class Installer(object):
289 289
 
290 290
     def bind_repo_dir(self):
291 291
         rpm_cache_dir = self.photon_root + '/cache/tdnf/photon-iso/rpms'
292
+        if self.rpm_path.startswith("https://") or self.rpm_path.startswith("http://"):
293
+            return
292 294
         if subprocess.call(['mkdir', '-p', rpm_cache_dir]) != 0 or subprocess.call(['mount', '--bind', self.rpm_path, rpm_cache_dir]) != 0:
293 295
             modules.commons.log(modules.commons.LOG_ERROR, "Fail to bind cache rpms")
294 296
             self.exit_gracefully(None, None)
... ...
@@ -379,20 +383,24 @@ class Installer(object):
379 379
             retval = process.wait()
380 380
             # remove the tdnf cache directory and the swapfile.
381 381
             process = subprocess.Popen(['rm', '-rf', os.path.join(self.photon_root, "cache")], stdout=self.output)
382
+            retval = process.wait()
382 383
 
383
-    def install_package(self,  package_name):
384
-        rpm_params = ''
384
+    def install_package(self,  rpm_file_names):
385 385
 
386
-        os.environ["RPMROOT"] = self.rpm_path
387
-        rpm_params = rpm_params + ' --force '
388
-        rpm_params = rpm_params + ' --root ' + self.photon_root
389
-        rpm_params = rpm_params + ' --dbpath /var/lib/rpm '
386
+        rpms = set(rpm_file_names)
387
+        rpm_paths = []
388
+        for root, dirs, files in os.walk(self.rpm_path):
389
+            for f in files:
390
+                if f in rpms:
391
+                    rpm_paths.append(os.path.join(root, f))
390 392
 
391
-        if ('type' in self.install_config and (self.install_config['type'] in ['micro', 'minimal'])) or self.install_config['iso_system']:
392
-            rpm_params = rpm_params + ' --excludedocs '
393
+        rpm_params = ['--root', self.photon_root, '--dbpath', '/var/lib/rpm']
393 394
 
394
-        process = subprocess.Popen([self.install_package_command, '-w', self.photon_root, package_name, rpm_params],  stdout=self.output)
395
+        if ('type' in self.install_config and (self.install_config['type'] in ['micro', 'minimal'])) or self.install_config['iso_system']:
396
+            rpm_params.append('--excludedocs')
395 397
 
398
+        modules.commons.log(modules.commons.LOG_INFO, "installing packages {0}, with params {1}".format(rpm_paths, rpm_params))
399
+        process = subprocess.Popen(['rpm', '-Uvh'] + rpm_params + rpm_paths, stderr=subprocess.STDOUT)
396 400
         return process.wait()
397 401
 
398 402
     def execute_modules(self, phase):
... ...
@@ -43,7 +43,7 @@ EOF
43 43
 
44 44
 grub_mbr_install()
45 45
 {
46
-    $grubInstallCmd --force --boot-directory=$BUILDROOT/boot "$HDD"
46
+    $grubInstallCmd --target=i386-pc --force --boot-directory=$BUILDROOT/boot "$HDD"
47 47
 }
48 48
 
49 49
 set -o errexit        # exit if error...insurance ;)
... ...
@@ -221,6 +221,9 @@ class SpecParser(object):
221 221
             while i < totalContents:
222 222
                 dpkg = dependentPackageData()
223 223
                 compare=None
224
+                if listContents[i].startswith("/"):
225
+                    i=i+1
226
+                    continue
224 227
                 if i+2 < len(listContents):
225 228
                     if listContents[i+1] == ">=":
226 229
                         compare="gte"
... ...
@@ -247,6 +247,9 @@ class SpecParser(object):
247 247
             while i < totalContents:
248 248
                 dpkg = dependentPackageData()
249 249
                 compare=None
250
+                if listContents[i].startswith("/"):
251
+                    i=i+1
252
+                    continue
250 253
                 if i+2 < len(listContents):
251 254
                     if listContents[i+1] == ">=":
252 255
                         compare="gte"
... ...
@@ -127,12 +127,13 @@ class constants(object):
127 127
         "gcc",
128 128
         "pkg-config",
129 129
         "ncurses",
130
+        "ncurses-libs",
131
+        "ncurses-devel",
130 132
         "bash",
131 133
         "bzip2",
132 134
         "bzip2-libs",
133 135
         "bzip2-devel",
134 136
         "sed",
135
-        "ncurses-devel",
136 137
         "procps-ng",
137 138
         "coreutils",
138 139
         "m4",
... ...
@@ -248,6 +249,7 @@ class constants(object):
248 248
         "glibc-tools",
249 249
         "bzip2-libs",
250 250
         "expat-libs",
251
+        "ncurses-libs",
251 252
         "util-linux-libs",
252 253
         "nss-libs",
253 254
         "xz-libs",