1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00

changed do_repos() to filter out disabled repos of a package

Changed do_repos() to filter out disabled repos of a package. Read
package from checked out package dir. This changes also the output
of getbinaries if args are missing and the user is within a checked
out package dir. Show only enabled repos in this case.

Allow also osc repos [PROJECT] [PACKAGE].
This commit is contained in:
Danny Kukawka 2010-07-12 14:56:08 +02:00
parent 24d5b4218a
commit 3ed00b4568
2 changed files with 33 additions and 6 deletions

View File

@ -3736,27 +3736,41 @@ Please submit there instead, or use --nodevelproject to force direct submission.
def do_repos(self, subcmd, opts, *args):
"""${cmd_name}: shows repositories configured for a project
"""${cmd_name}: shows repositories configured for a project or package
usage:
osc repos
osc repos [PROJECT]
osc repos [PROJECT] [PACKAGE]
${cmd_option_list}
"""
apiurl = self.get_api_url()
package = None
disabled = None
if len(args) == 1:
project = args[0]
elif len(args) == 1:
project = args[0]
package = args[1]
elif len(args) == 0:
project = store_read_project('.')
if is_package_dir('.'):
package = store_read_package('.')
project = store_read_project('.')
elif is_project_dir('.'):
project = store_read_project('.')
else:
raise oscerr.WrongArgs('Wrong number of arguments')
if package is not None:
disabled = show_package_disabled_repos(apiurl, project, package)
data = []
for repo in get_repos_of_project(apiurl, project):
data += [repo.name, repo.arch]
if (disabled is None) or ((disabled is not None) and (repo.name not in disabled)):
data += [repo.name, repo.arch]
for row in build_table(2, data, width=2):
print row
@ -4397,10 +4411,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = slash_split(args)
apiurl = self.get_api_url()
package = None
project = None
package = None
project = None
if len(args) < 1 and is_package_dir('.'):
project = store_read_project(os.curdir)
package = store_read_package(os.curdir)
self.print_repos()
architecture = None

View File

@ -2309,6 +2309,17 @@ def show_develproject(apiurl, prj, pac):
return None
def show_package_disabled_repos(apiurl, prj, pac):
m = show_package_meta(apiurl, prj, pac)
try:
root = ET.fromstring(''.join(m))
elm = root.find('build')
r = [ node.get('repository') for node in elm.findall('disable')]
return r
except:
return None
def show_pattern_metalist(apiurl, prj):
url = makeurl(apiurl, ['source', prj, '_pattern'])
try: