Skip to content

Commit

Permalink
Add info for projects
Browse files Browse the repository at this point in the history
Without this change, `osc info` in a project checkout dir returned

    Directory '.' is not an OBS SCM working copy of a package
  • Loading branch information
bmwiedemann committed Jun 11, 2024
1 parent 84524b5 commit ff65dfb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 5 additions & 3 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
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 ff65dfb

Please sign in to comment.