Skip to content

Commit

Permalink
cli: dont check dirname presence in action_build
Browse files Browse the repository at this point in the history
Copr build <projectname:dirname> should according to documentation
create the dirname if does not exists, but the early check check_before_build
in action_build actually runs /build/check-before-build endpoint even
before the <projectname:dirname> has a chance to be created, thus
complains about non-existent dirname.
Passing only projectname to the check should be enough for the check as
is since the /build/check-before-build is called once more after dirname
creation.

Fixes fedora-copr#2786
  • Loading branch information
nikromen committed Feb 5, 2024
1 parent dba3811 commit 715f7fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cli/copr_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,14 @@ def action_build(self, args):
# Before we start uploading potentially large source RPM file, make sure
# that the user has valid credentials and can build in the project.
self.client.build_proxy.check_before_build(
username, projectname, project_dirname, buildopts)
ownername=username,
projectname=projectname,
# documentation says user can create directory with copr build, but
# /build/check-before-build endpoint checks for presence of this
# dirname even before creating it in this check.
project_dirname=None,
buildopts=buildopts,
)

builds = []
for pkg in args.pkgs:
Expand Down
3 changes: 3 additions & 0 deletions python/copr/v3/proxies/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def check_before_build(self, ownername, projectname,
:param buildopts: http://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
:return: Munch
"""
if project_dirname is None:
project_dirname = projectname

endpoint = "/build/check-before-build"
data = {
"ownername": ownername,
Expand Down

0 comments on commit 715f7fa

Please sign in to comment.