summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryang.zhang <y0169.zhang@samsung.com>2017-06-02 15:05:29 +0800
committeryang.zhang <y0169.zhang@samsung.com>2017-06-02 15:05:49 +0800
commit000eb2e1a8ade0a1cd4521bd1278ad5f0ba85374 (patch)
tree13436b22e7ad3a49efe9bd3cfbba4e289dc499a9
parent6f64f0a0430037d8f57a1d11f20a52de7286b7d6 (diff)
downloadosc-000eb2e1a8ade0a1cd4521bd1278ad5f0ba85374.tar.gz
osc-000eb2e1a8ade0a1cd4521bd1278ad5f0ba85374.tar.bz2
osc-000eb2e1a8ade0a1cd4521bd1278ad5f0ba85374.zip
Add get_alldependson api for gbs deps build
Change-Id: I35fb8e28298097e92b6c5df68e10f00949c7df00
-rw-r--r--osc/commandline.py68
-rw-r--r--osc/core.py15
2 files changed, 83 insertions, 0 deletions
diff --git a/osc/commandline.py b/osc/commandline.py
index 281d0eb..8aba26b 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -5242,6 +5242,74 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for dep in package.findall('pkgdep'):
print(" ", dep.text)
+ @cmdln.alias('alldependson')
+ def do_getalldependson(self, subcmd, opts, *args):
+ """${cmd_name}: Show the build dependencies
+
+ The command dependson and whatdependson can be used to find out what
+ will be triggered when a certain package changes.
+ This is no guarantee, since the new build might have changed dependencies.
+
+ dependson shows the build dependencies inside of a project, valid for a
+ given repository and architecture.
+ NOTE: to see all binary packages, which can trigger a build you need to
+ refer the buildinfo, since this command shows only the dependencies
+ inside of a project.
+
+ The arguments REPOSITORY and ARCH can be taken from the first two columns
+ of the 'osc repos' output.
+
+ usage in package or project directory:
+ osc dependson REPOSITORY ARCH
+ osc whatdependson REPOSITORY ARCH
+
+ usage:
+ osc dependson PROJECT [PACKAGE] REPOSITORY ARCH
+ osc whatdependson PROJECT [PACKAGE] REPOSITORY ARCH
+
+ ${cmd_option_list}
+ """
+ wd = os.curdir
+ args = slash_split(args)
+ project = packages = repository = arch = reverse = None
+
+ if len(args) < 2 and (is_package_dir('.') or is_project_dir('.')):
+ self.print_repos()
+
+ if len(args) > 4:
+ raise oscerr.WrongArgs('Too many arguments.')
+
+ apiurl = self.get_api_url()
+
+ if len(args) < 3: # 2
+ if is_package_dir('.'):
+ packages = [store_read_package(wd)]
+ elif not is_project_dir('.'):
+ raise oscerr.WrongArgs('Project and package is not specified.')
+ project = store_read_project(wd)
+ repository = args[0]
+ arch = args[1]
+
+ if len(args) == 3:
+ project = args[0]
+ repository = args[1]
+ arch = args[2]
+
+ if len(args) == 4:
+ project = args[0]
+ packages = [args[1]]
+ repository = args[2]
+ arch = args[3]
+
+ reverse = 1
+
+ xml = get_alldependson(apiurl, project, repository, arch, packages, reverse)
+
+ root = ET.fromstring(xml)
+ for package in root.findall('package'):
+ print(package.get('name'), ":")
+ for dep in package.findall('pkgdep'):
+ print(" ", dep.text)
@cmdln.option('-d', '--debug', action='store_true',
help='verbose output of build dependencies')
diff --git a/osc/core.py b/osc/core.py
index 92f0cf4..8295526 100644
--- a/osc/core.py
+++ b/osc/core.py
@@ -5673,6 +5673,21 @@ def get_dependson(apiurl, project, repository, arch, packages=None, reverse=None
f = http_GET(u)
return f.read()
+def get_alldependson(apiurl, project, repository, arch, packages=None, reverse=None):
+ query = []
+ if packages:
+ for i in packages:
+ query.append('package=%s' % quote_plus(i))
+
+ if reverse:
+ query.append('view=revpkgnames')
+ else:
+ query.append('view=pkgnames')
+
+ u = makeurl(apiurl, ['build', project, repository, arch, '_allbuilddepinfo'], query=query)
+ f = http_GET(u)
+ return f.read()
+
def get_buildinfo(apiurl, prj, package, repository, arch, specfile=None, addlist=None, debug=None):
query = []
if addlist: