mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-12 08:56:13 +01:00
Merge pull request #1238 from dmach/buildhist-fix-package-checkout
buildhist: Fix running from a package checkout
This commit is contained in:
commit
cce4301bcd
30
behave/features/buildhist.feature
Normal file
30
behave/features/buildhist.feature
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
Feature: `osc buildhist` command
|
||||||
|
|
||||||
|
|
||||||
|
# common steps for all scenarios
|
||||||
|
Background:
|
||||||
|
Given I set working directory to "{context.osc.temp}"
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Run `osc buildist <project>/<package> <repository>/<arch>`
|
||||||
|
When I execute osc with args "buildhist test:factory/test-pkgA standard/x86_64"
|
||||||
|
Then the exit code is 0
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Run `osc buildist <repository>/<arch>` from a package checkout
|
||||||
|
Given I execute osc with args "co test:factory/test-pkgA"
|
||||||
|
And I set working directory to "{context.osc.temp}/test:factory/test-pkgA"
|
||||||
|
When I execute osc with args "buildhist standard/x86_64"
|
||||||
|
Then the exit code is 0
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Run `osc buildist <repository>/<arch>` from outside a package checkout
|
||||||
|
When I execute osc with args "buildhist standard/x86_64"
|
||||||
|
Then the exit code is 1
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Run `osc buildist <repository>/<arch>` from a project checkout
|
||||||
|
Given I execute osc with args "co test:factory"
|
||||||
|
And I set working directory to "{context.osc.temp}/test:factory"
|
||||||
|
When I execute osc with args "buildhist standard/x86_64"
|
||||||
|
Then the exit code is 1
|
@ -47,8 +47,13 @@ class BuildHistory:
|
|||||||
"ver_rel": node.get("versrel"),
|
"ver_rel": node.get("versrel"),
|
||||||
"build_count": int(node.get("bcnt")),
|
"build_count": int(node.get("bcnt")),
|
||||||
"time": time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(node.get("time")))),
|
"time": time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(node.get("time")))),
|
||||||
"duration": int(node.get("duration")),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# duration may not always be available
|
||||||
|
duration = node.get("duration")
|
||||||
|
if duration:
|
||||||
|
item["duration"] = int(duration)
|
||||||
|
|
||||||
result.append(item)
|
result.append(item)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -72,7 +77,7 @@ class BuildHistory:
|
|||||||
i["srcmd5"],
|
i["srcmd5"],
|
||||||
f"{i['ver_rel']}.{i['build_count']}",
|
f"{i['ver_rel']}.{i['build_count']}",
|
||||||
i["rev"],
|
i["rev"],
|
||||||
i["duration"],
|
i.get("duration", ""),
|
||||||
)
|
)
|
||||||
data.extend(item)
|
data.extend(item)
|
||||||
|
|
||||||
|
@ -6906,6 +6906,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
|
|
||||||
args = list(args)
|
args = list(args)
|
||||||
|
args_backup = args.copy()
|
||||||
|
|
||||||
|
try:
|
||||||
|
args = [".", "."] + args_backup.copy()
|
||||||
|
project, package, repository, arch = pop_project_package_repository_arch_from_args(args)
|
||||||
|
ensure_no_remaining_args(args)
|
||||||
|
except (oscerr.NoWorkingCopy, oscerr.WrongArgs):
|
||||||
|
args[:] = args_backup.copy()
|
||||||
project, package, repository, arch = pop_project_package_repository_arch_from_args(args)
|
project, package, repository, arch = pop_project_package_repository_arch_from_args(args)
|
||||||
ensure_no_remaining_args(args)
|
ensure_no_remaining_args(args)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user