Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix buildinfo inconsistency #938

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6038,7 +6038,7 @@ def do_buildinfo(self, subcmd, opts, *args):
wd = os.curdir
args = slash_split(args)

project = package = repository = arch = build_descr = None
project = package = repository = arch = build_descr = service_data = None
if len(args) <= 3:
if not is_package_dir('.'):
raise oscerr.WrongArgs('Incorrect number of arguments (Note: \'.\' is no package wc)')
Expand All @@ -6048,6 +6048,8 @@ def do_buildinfo(self, subcmd, opts, *args):
else:
project = store_read_project('.')
package = store_read_package('.')
if os.path.exists('_service'):
service_data = open('_service', 'rb').read()
repository, arch, build_descr = self.parse_repoarchdescr(args, alternative_project=opts.alternative_project, ignore_descr=True, multibuild_package=opts.multibuild_package)
elif len(args) == 4 or len(args) == 5:
project = args[0]
Expand All @@ -6056,6 +6058,8 @@ def do_buildinfo(self, subcmd, opts, *args):
arch = args[3]
if len(args) == 5:
build_descr = args[4]
if os.path.exists('_service'):
service_data = open('_service', 'rb').read()
else:
raise oscerr.WrongArgs('Too many arguments.')

Expand Down Expand Up @@ -6084,7 +6088,8 @@ def do_buildinfo(self, subcmd, opts, *args):
project, package, repository, arch,
specfile=build_descr_data,
debug=opts.debug,
addlist=opts.extra_pkgs)))
addlist=opts.extra_pkgs,
servicefile=service_data)))


def do_buildconfig(self, subcmd, opts, *args):
Expand Down
15 changes: 13 additions & 2 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import shlex
import hashlib
import platform
from .util import cpio


try:
Expand Down Expand Up @@ -6200,7 +6201,7 @@ def get_dependson(apiurl, project, repository, arch, packages=None, reverse=None
f = http_GET(u)
return f.read()

def get_buildinfo(apiurl, prj, package, repository, arch, specfile=None, addlist=None, debug=None):
def get_buildinfo(apiurl, prj, package, repository, arch, specfile=None, addlist=None, debug=None, servicefile=None):
query = []
if addlist:
for i in addlist:
Expand All @@ -6210,8 +6211,18 @@ def get_buildinfo(apiurl, prj, package, repository, arch, specfile=None, addlist

u = makeurl(apiurl, ['build', prj, repository, arch, package, '_buildinfo'], query=query)

post_body = specfile
if servicefile:
if specfile is None:
e.osc_msg = 'error - application need to send also the build description file when sending a _service file'
raise
cpio = cpio.CpioWrite()
cpio.add(b'buildinfo.spec', specfile)
cpio.add(b'_service', servicefile)
post_body = cpio.get()

if specfile:
f = http_POST(u, data=specfile)
f = http_POST(u, data=post_body)
else:
f = http_GET(u)
return f.read()
Expand Down