diff --git a/osc/commandline.py b/osc/commandline.py index 6412bfcc2..fdb1b7217 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -7868,9 +7868,11 @@ def do_info(self, subcmd, opts, *args): """ args = parseargs(args) - pacs = Package.from_paths(args) - - for p in pacs: + for pdir in args: + if (Path(pdir) / ".osc" / "_package").is_file(): + p = Package(pdir) + else: + p = Project(pdir, getPackageList=False, wc_check=False) print(p.info()) @cmdln.option('-M', '--multibuild-package', metavar='FLAVOR', action='append', diff --git a/osc/core.py b/osc/core.py index 27d5535a8..5dd96de57 100644 --- a/osc/core.py +++ b/osc/core.py @@ -235,6 +235,13 @@ def cmp(a, b): Link info: %s """ +project_info_templ = """\ +Project name: %s +Path: %s +API URL: %s +Source URL: %s +""" + new_pattern_template = """\ diff --git a/osc/obs_scm/project.py b/osc/obs_scm/project.py index 91332be21..0623a7129 100644 --- a/osc/obs_scm/project.py +++ b/osc/obs_scm/project.py @@ -242,6 +242,14 @@ def get_state(self, pac: str): else: return None + def info(self): + from ..core import project_info_templ + from ..core import makeurl + + source_url = makeurl(self.apiurl, ['source', self.name]) + r = project_info_templ % (self.name, self.absdir, self.apiurl, source_url) + return r + def new_package_entry(self, name, state): ET.SubElement(self.pac_root, 'package', name=name, state=state)