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')
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: