Browse code

Package builder: fix incremental build

It should remove all subpackage rpms from the stage folder and not
only main rpm.
Otherwise packagebuilder might use, for instance, rpm-libs-4.14 from the
stage and rpm-4.13 from the publishrpms - known issue in package builder.

Extra:
- added `make print-upward-deps pkg=<spec file name>` target

Change-Id: I3f100ba7139ffd09d2d1cdd5158d127f3e26ec9a
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5896
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Srivatsa S. Bhat <srivatsab@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Alexey Makhalov authored on 2018/10/10 08:40:01
Showing 3 changed files
... ...
@@ -235,6 +235,10 @@ who-needs:
235 235
 	@cd $(PHOTON_SPECDEPS_DIR) && \
236 236
 		$(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i who-needs -p $(pkg)
237 237
 
238
+print-upward-deps:
239
+	@cd $(PHOTON_SPECDEPS_DIR) && \
240
+		$(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i print-upward-deps -p $(pkg)
241
+
238 242
 # Input args: BASE_COMMIT= (optional)
239 243
 #
240 244
 # This target removes staged RPMS that can be affected by change(s) and should
... ...
@@ -509,7 +509,7 @@ class SpecDependencyGenerator(object):
509 509
                 return self.displayDependencies(displayOption, inputType, outputFile, mapDependencies, parent)
510 510
             else:
511 511
                 return self.displayDependencies(displayOption, inputType, inputValue, mapDependencies, parent)
512
-        elif inputType == "remove-upward-deps":
512
+        elif inputType == "get-upward-deps":
513 513
             depList = []
514 514
             for specFile in inputValue.split(":"):
515 515
                 if specFile in SPECS.getData().mapSpecFileNameToSpecObj:
... ...
@@ -49,14 +49,18 @@ def main():
49 49
         specDeps = SpecDependencyGenerator()
50 50
 
51 51
         if options.input_type == "remove-upward-deps":
52
-            whoNeedsList = specDeps.process(options.input_type, options.pkg, options.display_option)
52
+            whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option)
53 53
             print ("Removing upward dependencies: " + str(whoNeedsList))
54 54
             for pkg in whoNeedsList:
55 55
                 package, version = StringUtils.splitPackageNameAndVersion(pkg)
56 56
                 release = SPECS.getData().getRelease(package, version)
57
-                buildarch=SPECS.getData().getBuildArch(package, version)
58
-                rpmFile = "stage/RPMS/" + buildarch + "/" +package + "-" + version + "-" + release + ".*" + buildarch+".rpm"
59
-                cmdUtils.runCommandInShell2("rm -f "+rpmFile)
57
+                for p in SPECS.getData().getPackages(package,version):
58
+                    buildarch=SPECS.getData().getBuildArch(p, version)
59
+                    rpmFile = "stage/RPMS/" + buildarch + "/" + p + "-" + version + "-" + release + ".*" + buildarch+".rpm"
60
+                    cmdUtils.runCommandInShell2("rm -f "+rpmFile)
61
+        elif options.input_type == "print-upward-deps":
62
+            whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option)
63
+            print ("Upward dependencies: " + str(whoNeedsList))
60 64
         # To display/print package dependencies on console
61 65
         elif (options.input_type == "pkg" or
62 66
                 options.input_type == "who-needs"):