Change-Id: Ice33ad7bc111149eb190ffae4f77e976d46bdad7
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1816
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Divya Thaluru <dthaluru@vmware.com>
... | ... |
@@ -91,14 +91,13 @@ micro-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES_MICRO) |
91 | 91 |
packages-micro: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) generate-dep-lists |
92 | 92 |
@echo "Building all Micro RPMS..." |
93 | 93 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
94 |
- $(PHOTON_PACKAGE_BUILDER) -o full \ |
|
94 |
+ $(PHOTON_PACKAGE_BUILDER) \ |
|
95 | 95 |
-s $(PHOTON_SPECS_DIR) \ |
96 | 96 |
-r $(PHOTON_RPMS_DIR) \ |
97 | 97 |
-x $(PHOTON_SRCS_DIR) \ |
98 | 98 |
-b $(PHOTON_CHROOT_PATH) \ |
99 | 99 |
-l $(PHOTON_LOGS_DIR) \ |
100 | 100 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
101 |
- -j $(PHOTON_GENERATED_DATA_DIR)/$(MICRO_PACKAGE_LIST_FILE) \ |
|
102 | 101 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
103 | 102 |
-d $(PHOTON_DIST_TAG) \ |
104 | 103 |
-n $(PHOTON_BUILD_NUMBER) \ |
... | ... |
@@ -154,14 +153,13 @@ live-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL) minimal-iso |
154 | 154 |
packages-minimal: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) generate-dep-lists |
155 | 155 |
@echo "Building all RPMS..." |
156 | 156 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
157 |
- $(PHOTON_PACKAGE_BUILDER) -o full \ |
|
157 |
+ $(PHOTON_PACKAGE_BUILDER) \ |
|
158 | 158 |
-s $(PHOTON_SPECS_DIR) \ |
159 | 159 |
-r $(PHOTON_RPMS_DIR) \ |
160 | 160 |
-x $(PHOTON_SRCS_DIR) \ |
161 | 161 |
-b $(PHOTON_CHROOT_PATH) \ |
162 | 162 |
-l $(PHOTON_LOGS_DIR) \ |
163 | 163 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
164 |
- -j $(PHOTON_GENERATED_DATA_DIR)/$(MINIMAL_PACKAGE_LIST_FILE) \ |
|
165 | 164 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
166 | 165 |
-d $(PHOTON_DIST_TAG) \ |
167 | 166 |
-n $(PHOTON_BUILD_NUMBER) \ |
... | ... |
@@ -211,8 +209,6 @@ src-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
211 | 211 |
-p $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
212 | 212 |
-o $(PHOTON_STAGE)/common/data \ |
213 | 213 |
-s $(PHOTON_DATA_DIR) \ |
214 |
- -u $(PHOTON_DATA_DIR)/pkg_info.json\ |
|
215 |
- -z $(PHOTON_STAGE)/pkg_info.txt\ |
|
216 | 214 |
-f > \ |
217 | 215 |
$(PHOTON_LOGS_DIR)/sourceiso-installer.log 2>&1 |
218 | 216 |
|
... | ... |
@@ -226,12 +222,12 @@ imgtree: |
226 | 226 |
|
227 | 227 |
who-needs: |
228 | 228 |
@cd $(PHOTON_SPECDEPS_DIR) && \ |
229 |
- $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i who-needs -p $(pkg) |
|
229 |
+ $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i who-needs -p $(pkg) |
|
230 | 230 |
|
231 | 231 |
packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
232 | 232 |
@echo "Building all RPMS..." |
233 | 233 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
234 |
- $(PHOTON_PACKAGE_BUILDER) -o full \ |
|
234 |
+ $(PHOTON_PACKAGE_BUILDER) \ |
|
235 | 235 |
-s $(PHOTON_SPECS_DIR) \ |
236 | 236 |
-r $(PHOTON_RPMS_DIR) \ |
237 | 237 |
-a $(PHOTON_SRPMS_DIR) \ |
... | ... |
@@ -239,12 +235,11 @@ packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $ |
239 | 239 |
-b $(PHOTON_CHROOT_PATH) \ |
240 | 240 |
-l $(PHOTON_LOGS_DIR) \ |
241 | 241 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
242 |
- -j $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
243 | 242 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
244 | 243 |
-d $(PHOTON_DIST_TAG) \ |
245 | 244 |
-n $(PHOTON_BUILD_NUMBER) \ |
246 | 245 |
-v $(PHOTON_RELEASE_VERSION) \ |
247 |
- -w $(PHOTON_DATA_DIR)/pkg_info.json \ |
|
246 |
+ -w $(PHOTON_STAGE)/pkg_info.json \ |
|
248 | 247 |
-g $(PHOTON_DATA_DIR)/pkg_build_options.json \ |
249 | 248 |
$(PHOTON_RPMCHECK_FLAGS) \ |
250 | 249 |
-t ${THREADS} |
... | ... |
@@ -252,14 +247,13 @@ packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $ |
252 | 252 |
updated-packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
253 | 253 |
@echo "Building only updated RPMS..." |
254 | 254 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
255 |
- $(PHOTON_PACKAGE_BUILDER) -o full \ |
|
255 |
+ $(PHOTON_PACKAGE_BUILDER) \ |
|
256 | 256 |
-s $(PHOTON_SPECS_DIR) \ |
257 | 257 |
-r $(PHOTON_UPDATED_RPMS_DIR) \ |
258 | 258 |
-x $(PHOTON_SRCS_DIR) \ |
259 | 259 |
-b $(PHOTON_CHROOT_PATH) \ |
260 | 260 |
-l $(PHOTON_LOGS_DIR) \ |
261 | 261 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
262 |
- -j $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
263 | 262 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
264 | 263 |
-d $(PHOTON_DIST_TAG) \ |
265 | 264 |
-n $(PHOTON_BUILD_NUMBER) \ |
... | ... |
@@ -271,7 +265,7 @@ updated-packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SO |
271 | 271 |
tool-chain-stage1: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
272 | 272 |
@echo "Building all RPMS..." |
273 | 273 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
274 |
- $(PHOTON_PACKAGE_BUILDER) -o full \ |
|
274 |
+ $(PHOTON_PACKAGE_BUILDER) \ |
|
275 | 275 |
-s $(PHOTON_SPECS_DIR) \ |
276 | 276 |
-r $(PHOTON_RPMS_DIR) \ |
277 | 277 |
-a $(PHOTON_SRPMS_DIR) \ |
... | ... |
@@ -279,7 +273,6 @@ tool-chain-stage1: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_S |
279 | 279 |
-b $(PHOTON_CHROOT_PATH) \ |
280 | 280 |
-l $(PHOTON_LOGS_DIR) \ |
281 | 281 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
282 |
- -j $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
283 | 282 |
-t ${THREADS} \ |
284 | 283 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
285 | 284 |
-d $(PHOTON_DIST_TAG) \ |
... | ... |
@@ -291,7 +284,7 @@ tool-chain-stage1: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_S |
291 | 291 |
tool-chain-stage2: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
292 | 292 |
@echo "Building all RPMS..." |
293 | 293 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
294 |
- $(PHOTON_PACKAGE_BUILDER) -o full \ |
|
294 |
+ $(PHOTON_PACKAGE_BUILDER) \ |
|
295 | 295 |
-s $(PHOTON_SPECS_DIR) \ |
296 | 296 |
-r $(PHOTON_RPMS_DIR) \ |
297 | 297 |
-a $(PHOTON_SRPMS_DIR) \ |
... | ... |
@@ -299,7 +292,6 @@ tool-chain-stage2: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_S |
299 | 299 |
-b $(PHOTON_CHROOT_PATH) \ |
300 | 300 |
-l $(PHOTON_LOGS_DIR) \ |
301 | 301 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
302 |
- -j $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
303 | 302 |
-t ${THREADS} \ |
304 | 303 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
305 | 304 |
-d $(PHOTON_DIST_TAG) \ |
... | ... |
@@ -107,7 +107,7 @@ def create_additional_file_list_to_copy_in_iso(base_path, build_install_option): |
107 | 107 |
file_list = [] |
108 | 108 |
for install_option in options_sorted: |
109 | 109 |
if install_option[1].has_key("additional-files"): |
110 |
- file_list = file_list + map(lambda filename: os.path.join(base_path, filename), install_option[1].get("additional-files")) |
|
110 |
+ file_list = file_list + map(lambda filename: os.path.join(base_path, filename), install_option[1].get("additional-files")) |
|
111 | 111 |
return file_list |
112 | 112 |
|
113 | 113 |
def get_live_cd_status_string(build_install_option): |
... | ... |
@@ -121,21 +121,6 @@ def get_live_cd_status_string(build_install_option): |
121 | 121 |
return "true" |
122 | 122 |
return "false" |
123 | 123 |
|
124 |
-def generate_pkginfo_text_file(list_rpms, pkg_info_json_file_path, pkg_info_text_file_path): |
|
125 |
- if not os.path.isfile(pkg_info_json_file_path): |
|
126 |
- return |
|
127 |
- pkg_info_json_file = open(pkg_info_json_file_path,'r') |
|
128 |
- data = json.load(pkg_info_json_file) |
|
129 |
- pkg_info_json_file.close() |
|
130 |
- list_lines = [] |
|
131 |
- list_lines.append("#%{name},%{version},%{release},%{arch},%{sourcerpm}\n") |
|
132 |
- for rpm in list_rpms: |
|
133 |
- if data.has_key(rpm): |
|
134 |
- list_lines.append(data[rpm]["name"]+","+data[rpm]["version"]+","+data[rpm]["release"]+","+data[rpm]["arch"]+","+data[rpm]["sourcerpm"]+"\n") |
|
135 |
- pkg_info_text_file = open(pkg_info_text_file_path,'w') |
|
136 |
- pkg_info_text_file.writelines(list_lines) |
|
137 |
- pkg_info_text_file.close() |
|
138 |
- |
|
139 | 124 |
if __name__ == '__main__': |
140 | 125 |
usage = "Usage: %prog [options] <config file> <tools path>" |
141 | 126 |
parser = OptionParser(usage) |
... | ... |
@@ -153,8 +138,6 @@ if __name__ == '__main__': |
153 | 153 |
parser.add_option("-m", "--stage-path", dest="stage_path", default="../stage") |
154 | 154 |
parser.add_option("-c", "--dracut-configuration", dest="dracut_configuration_file", default="../common/data/dracut_configuration.json") |
155 | 155 |
parser.add_option("-s", "--json-data-path", dest="json_data_path", default="../stage/common/data/") |
156 |
- parser.add_option("-u", "--pkginfo-json-file", dest="pkginfo_json_file", default="../common/data/pkg_info.json") |
|
157 |
- parser.add_option("-z", "--pkginfo-txt-file", dest="pkginfo_txt_file", default="../stage/pkg_info.txt") |
|
158 | 156 |
|
159 | 157 |
(options, args) = parser.parse_args() |
160 | 158 |
if options.iso_path or options.src_iso_path: |
... | ... |
@@ -262,7 +245,6 @@ if __name__ == '__main__': |
262 | 262 |
list_rpms = rpm_list.split(" ") |
263 | 263 |
list_rpms = list(set(list_rpms)) |
264 | 264 |
list_rpms.sort() |
265 |
- generate_pkginfo_text_file(list_rpms, options.pkginfo_json_file, options.pkginfo_txt_file) |
|
266 | 265 |
|
267 | 266 |
# Cleaning up for vmdk |
268 | 267 |
if 'vmdk_install' in config and config['vmdk_install']: |
... | ... |
@@ -8,7 +8,7 @@ from constants import constants |
8 | 8 |
import shutil |
9 | 9 |
|
10 | 10 |
class PackageBuilder(object): |
11 |
- |
|
11 |
+ |
|
12 | 12 |
def __init__(self,mapPackageToCycles,listAvailableCyclicPackages,listBuildOptionPackages,pkgBuildOptionFile,logName=None,logPath=None): |
13 | 13 |
if logName is None: |
14 | 14 |
logName = "PackageBuilder" |
... | ... |
@@ -22,7 +22,7 @@ class PackageBuilder(object): |
22 | 22 |
self.listNodepsPackages = ["glibc","gmp","zlib","file","binutils","mpfr","mpc","gcc","ncurses","util-linux","groff","perl","texinfo","rpm","openssl","go"] |
23 | 23 |
self.listBuildOptionPackages=listBuildOptionPackages |
24 | 24 |
self.pkgBuildOptionFile=pkgBuildOptionFile |
25 |
- |
|
25 |
+ |
|
26 | 26 |
def prepareBuildRoot(self,chrootName): |
27 | 27 |
chrootID=None |
28 | 28 |
try: |
... | ... |
@@ -39,7 +39,7 @@ class PackageBuilder(object): |
39 | 39 |
chrUtils.destroyChroot(chrootID) |
40 | 40 |
raise e |
41 | 41 |
return chrootID |
42 |
- |
|
42 |
+ |
|
43 | 43 |
def findPackageNameFromRPMFile(self,rpmfile): |
44 | 44 |
rpmfile=os.path.basename(rpmfile) |
45 | 45 |
releaseindex=rpmfile.rfind("-") |
... | ... |
@@ -52,7 +52,7 @@ class PackageBuilder(object): |
52 | 52 |
return None |
53 | 53 |
packageName=rpmfile[0:versionindex] |
54 | 54 |
return packageName |
55 |
- |
|
55 |
+ |
|
56 | 56 |
def findInstalledPackages(self,chrootID): |
57 | 57 |
pkgUtils = PackageUtils(self.logName,self.logPath) |
58 | 58 |
listInstalledRPMs=pkgUtils.findInstalledRPMPackages(chrootID) |
... | ... |
@@ -62,7 +62,7 @@ class PackageBuilder(object): |
62 | 62 |
if packageName is not None: |
63 | 63 |
listInstalledPackages.append(packageName) |
64 | 64 |
return listInstalledPackages |
65 |
- |
|
65 |
+ |
|
66 | 66 |
def buildPackageThreadAPI(self,package,outputMap, threadName,): |
67 | 67 |
try: |
68 | 68 |
self.buildPackage(package) |
... | ... |
@@ -82,7 +82,7 @@ class PackageBuilder(object): |
82 | 82 |
break |
83 | 83 |
return packageIsAlreadyBuilt |
84 | 84 |
|
85 |
- def buildPackage(self,package): |
|
85 |
+ def buildPackage(self, package): |
|
86 | 86 |
#do not build if RPM is already built |
87 | 87 |
#test only if the package is in the testForceRPMS with rpmCheck |
88 | 88 |
#build only if the package is not in the testForceRPMS with rpmCheck |
... | ... |
@@ -131,16 +131,16 @@ class PackageBuilder(object): |
131 | 131 |
raise e |
132 | 132 |
if chrootID is not None: |
133 | 133 |
chrUtils.destroyChroot(chrootID) |
134 |
- |
|
135 |
- |
|
134 |
+ |
|
135 |
+ |
|
136 | 136 |
def findRunTimeRequiredRPMPackages(self,rpmPackage): |
137 | 137 |
listRequiredPackages=constants.specData.getRequiresForPackage(rpmPackage) |
138 | 138 |
return listRequiredPackages |
139 |
- |
|
139 |
+ |
|
140 | 140 |
def findBuildTimeRequiredPackages(self,package): |
141 | 141 |
listRequiredPackages=constants.specData.getBuildRequiresForPackage(package) |
142 | 142 |
return listRequiredPackages |
143 |
- |
|
143 |
+ |
|
144 | 144 |
def installPackage(self,pkgUtils,package,chrootID,destLogPath,listInstalledPackages): |
145 | 145 |
if package in listInstalledPackages: |
146 | 146 |
return |
... | ... |
@@ -3,42 +3,56 @@ from Logger import Logger |
3 | 3 |
from constants import constants |
4 | 4 |
import os.path |
5 | 5 |
from CommandUtils import CommandUtils |
6 |
+from PackageUtils import PackageUtils |
|
6 | 7 |
|
7 |
-class SourcePackageInfo(object): |
|
8 |
- sourcePkgList = {} |
|
9 |
- logger = None |
|
8 |
+class PackageInfo(object): |
|
10 | 9 |
|
11 |
- |
|
12 |
- @staticmethod |
|
13 |
- def setLogging(logName=None,logPath=None): |
|
10 |
+ def __init__(self, logName=None, logPath=None): |
|
14 | 11 |
if logName is None: |
15 |
- logName = "SourcePackageInfo" |
|
12 |
+ logName = "PackageInfo" |
|
16 | 13 |
if logPath is None: |
17 | 14 |
logPath = constants.logPath |
18 |
- SourcePackageInfo.logger=Logger.getLogger(logName,logPath) |
|
19 |
- |
|
20 |
- @staticmethod |
|
21 |
- def loadPkgInfoFromFile(filePath): |
|
22 |
- SourcePackageInfo.logger.info("Loading source package list from the json file") |
|
23 |
- if not os.path.isfile(filePath): |
|
24 |
- return |
|
25 |
- pkgInfoFile = open(filePath,'r') |
|
26 |
- SourcePackageInfo.sourcePkgList = json.load(pkgInfoFile) |
|
27 |
- pkgInfoFile.close() |
|
15 |
+ self.logName=logName |
|
16 |
+ self.logPath=logPath |
|
17 |
+ self.logger=Logger.getLogger(logName,logPath) |
|
18 |
+ self.pkgList = {} |
|
28 | 19 |
|
29 |
- @staticmethod |
|
30 |
- def addSRPMData(packageName,version,release,arch,srpmFile): |
|
31 |
- listPkgAttributes={"name":packageName,"version":version,"release":release,"arch":arch,"sourcerpm":srpmFile} |
|
32 |
- SourcePackageInfo.sourcePkgList[packageName]=listPkgAttributes |
|
33 |
- SourcePackageInfo.logger.info("Added source package to the list:"+packageName) |
|
20 |
+ def loadPackagesData(self): |
|
21 |
+ listPackages = constants.specData.getListPackages() |
|
22 |
+ listPackages.sort() |
|
23 |
+ listRPMFiles = [] |
|
24 |
+ cmdUtils = CommandUtils() |
|
25 |
+ for package in listPackages: |
|
26 |
+ release = constants.specData.getRelease(package) |
|
27 |
+ version = constants.specData.getVersion(package) |
|
28 |
+ listRPMPackages = constants.specData.getRPMPackages(package) |
|
29 |
+ srpmFileName = package+"-"+version+"-"+release+".src.rpm" |
|
30 |
+ srpmFiles = cmdUtils.findFile(srpmFileName, constants.sourceRpmPath) |
|
31 |
+ srpmFile = None |
|
32 |
+ if len(srpmFiles) == 1: |
|
33 |
+ srpmFile = srpmFiles[0] |
|
34 |
+ debugrpmFileName = package+"-debuginfo-"+version+"-"+release+"*" |
|
35 |
+ debugrpmFiles = cmdUtils.findFile(debugrpmFileName, constants.rpmPath) |
|
36 |
+ debugrpmFile = None |
|
37 |
+ if len(debugrpmFiles) == 1: |
|
38 |
+ debugrpmFile = debugrpmFiles[0] |
|
39 |
+ pkgUtils = PackageUtils(self.logName,self.logPath) |
|
40 |
+ for rpmPkg in listRPMPackages: |
|
41 |
+ rpmFile = pkgUtils.findRPMFileForGivenPackage(rpmPkg) |
|
42 |
+ if rpmFile is not None: |
|
43 |
+ listRPMFiles.append(rpmFile) |
|
44 |
+ listPkgAttributes = {"sourcerpm":srpmFile, "rpm":rpmFile, "debugrpm":debugrpmFile} |
|
45 |
+ self.pkgList[rpmPkg] = listPkgAttributes |
|
46 |
+ self.logger.debug("Added "+rpmPkg +" rpm package to the list") |
|
47 |
+ else: |
|
48 |
+ self.logger.error("Missing rpm file for package:"+rpmPkg) |
|
34 | 49 |
|
35 |
- @staticmethod |
|
36 |
- def writePkgListToFile(fileName): |
|
37 |
- SourcePackageInfo.logger.info("Writing source package list to the json file") |
|
50 |
+ def writePkgListToFile(self, fileName): |
|
51 |
+ self.logger.info("Writing package list to the json file") |
|
38 | 52 |
cmdUtils=CommandUtils() |
39 | 53 |
dirPath=os.path.basename(fileName) |
40 | 54 |
if not os.path.isdir(dirPath): |
41 | 55 |
cmdUtils.runCommandInShell("mkdir -p "+dirPath) |
42 | 56 |
pkgInfoFile = open(fileName,'w+') |
43 |
- json.dump(SourcePackageInfo.sourcePkgList, pkgInfoFile,indent=4) |
|
57 |
+ json.dump(self.pkgList, pkgInfoFile, indent=4) |
|
44 | 58 |
pkgInfoFile.close() |
... | ... |
@@ -6,12 +6,11 @@ from constants import constants |
6 | 6 |
import re |
7 | 7 |
from time import sleep |
8 | 8 |
import PullSources |
9 |
-from PackageInfo import SourcePackageInfo |
|
10 | 9 |
import json |
11 | 10 |
import collections |
12 | 11 |
|
13 | 12 |
class PackageUtils(object): |
14 |
- |
|
13 |
+ |
|
15 | 14 |
def __init__(self,logName=None,logPath=None): |
16 | 15 |
if logName is None: |
17 | 16 |
self.logName = "PackageUtils" |
... | ... |
@@ -24,7 +23,7 @@ class PackageUtils(object): |
24 | 24 |
self.rpmBinary = "rpm" |
25 | 25 |
self.installRPMPackageOptions = "-Uvh" |
26 | 26 |
self.nodepsRPMPackageOptions = "--nodeps" |
27 |
- |
|
27 |
+ |
|
28 | 28 |
self.rpmbuildBinary = "rpmbuild" |
29 | 29 |
self.rpmbuildBuildallOption = "-ba --clean" |
30 | 30 |
self.rpmbuildNocheckOption = "--nocheck" |
... | ... |
@@ -37,7 +36,7 @@ class PackageUtils(object): |
37 | 37 |
self.packagesToInstallInAOneShot="" |
38 | 38 |
self.noDepsRPMFilesToInstallInAOneShot="" |
39 | 39 |
self.noDepsPackagesToInstallInAOneShot="" |
40 |
- |
|
40 |
+ |
|
41 | 41 |
def getRPMArch(self,rpmName): |
42 | 42 |
arch="" |
43 | 43 |
if rpmName.find("x86_64") != -1: |
... | ... |
@@ -50,7 +49,7 @@ class PackageUtils(object): |
50 | 50 |
arch = self.getRPMArch(rpmName) |
51 | 51 |
rpmDestDir=rpmDir+"/"+arch |
52 | 52 |
return rpmDestDir |
53 |
- |
|
53 |
+ |
|
54 | 54 |
def copyRPM(self,rpmFile,destDir): |
55 | 55 |
cmdUtils = CommandUtils() |
56 | 56 |
rpmName=os.path.basename(rpmFile) |
... | ... |
@@ -61,11 +60,11 @@ class PackageUtils(object): |
61 | 61 |
cmdUtils.runCommandInShell("mkdir -p "+rpmDestDir) |
62 | 62 |
shutil.copyfile(rpmFile, rpmDestPath) |
63 | 63 |
return rpmDestPath |
64 |
- |
|
64 |
+ |
|
65 | 65 |
def installRPM(self,package,chrootID,noDeps=False,destLogPath=None): |
66 | 66 |
# self.logger.info("Installing rpm for package:"+package) |
67 | 67 |
# self.logger.debug("No deps:"+str(noDeps)) |
68 |
- |
|
68 |
+ |
|
69 | 69 |
rpmfile=self.findRPMFileForGivenPackage(package) |
70 | 70 |
if rpmfile is None: |
71 | 71 |
self.logger.error("No rpm file found for package:"+package) |
... | ... |
@@ -79,7 +78,7 @@ class PackageUtils(object): |
79 | 79 |
else: |
80 | 80 |
self.rpmFilesToInstallInAOneShot += " " + rpmFile |
81 | 81 |
self.packagesToInstallInAOneShot += " " + package |
82 |
- |
|
82 |
+ |
|
83 | 83 |
def installRPMSInAOneShot(self,chrootID,destLogPath): |
84 | 84 |
chrootCmd=self.runInChrootCommand+" "+chrootID |
85 | 85 |
rpmInstallcmd=self.rpmBinary+" "+ self.installRPMPackageOptions |
... | ... |
@@ -105,8 +104,8 @@ class PackageUtils(object): |
105 | 105 |
if not returnVal: |
106 | 106 |
self.logger.error("Unable to install rpms") |
107 | 107 |
raise Exception("RPM installation failed") |
108 |
- |
|
109 |
- |
|
108 |
+ |
|
109 |
+ |
|
110 | 110 |
def copySourcesTobuildroot(self,listSourceFiles,package,destDir): |
111 | 111 |
cmdUtils = CommandUtils() |
112 | 112 |
for source in listSourceFiles: |
... | ... |
@@ -134,7 +133,7 @@ class PackageUtils(object): |
134 | 134 |
raise Exception("Multiple sources found") |
135 | 135 |
self.logger.info("Copying... Source path :" + source + " Source filename: " + sourcePath[0]) |
136 | 136 |
shutil.copy2(sourcePath[0], destDir) |
137 |
- |
|
137 |
+ |
|
138 | 138 |
def copyAdditionalBuildFiles(self,listAdditionalFiles,chrootID): |
139 | 139 |
cmdUtils = CommandUtils() |
140 | 140 |
for additionalFile in listAdditionalFiles: |
... | ... |
@@ -145,7 +144,7 @@ class PackageUtils(object): |
145 | 145 |
shutil.copy(source, destDir) |
146 | 146 |
else: |
147 | 147 |
shutil.copytree(source, destDir) |
148 |
- |
|
148 |
+ |
|
149 | 149 |
def buildRPMSForGivenPackage(self,package,chrootID,listBuildOptionPackages,pkgBuildOptionFile,destLogPath=None): |
150 | 150 |
self.logger.info("Building rpm's for package:"+package) |
151 | 151 |
|
... | ... |
@@ -153,13 +152,13 @@ class PackageUtils(object): |
153 | 153 |
listPatchFiles = constants.specData.getPatches(package) |
154 | 154 |
specFile = constants.specData.getSpecFile(package) |
155 | 155 |
specName = constants.specData.getSpecName(package) + ".spec" |
156 |
- |
|
156 |
+ |
|
157 | 157 |
chrootSourcePath=chrootID+constants.topDirPath+"/SOURCES/" |
158 | 158 |
chrootSpecPath=constants.topDirPath+"/SPECS/" |
159 | 159 |
chrootLogsFilePath=chrootID+constants.topDirPath+"/LOGS/"+package+".log" |
160 | 160 |
chrootCmd=self.runInChrootCommand+" "+chrootID |
161 | 161 |
shutil.copyfile(specFile, chrootID+chrootSpecPath+specName ) |
162 |
- |
|
162 |
+ |
|
163 | 163 |
# FIXME: some sources are located in SPECS/.. how to mount? |
164 | 164 |
# if os.geteuid()==0: |
165 | 165 |
self.copySourcesTobuildroot(listSourcesFiles,package,chrootSourcePath) |
... | ... |
@@ -181,7 +180,7 @@ class PackageUtils(object): |
181 | 181 |
macrolist = pkg[1]["macros"] |
182 | 182 |
for macro in macrolist: |
183 | 183 |
macros.append(str(macro.encode('utf-8'))) |
184 |
- |
|
184 |
+ |
|
185 | 185 |
self.copyAdditionalBuildFiles(listAdditionalFiles,chrootID) |
186 | 186 |
|
187 | 187 |
#Adding rpm macros |
... | ... |
@@ -210,17 +209,12 @@ class PackageUtils(object): |
210 | 210 |
|
211 | 211 |
for rpmFile in listRPMFiles: |
212 | 212 |
self.copyRPM(chrootID+"/"+rpmFile, constants.rpmPath) |
213 |
- |
|
213 |
+ |
|
214 | 214 |
for srpmFile in listSRPMFiles: |
215 |
- self.copyRPM(chrootID+"/"+srpmFile, constants.sourceRpmPath) |
|
216 |
- srpmName = os.path.basename(srpmFile) |
|
217 |
- package,version,release = self.findPackageInfoFromSourceRPMFile(srpmFile) |
|
218 |
- arch = self.getRPMArch(listRPMFiles[0]) |
|
219 |
- SourcePackageInfo.addSRPMData(package,version,release,arch,srpmName) |
|
215 |
+ srpmDestFile = self.copyRPM(chrootID+"/"+srpmFile, constants.sourceRpmPath) |
|
220 | 216 |
|
221 |
- |
|
222 | 217 |
def buildRPM(self,specFile,logFile,chrootCmd,package,macros): |
223 |
- |
|
218 |
+ |
|
224 | 219 |
rpmBuildcmd=self.rpmbuildBinary+" "+self.rpmbuildBuildallOption+" "+self.rpmbuildDistOption |
225 | 220 |
|
226 | 221 |
if constants.rpmCheck and package in constants.testForceRPMS: |
... | ... |
@@ -238,7 +232,7 @@ class PackageUtils(object): |
238 | 238 |
for macro in macros: |
239 | 239 |
rpmBuildcmd+=' --define \\\"%s\\\"' % macro |
240 | 240 |
rpmBuildcmd+=" "+specFile |
241 |
- |
|
241 |
+ |
|
242 | 242 |
cmdUtils = CommandUtils() |
243 | 243 |
self.logger.info("Building rpm....") |
244 | 244 |
self.logger.info(rpmBuildcmd) |
... | ... |
@@ -273,8 +267,8 @@ class PackageUtils(object): |
273 | 273 |
listRPMFiles.append(listcontents[1]) |
274 | 274 |
if (len(listcontents) == 2) and listcontents[1].strip()[-8:] == ".src.rpm" and listcontents[1].find("/SRPMS/") != -1: |
275 | 275 |
listSRPMFiles.append(listcontents[1]) |
276 |
- return listRPMFiles,listSRPMFiles |
|
277 |
- |
|
276 |
+ return listRPMFiles,listSRPMFiles |
|
277 |
+ |
|
278 | 278 |
def findRPMFileForGivenPackage(self,package): |
279 | 279 |
cmdUtils = CommandUtils() |
280 | 280 |
version = constants.specData.getVersion(package) |
... | ... |
@@ -283,7 +277,7 @@ class PackageUtils(object): |
283 | 283 |
cmdUtils.findFile(package+"-"+version+"-"+release+".noarch.rpm",constants.rpmPath)], []) |
284 | 284 |
if constants.inputRPMSPath is not None: |
285 | 285 |
listFoundRPMFiles = sum([cmdUtils.findFile(package+"-"+version+"-"+release+".x86_64.rpm",constants.inputRPMSPath), |
286 |
- cmdUtils.findFile(package+"-"+version+"-"+release+".noarch.rpm",constants.inputRPMSPath)], listFoundRPMFiles) |
|
286 |
+ cmdUtils.findFile(package+"-"+version+"-"+release+".noarch.rpm",constants.inputRPMSPath)], listFoundRPMFiles) |
|
287 | 287 |
if len(listFoundRPMFiles) == 1 : |
288 | 288 |
return listFoundRPMFiles[0] |
289 | 289 |
if len(listFoundRPMFiles) == 0 : |
... | ... |
@@ -291,7 +285,7 @@ class PackageUtils(object): |
291 | 291 |
if len(listFoundRPMFiles) > 1 : |
292 | 292 |
self.logger.error("Found multiple rpm files for given package in rpm directory.Unable to determine the rpm file for package:"+package) |
293 | 293 |
raise Exception("Multiple rpm files found") |
294 |
- |
|
294 |
+ |
|
295 | 295 |
def findPackageNameFromRPMFile(self,rpmfile): |
296 | 296 |
rpmfile=os.path.basename(rpmfile) |
297 | 297 |
releaseindex=rpmfile.rfind("-") |
... | ... |
@@ -303,7 +297,7 @@ class PackageUtils(object): |
303 | 303 |
self.logger.error("Invalid rpm file:"+rpmfile) |
304 | 304 |
raise Exception("Invalid RPM") |
305 | 305 |
packageName=rpmfile[0:versionindex] |
306 |
- return packageName |
|
306 |
+ return packageName |
|
307 | 307 |
|
308 | 308 |
def findPackageInfoFromRPMFile(self,rpmfile): |
309 | 309 |
rpmfile=os.path.basename(rpmfile) |
... | ... |
@@ -322,22 +316,6 @@ class PackageUtils(object): |
322 | 322 |
release=rpmfile[releaseindex+1:] |
323 | 323 |
return packageName,version,release |
324 | 324 |
|
325 |
- def findPackageInfoFromSourceRPMFile(self,sourcerpmfile): |
|
326 |
- sourcerpmfile=os.path.basename(sourcerpmfile) |
|
327 |
- sourcerpmfile=sourcerpmfile.replace(".src.rpm","") |
|
328 |
- releaseindex=sourcerpmfile.rfind("-") |
|
329 |
- if releaseindex == -1: |
|
330 |
- self.logger.error("Invalid source rpm file:"+sourcerpmfile) |
|
331 |
- raise Exception("Invalid Source RPM") |
|
332 |
- versionindex=sourcerpmfile[0:releaseindex].rfind("-") |
|
333 |
- if versionindex == -1: |
|
334 |
- self.logger.error("Invalid source rpm file:"+sourcerpmfile) |
|
335 |
- raise Exception("Invalid source RPM") |
|
336 |
- packageName=sourcerpmfile[0:versionindex] |
|
337 |
- version=sourcerpmfile[versionindex+1:releaseindex] |
|
338 |
- release=sourcerpmfile[releaseindex+1:] |
|
339 |
- return packageName,version,release |
|
340 |
- |
|
341 | 325 |
def findInstalledRPMPackages(self, chrootID): |
342 | 326 |
cmd = self.rpmBinary+" "+self.queryRpmPackageOptions |
343 | 327 |
chrootCmd=self.runInChrootCommand+" "+chrootID |
... | ... |
@@ -56,16 +56,16 @@ class SerializableSpecObjectsUtils(object): |
56 | 56 |
specObj.url=spec.getURL() |
57 | 57 |
specObj.sourceurl=spec.getSourceURL() |
58 | 58 |
for specPkg in specObj.listPackages: |
59 |
- if specPkg in self.mapPackageToSpec: |
|
60 |
- existingObj = self.mapSerializableSpecObjects[self.mapPackageToSpec[specPkg]] |
|
61 |
- if self.compareVersions(existingObj,specObj) == 1: |
|
62 |
- skipUpdating = True |
|
63 |
- break; |
|
59 |
+ if specPkg in self.mapPackageToSpec: |
|
60 |
+ existingObj = self.mapSerializableSpecObjects[self.mapPackageToSpec[specPkg]] |
|
61 |
+ if self.compareVersions(existingObj,specObj) == 1: |
|
62 |
+ skipUpdating = True |
|
63 |
+ break; |
|
64 | 64 |
specObj.installRequiresPackages[specPkg]=spec.getRequires(specPkg) |
65 |
- self.mapPackageToSpec[specPkg]=specName |
|
65 |
+ self.mapPackageToSpec[specPkg]=specName |
|
66 | 66 |
if spec.getIsRPMPackage(specPkg): |
67 | 67 |
specObj.listRPMPackages.append(specPkg) |
68 |
- if skipUpdating == False: |
|
68 |
+ if skipUpdating == False: |
|
69 | 69 |
self.mapSerializableSpecObjects[specName]=specObj |
70 | 70 |
|
71 | 71 |
def getListSpecFiles(self,listSpecFiles,path): |
... | ... |
@@ -205,7 +205,7 @@ class SerializableSpecObjectsUtils(object): |
205 | 205 |
specName=self.getSpecName(package) |
206 | 206 |
return self.mapSerializableSpecObjects[specName].isCheckAvailable |
207 | 207 |
|
208 |
- def getListSpecs(self): |
|
208 |
+ def getListPackages(self): |
|
209 | 209 |
return self.mapSerializableSpecObjects.keys() |
210 | 210 |
|
211 | 211 |
def getURL(self, package): |
... | ... |
@@ -12,7 +12,7 @@ from SpecUtils import Specutils |
12 | 12 |
from StringUtils import StringUtils |
13 | 13 |
import collections |
14 | 14 |
import traceback |
15 |
-from PackageInfo import SourcePackageInfo |
|
15 |
+from PackageInfo import PackageInfo |
|
16 | 16 |
|
17 | 17 |
def main(): |
18 | 18 |
usage = "Usage: %prog [options] <package name>" |
... | ... |
@@ -23,9 +23,7 @@ def main(): |
23 | 23 |
parser.add_option("-i", "--install-package", dest="installPackage", default=False, action ="store_true") |
24 | 24 |
parser.add_option("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="../../stage/PUBLISHRPMS") |
25 | 25 |
parser.add_option("-l", "--log-path", dest="logPath", default="../../stage/LOGS") |
26 |
- parser.add_option("-o", "--build-option", dest="buildOption", default="full") |
|
27 | 26 |
parser.add_option("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") |
28 |
- parser.add_option("-j", "--json-file", dest="inputJSONFile", default="../../common/data/build_install_options_all.json") |
|
29 | 27 |
parser.add_option("-b", "--build-root-path", dest="buildRootPath", default="/mnt") |
30 | 28 |
parser.add_option("-t", "--threads", dest="buildThreads", default=1, type="int", help="Number of working threads") |
31 | 29 |
parser.add_option("-m", "--tool-chain-stage", dest="toolChainStage", default="None") |
... | ... |
@@ -36,7 +34,7 @@ def main(): |
36 | 36 |
parser.add_option("-v", "--release-version", dest="releaseVersion", default="NNNnNNN") |
37 | 37 |
parser.add_option("-u", "--enable-rpmcheck", dest="rpmCheck", default=False, action ="store_true") |
38 | 38 |
parser.add_option("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS") |
39 |
- parser.add_option("-w", "--pkginfo-file", dest="pkgInfoFile", default="../../common/data/pkg_info.json") |
|
39 |
+ parser.add_option("-w", "--pkginfo-file", dest="pkgInfoFile", default="../../stage/pkg_info.json") |
|
40 | 40 |
parser.add_option("-g", "--pkg-build-option-file", dest="pkgBuildOptionFile", default="../../common/data/pkg_build_options.json") |
41 | 41 |
parser.add_option("-q", "--rpmcheck-stop-on-error", dest="rpmCheckStopOnError", default=False, action ="store_true") |
42 | 42 |
|
... | ... |
@@ -49,7 +47,7 @@ def main(): |
49 | 49 |
|
50 | 50 |
errorFlag=False |
51 | 51 |
package = None |
52 |
- pkgInfoJsonFile=options.pkgInfoFile |
|
52 |
+ pkgInfoJsonFile = options.pkgInfoFile |
|
53 | 53 |
if not os.path.isdir(options.sourcePath): |
54 | 54 |
logger.error("Given Sources Path is not a directory:"+options.sourcePath) |
55 | 55 |
errorFlag = True |
... | ... |
@@ -66,9 +64,6 @@ def main(): |
66 | 66 |
logger.error("Given RPMS Path is missing noarch sub-directory:"+options.publishRPMSPath) |
67 | 67 |
errorFlag = True |
68 | 68 |
|
69 |
- if not os.path.isfile(options.inputJSONFile) and not options.installPackage: |
|
70 |
- logger.error("Given JSON File is not a file:"+options.inputJSONFile) |
|
71 |
- errorFlag = True |
|
72 | 69 |
if not os.path.isfile(options.pkgBuildOptionFile): |
73 | 70 |
logger.warning("Given JSON File is not a file:"+options.pkgBuildOptionFile) |
74 | 71 |
|
... | ... |
@@ -105,19 +100,15 @@ def main(): |
105 | 105 |
logger.info("Top Dir Path :" + options.topDirPath) |
106 | 106 |
logger.info("Publish RPMS Path :" + options.publishRPMSPath) |
107 | 107 |
|
108 |
- if not options.installPackage: |
|
109 |
- logger.info("JSON File :" + options.inputJSONFile) |
|
110 |
- else: |
|
108 |
+ if options.installPackage: |
|
111 | 109 |
logger.info("Package to build:"+package) |
112 | 110 |
|
113 | 111 |
listBuildOptionPackages = get_packages_with_build_options(options.pkgBuildOptionFile) |
114 | 112 |
|
115 | 113 |
try: |
116 | 114 |
constants.initialize(options) |
117 |
- SourcePackageInfo.setLogging() |
|
118 |
- SourcePackageInfo.loadPkgInfoFromFile(pkgInfoJsonFile) |
|
119 | 115 |
if package == "packages_list": |
120 |
- buildPackagesList(options.specPath, options.buildRootPath+"/../packages_list.csv") |
|
116 |
+ buildPackagesList(options.buildRootPath+"/../packages_list.csv") |
|
121 | 117 |
elif package == "sources_list": |
122 | 118 |
if not os.path.isdir("../../stage/yaml_sources"): |
123 | 119 |
cmdUtils.runCommandInShell("mkdir -p ../../stage/yaml_sources") |
... | ... |
@@ -135,7 +126,7 @@ def main(): |
135 | 135 |
elif options.installPackage: |
136 | 136 |
buildAPackage(package, listBuildOptionPackages, options.pkgBuildOptionFile, options.buildThreads) |
137 | 137 |
else: |
138 |
- buildPackagesFromGivenJSONFile(options.inputJSONFile, options.buildOption, listBuildOptionPackages, options.pkgBuildOptionFile, logger, options.buildThreads) |
|
138 |
+ buildPackagesForAllSpecs(listBuildOptionPackages, options.pkgBuildOptionFile, logger, options.buildThreads, pkgInfoJsonFile) |
|
139 | 139 |
except Exception as e: |
140 | 140 |
logger.error("Caught an exception") |
141 | 141 |
logger.error(str(e)) |
... | ... |
@@ -143,22 +134,20 @@ def main(): |
143 | 143 |
traceback.print_exc() |
144 | 144 |
sys.exit(1) |
145 | 145 |
|
146 |
- logger.info("Writing Package info to the file:"+pkgInfoJsonFile) |
|
147 |
- SourcePackageInfo.writePkgListToFile(pkgInfoJsonFile) |
|
148 | 146 |
sys.exit(0) |
149 | 147 |
|
150 |
-def buildPackagesList(specPath, csvFilename): |
|
148 |
+def buildPackagesList(csvFilename): |
|
151 | 149 |
csvFile = open(csvFilename, "w") |
152 | 150 |
csvFile.write("Package,Version,License,URL,Sources,Patches\n") |
153 |
- listSpecs = constants.specData.getListSpecs() |
|
154 |
- listSpecs.sort() |
|
155 |
- for spec in listSpecs: |
|
156 |
- name = spec |
|
157 |
- version = constants.specData.getVersion(spec) |
|
158 |
- license = constants.specData.getLicense(spec) |
|
159 |
- listPatches = constants.specData.getPatches(spec) |
|
160 |
- url = constants.specData.getURL(spec) |
|
161 |
- listSourceNames = constants.specData.getSources(spec) |
|
151 |
+ listPackages = constants.specData.getListPackages() |
|
152 |
+ listPackages.sort() |
|
153 |
+ for package in listPackages: |
|
154 |
+ name = package |
|
155 |
+ version = constants.specData.getVersion(package) |
|
156 |
+ license = constants.specData.getLicense(package) |
|
157 |
+ listPatches = constants.specData.getPatches(package) |
|
158 |
+ url = constants.specData.getURL(package) |
|
159 |
+ listSourceNames = constants.specData.getSources(package) |
|
162 | 160 |
sources = "" |
163 | 161 |
patches = "" |
164 | 162 |
if listPatches is not None: |
... | ... |
@@ -172,25 +161,25 @@ def buildSourcesList(yamlDir, logger, singleFile=True): |
172 | 172 |
strUtils = StringUtils() |
173 | 173 |
if singleFile: |
174 | 174 |
yamlFile = open(yamlDir+"/sources_list.yaml", "w") |
175 |
- listSpecs = constants.specData.getListSpecs() |
|
176 |
- listSpecs.sort() |
|
175 |
+ listPackages = constants.specData.getListPackages() |
|
176 |
+ listPackages.sort() |
|
177 | 177 |
import PullSources |
178 |
- for spec in listSpecs: |
|
179 |
- ossname = spec |
|
180 |
- ossversion = constants.specData.getVersion(spec) |
|
178 |
+ for package in listPackages: |
|
179 |
+ ossname = package |
|
180 |
+ ossversion = constants.specData.getVersion(package) |
|
181 | 181 |
modified = False |
182 |
- listPatches = constants.specData.getPatches(spec) |
|
182 |
+ listPatches = constants.specData.getPatches(package) |
|
183 | 183 |
if listPatches is not None and len(listPatches) > 0 : |
184 | 184 |
modified = True |
185 |
- url = constants.specData.getSourceURL(spec) |
|
185 |
+ url = constants.specData.getSourceURL(package) |
|
186 | 186 |
if url is None: |
187 |
- url = constants.specData.getURL(spec) |
|
187 |
+ url = constants.specData.getURL(package) |
|
188 | 188 |
|
189 | 189 |
sourceName = None |
190 |
- listSourceNames = constants.specData.getSources(spec) |
|
190 |
+ listSourceNames = constants.specData.getSources(package) |
|
191 | 191 |
if len(listSourceNames) >0: |
192 | 192 |
sourceName=listSourceNames[0] |
193 |
- sha1 = constants.specData.getSHA1(spec, sourceName) |
|
193 |
+ sha1 = constants.specData.getSHA1(package, sourceName) |
|
194 | 194 |
if sha1 is not None: |
195 | 195 |
PullSources.get(sourceName, sha1, yamlDir, constants.pullsourcesConfig) |
196 | 196 |
|
... | ... |
@@ -218,13 +207,13 @@ def buildSRPMList(srpmPath, yamlDir, logger, singleFile=True): |
218 | 218 |
strUtils = StringUtils() |
219 | 219 |
if singleFile: |
220 | 220 |
yamlFile = open(yamlDir+"/srpm_list.yaml", "w") |
221 |
- listSpecs = constants.specData.getListSpecs() |
|
222 |
- listSpecs.sort() |
|
221 |
+ listPackages = constants.specData.getListPackages() |
|
222 |
+ listPackages.sort() |
|
223 | 223 |
cmdUtils = CommandUtils() |
224 |
- for spec in listSpecs: |
|
225 |
- ossname = spec |
|
226 |
- ossversion = constants.specData.getVersion(spec) |
|
227 |
- ossrelease = constants.specData.getRelease(spec) |
|
224 |
+ for package in listPackages: |
|
225 |
+ ossname = package |
|
226 |
+ ossversion = constants.specData.getVersion(package) |
|
227 |
+ ossrelease = constants.specData.getRelease(package) |
|
228 | 228 |
|
229 | 229 |
listFoundSRPMFiles = cmdUtils.findFile(ossname+"-"+ossversion+"-"+ossrelease+".src.rpm",srpmPath) |
230 | 230 |
srpmName = None |
... | ... |
@@ -264,19 +253,21 @@ def buildAPackage(package, listBuildOptionPackages, pkgBuildOptionFile, buildThr |
264 | 264 |
constants.setTestForceRPMS(listPackages[:]) |
265 | 265 |
pkgManager.buildPackages(listPackages, listBuildOptionPackages, pkgBuildOptionFile, buildThreads) |
266 | 266 |
|
267 |
-def buildPackagesFromGivenJSONFile(inputJSONFile, buildOption, listBuildOptionPackages, pkgBuildOptionFile, logger, buildThreads): |
|
268 |
- listPackages = get_all_package_names(inputJSONFile) |
|
267 |
+def buildPackagesForAllSpecs(listBuildOptionPackages, pkgBuildOptionFile, logger, buildThreads, pkgInfoJsonFile): |
|
268 |
+ listPackages = constants.specData.getListPackages() |
|
269 | 269 |
|
270 |
- listPackagesToBuild=[] |
|
271 |
- for pkg in listPackages: |
|
272 |
- p = pkg.encode('utf-8') |
|
273 |
- listPackagesToBuild.append(str(p)) |
|
274 | 270 |
logger.info("List of packages to build:") |
275 |
- logger.info(listPackagesToBuild) |
|
271 |
+ logger.info(listPackages) |
|
276 | 272 |
if constants.rpmCheck: |
277 | 273 |
constants.setTestForceRPMS(listPackagesToBuild[:]) |
278 | 274 |
pkgManager = PackageManager() |
279 |
- pkgManager.buildPackages(listPackagesToBuild, listBuildOptionPackages, pkgBuildOptionFile, buildThreads) |
|
275 |
+ pkgManager.buildPackages(listPackages, listBuildOptionPackages, pkgBuildOptionFile, buildThreads) |
|
276 |
+ |
|
277 |
+ #Generating package info file which is required by installer |
|
278 |
+ logger.info("Writing Package info to the file:"+pkgInfoJsonFile) |
|
279 |
+ pkgInfo = PackageInfo() |
|
280 |
+ pkgInfo.loadPackagesData() |
|
281 |
+ pkgInfo.writePkgListToFile(pkgInfoJsonFile) |
|
280 | 282 |
|
281 | 283 |
def get_packages_with_build_options(pkg_build_options_file): |
282 | 284 |
packages = [] |