Add third party repo as optional from create_dependancy_cache.py

This commit adds the third party repo from the create_dependancy
cache.py repository as optional since the third party repo is not
in the manifest.

Change-Id: I27712caab5d9c79b426f2a6ebbc49466f5812b40
Signed-off-by: Jesus Ornelas Aguayo <jesus.ornelas.aguayo@intel.com>
This commit is contained in:
Jesus Ornelas Aguayo 2018-06-20 11:24:16 -04:00
parent 415a6a041e
commit 88cc7f4d73

View File

@ -4,10 +4,9 @@ import xml.etree.ElementTree as ET
import fnmatch import fnmatch
import os import os
import gzip import gzip
import getopt
import sys import sys
import string import string
from optparse import OptionParser
ns = { 'root': 'http://linux.duke.edu/metadata/common', ns = { 'root': 'http://linux.duke.edu/metadata/common',
'filelists': 'http://linux.duke.edu/metadata/filelists', 'filelists': 'http://linux.duke.edu/metadata/filelists',
@ -30,7 +29,6 @@ if not os.path.isdir(repodata_dir):
publish_cache_dir="%s/cgcs-tis-repo/dependancy-cache" % os.environ['MY_REPO'] publish_cache_dir="%s/cgcs-tis-repo/dependancy-cache" % os.environ['MY_REPO']
centos_repo_dir="%s/cgcs-centos-repo" % os.environ['MY_REPO'] centos_repo_dir="%s/cgcs-centos-repo" % os.environ['MY_REPO']
third_party_repo_dir="%s/cgcs-3rd-party-repo" % os.environ['MY_REPO']
tis_repo_dir="%s/cgcs-tis-repo" % os.environ['MY_REPO'] tis_repo_dir="%s/cgcs-tis-repo" % os.environ['MY_REPO']
workspace_repo_dirs={} workspace_repo_dirs={}
for rt in rpm_types: for rt in rpm_types:
@ -46,10 +44,6 @@ if not os.path.isdir(centos_repo_dir):
print("ERROR: directory not found %s" % centos_repo_dir) print("ERROR: directory not found %s" % centos_repo_dir)
sys.exit(1) sys.exit(1)
if not os.path.isdir(third_party_repo_dir):
print("ERROR: directory not found %s" % third_party_repo_dir)
sys.exit(1)
if not os.path.isdir(tis_repo_dir): if not os.path.isdir(tis_repo_dir):
print("ERROR: directory not found %s" % tis_repo_dir) print("ERROR: directory not found %s" % tis_repo_dir)
sys.exit(1) sys.exit(1)
@ -62,24 +56,31 @@ if not os.path.isdir(tis_repo_dir):
# "%s/CentOS/vault.centos.org/7.2.1511" % repodata_dir, # "%s/CentOS/vault.centos.org/7.2.1511" % repodata_dir,
# "%s/CentOS/tis-r3/Source" % repodata_dir ] # "%s/CentOS/tis-r3/Source" % repodata_dir ]
bin_rpm_mirror_roots = ["%s/Binary" % centos_repo_dir, bin_rpm_mirror_roots = ["%s/Binary" % centos_repo_dir]
"%s/Binary" % third_party_repo_dir ] src_rpm_mirror_roots = ["%s/Source" % centos_repo_dir]
src_rpm_mirror_roots = ["%s/Source" % centos_repo_dir,
"%s/Source" % third_party_repo_dir ]
for bt in build_types: for bt in build_types:
bin_rpm_mirror_roots.append(workspace_repo_dirs['RPM'][bt]) bin_rpm_mirror_roots.append(workspace_repo_dirs['RPM'][bt])
src_rpm_mirror_roots.append(workspace_repo_dirs['SRPM'][bt]) src_rpm_mirror_roots.append(workspace_repo_dirs['SRPM'][bt])
short_options='' parser = OptionParser('create_dependancy_cache')
long_options=[ 'cache_dir=' ] parser.add_option('-c', '--cache_dir', action='store', type='string',
dest='cache_dir', help='set cache directory')
parser.add_option('-t', '--third_party_repo_dir', action='store',
type='string', dest='third_party_repo_dir',
help='set third party directory')
(options, args) = parser.parse_args()
options, remainder = getopt.getopt(sys.argv[1:], short_options, long_options) if options.cache_dir:
publish_cache_dir = options.cache_dir
for opt, arg in options: if options.third_party_repo_dir:
if opt in ('--cache_dir'): third_party_repo_dir = options.third_party_repo_dir
publish_cache_dir = arg bin_rpm_mirror_roots.append(third_party_repo_dir)
src_rpm_mirror_roots.append(third_party_repo_dir)
if not os.path.isdir(third_party_repo_dir):
print("ERROR: directory not found %s" % third_party_repo_dir)
sys.exit(1)
if not os.path.isdir(publish_cache_dir): if not os.path.isdir(publish_cache_dir):
print("ERROR: directory not found %s" % publish_cache_dir) print("ERROR: directory not found %s" % publish_cache_dir)