Bug 1218170 - osc buildhistory error if in a git directory
Summary: osc buildhistory error if in a git directory
Status: CONFIRMED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Development (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Daniel Mach
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-18 17:21 UTC by Christian Boltz
Modified: 2024-01-25 09:35 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Boltz 2023-12-18 17:21:32 UTC
"osc buildhistory" fails with an error / python backtrace (see below for the full error message) if you run it in a directory that contains a git repo. In my case this git repo was the AppArmor source code.

I did not test what happens if you run "osc buildhistory" in a directory that contains the git repo of an OBS package - please test this yourself.

osc buildhistory (at least with the 4 parameters syntax) should work without even looking at the current directory.


cb@tux:~/apparmor/git master> osc buildhistory -l 5 home:cboltz apparmor openSUSE_Factory x86_64
Traceback (most recent call last):
  File "/usr/bin/osc", line 33, in <module>
    sys.exit(load_entry_point('osc==1.5.1', 'console_scripts', 'osc')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/osc/babysitter.py", line 226, in main
    sys.exit(run(commandline.OscMainCommand()))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/osc/babysitter.py", line 69, in run
    prg.main(argv)
  File "/usr/lib/python3.11/site-packages/osc/commandline.py", line 556, in main
    cmd.run(args)
  File "/usr/lib/python3.11/site-packages/osc/commandline.py", line 245, in run
    cmd.run(args)
  File "/usr/lib/python3.11/site-packages/osc/commandline.py", line 500, in run
    self.func(args.command, args, *args.positional_args)
  File "/usr/lib/python3.11/site-packages/osc/commandline.py", line 7519, in do_buildhistory
    project, package, repository, arch = pop_project_package_repository_arch_from_args(args)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/osc/commandline.py", line 817, in pop_project_package_repository_arch_from_args
    project, package = pop_project_package_from_args(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/osc/commandline.py", line 705, in pop_project_package_from_args
    project = project_store.project
              ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/osc/git_scm/store.py", line 79, in project
    raise RuntimeError(f"Couldn't map git branch '{branch}' to a project")
RuntimeError: Couldn't map git branch 'master' to a project


It works if I cd into a non-git directory:

cb@tux:~/apparmor/git master> cd ~
cb@tux:~> osc buildhistory -l 5 home:cboltz apparmor openSUSE_Factory x86_64
TIME                SRCMD5                           VER-REL.BUILD# REV DURATION
2023-10-24 06:58:20 d18117ce59c416e52ba4454396c6e707 3.1.6-966.4    469 447
2023-10-30 03:48:35 d18117ce59c416e52ba4454396c6e707 3.1.6-966.5    469 2041
2023-11-05 22:02:11 d18117ce59c416e52ba4454396c6e707 3.1.6-966.6    469 450
2023-11-07 02:04:55 d18117ce59c416e52ba4454396c6e707 3.1.6-966.7    469 390
2023-11-08 18:28:44 f8aa056a23a410850e7f046bdedbfeee 3.1.6-970.1    471 378
Comment 1 Daniel Mach 2024-01-09 10:10:04 UTC
Upstream pull-request: https://github.com/openSUSE/osc/pull/1465
Comment 2 OBSbugzilla Bot 2024-01-25 09:35:08 UTC
This is an autogenerated message for OBS integration:
This bug (1218170) was mentioned in
https://build.opensuse.org/request/show/1141459 Tools / osc