AMBARI-18397. Update version-builder to include unique element (dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6c3f75e1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6c3f75e1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6c3f75e1

Branch: refs/heads/branch-2.5
Commit: 6c3f75e1da6c9b9321b6106daa161cb2f2110dca
Parents: 20eacc6
Author: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Authored: Fri Sep 16 19:10:45 2016 +0300
Committer: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Committed: Fri Sep 16 19:12:45 2016 +0300

----------------------------------------------------------------------
 contrib/version-builder/example.py         |  4 ++--
 contrib/version-builder/example.sh         |  4 ++--
 contrib/version-builder/version_builder.py | 12 +++++++++---
 3 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6c3f75e1/contrib/version-builder/example.py
----------------------------------------------------------------------
diff --git a/contrib/version-builder/example.py 
b/contrib/version-builder/example.py
index b9cdf56..8c7be5f 100644
--- a/contrib/version-builder/example.py
+++ b/contrib/version-builder/example.py
@@ -28,8 +28,8 @@ def main(args):
 
   vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0")
 
-  vb.add_repo("redhat6", "HDP-2.4", "HDP", 
"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0";)
-  vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", 
"http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6";)
+  vb.add_repo("redhat6", "HDP-2.4", "HDP", 
"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0";, "true")
+  vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", 
"http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6";, 
"false")
 
   vb.persist()
   vb.finalize("../../ambari-server/src/main/resources/version_definition.xsd")

http://git-wip-us.apache.org/repos/asf/ambari/blob/6c3f75e1/contrib/version-builder/example.sh
----------------------------------------------------------------------
diff --git a/contrib/version-builder/example.sh 
b/contrib/version-builder/example.sh
index bc76fd0..ca7ba10 100755
--- a/contrib/version-builder/example.sh
+++ b/contrib/version-builder/example.sh
@@ -40,8 +40,8 @@ python version_builder.py --file $filename --available 
--manifest-id HDFS-271
 python version_builder.py --file $filename --os --os-family redhat6 
--os-package-version 2_4_1_1_12345
 
 #call any number of times for repo per os
-python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id 
HDP-2.4 --repo-name HDP --repo-url 
http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1
-python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id 
HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url 
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6
+python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id 
HDP-2.4 --repo-name HDP --repo-url 
http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1 
--repo-unique true
+python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id 
HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url 
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6 
--repo-unique false
 
 
 python version_builder.py --file $filename --finalize --xsd 
../../ambari-server/src/main/resources/version_definition.xsd

http://git-wip-us.apache.org/repos/asf/ambari/blob/6c3f75e1/contrib/version-builder/version_builder.py
----------------------------------------------------------------------
diff --git a/contrib/version-builder/version_builder.py 
b/contrib/version-builder/version_builder.py
index 2c07b0c..6d1689a 100644
--- a/contrib/version-builder/version_builder.py
+++ b/contrib/version-builder/version_builder.py
@@ -173,7 +173,7 @@ class VersionBuilder:
         e = ET.SubElement(service_element, 'component')
         e.text = component
 
-  def add_repo(self, os_family, repo_id, repo_name, base_url):
+  def add_repo(self, os_family, repo_id, repo_name, base_url, unique):
     """
     Adds a repository
     """
@@ -204,6 +204,10 @@ class VersionBuilder:
     e = ET.SubElement(repo_element, 'reponame')
     e.text = repo_name
 
+    if unique is not None:
+      e = ET.SubElement(repo_element, 'unique')
+      e.text = unique
+
 
   def _check_xmllint(self):
     """
@@ -318,7 +322,7 @@ def process_repo(vb, options):
   if not options.repo:
     return
 
-  vb.add_repo(options.repo_os, options.repo_id, options.repo_name, 
options.repo_url)
+  vb.add_repo(options.repo_os, options.repo_id, options.repo_name, 
options.repo_url, options.unique)
 
 def validate_manifest(parser, options):
   """
@@ -426,11 +430,13 @@ def main(argv):
     help="The package version to use for the OS")
 
   parser.add_option('--repo', action='store_true', dest='repo',
-    help="Add repository data with options: --repo-os, --repo-url, --repo-id, 
--repo-name")
+    help="Add repository data with options: --repo-os, --repo-url, --repo-id, 
--repo-name, --repo-unique")
   parser.add_option('--repo-os', dest='repo_os',
     help="The operating system type: i.e. redhat6, redhat7, debian7, ubuntu12, 
ubuntu14, ubuntu16, suse11, suse12")
   parser.add_option('--repo-url', dest='repo_url',
     help="The base url for the repository data")
+  parser.add_option('--repo-unique', dest='unique', type='choice', 
choices=['true', 'false'],
+                    help="Indicates base url should be unique")
   parser.add_option('--repo-id', dest='repo_id', help="The ID of the repo")
   parser.add_option('--repo-name', dest='repo_name', help="The name of the 
repo")
 

Reply via email to