Add override for pkg version in pkg build logic 21/76721/8
authorDaniel Farrell <dfarrell@redhat.com>
Sat, 6 Oct 2018 03:05:33 +0000 (23:05 -0400)
committerDaniel Farrell <dfarrell@redhat.com>
Mon, 8 Oct 2018 13:45:43 +0000 (09:45 -0400)
The package version is the bit after the minus, meant for use by the
package itself, not the thing being packaged (ODL). It's normally
auto-detected for pre-release builds, or manually fixed at 1 for
releases. Add param to optionally manually override.

This is needed to fix an issue with building the Fluorine Common Distro
on the CentOS CBS.

Jira: INTPAK-210
Change-Id: Ifc97d92d4ec3503b31ea57eb535cdf79505afcf0
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
packages/build.py

index c829353037b65980b1c00c6a8ce76b30a5647df1..3bedc6a2df735b65683bced84ca7d3f21f56cc01 100755 (executable)
@@ -53,6 +53,8 @@ if __name__ == "__main__":
     # Direct builds require an archive URL
     direct_parser.add_argument("--download_url", required=True,
                                help="URL to tar/zip build archive to package")
+    direct_parser.add_argument(
+        "--pkg_version", help="Override autodetected package component of RPM version (maj.min.pat-pkg)'")
 
     # Create subparser for building latest snapshot from a given branch
     latest_snap_parser = subparsers.add_parser(
@@ -118,6 +120,11 @@ if __name__ == "__main__":
     # Use download_url to find pkg version, add to build def
     build.update(lib.extract_version(build["download_url"]))
 
+    # Override automatically extracted package version with param if passed
+    if (hasattr(args, "pkg_version") and args.pkg_version is not None and
+            args.pkg_version is not ""):
+        build['pkg_version'] = args.pkg_version
+
     # Karaf 3 distros use distribution-karaf-, Karaf 4 uses karaf-
     build.update({"distro_name_prefix": lib.get_distro_name_prefix(
         build['version_major'], build['download_url'])})