Skip to content

Commit

Permalink
Merge pull request #1576 from bmwiedemann/prjinfo
Browse files Browse the repository at this point in the history
Add `info` command for projects
  • Loading branch information
dmach authored Jun 12, 2024
2 parents 84524b5 + 29d44d5 commit f3119fa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
9 changes: 6 additions & 3 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7868,9 +7868,12 @@ def do_info(self, subcmd, opts, *args):
"""

args = parseargs(args)
pacs = Package.from_paths(args)

for p in pacs:
for pdir in args:
store = osc_store.get_store(pdir)
if store.is_package:
p = Package(pdir)
else:
p = Project(pdir, getPackageList=False, wc_check=False)
print(p.info())

@cmdln.option('-M', '--multibuild-package', metavar='FLAVOR', action='append',
Expand Down
7 changes: 7 additions & 0 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """\
<!-- See https://github.com/openSUSE/libzypp/tree/master/zypp/parser/yum/schema/patterns.rng -->
Expand Down
8 changes: 8 additions & 0 deletions osc/obs_scm/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f3119fa

Please sign in to comment.