1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-11 16:36:14 +01:00

- support the new source service file mode of OBS 2.3 Beta 2

This commit is contained in:
Adrian Schröter 2011-05-23 15:26:13 +02:00
parent 3408f57078
commit 22e4047005
3 changed files with 36 additions and 17 deletions

2
NEWS
View File

@ -6,6 +6,8 @@
- new command "createincident" to create maintenance incidents without a request - new command "createincident" to create maintenance incidents without a request
- support to create hidden project on "branch" and "createincident" commands - support to create hidden project on "branch" and "createincident" commands
- osc waits and updates package after checkin when a source service is used - osc waits and updates package after checkin when a source service is used
- support for the new service file mode for "update" and "checkout" command when
downloading server side generated files
0.131 0.131
- new command 'develproject' to print the devel project from the package meta. - new command 'develproject' to print the devel project from the package meta.

View File

@ -3685,7 +3685,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
p.update(rev, opts.server_side_source_service_files, opts.limit_size) p.update(rev, opts.server_side_source_service_files, opts.limit_size)
rev = p.linkinfo.lsrcmd5 rev = p.linkinfo.lsrcmd5
elif p.islink() and p.isexpanded(): elif p.islink() and p.isexpanded():
rev = p.latest_rev() rev = p.latest_rev(include_service_files=opts.server_side_source_service_files)
p.update(rev, opts.server_side_source_service_files, opts.limit_size) p.update(rev, opts.server_side_source_service_files, opts.limit_size)
if opts.source_service_files: if opts.source_service_files:

View File

@ -1831,23 +1831,23 @@ rev: %s
if os.path.exists(os.path.join(self.storedir, '_frozenlink')): if os.path.exists(os.path.join(self.storedir, '_frozenlink')):
os.unlink(os.path.join(self.storedir, '_frozenlink')) os.unlink(os.path.join(self.storedir, '_frozenlink'))
def latest_rev(self): def latest_rev(self, include_service_files=False):
if self.islinkrepair(): if self.islinkrepair():
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrepair=1, meta=self.meta) upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrepair=1, meta=self.meta, include_service_files=include_service_files)
elif self.islink() and self.isexpanded(): elif self.islink() and self.isexpanded():
if self.isfrozen() or self.ispulled(): if self.isfrozen() or self.ispulled():
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta) upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta, include_service_files=include_service_files)
else: else:
try: try:
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, meta=self.meta) upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, meta=self.meta, include_service_files=include_service_files)
except: except:
try: try:
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta) upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta, include_service_files=include_service_files)
except: except:
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev="base", meta=self.meta) upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev="base", meta=self.meta, include_service_files=include_service_files)
self.mark_frozen() self.mark_frozen()
else: else:
upstream_rev = show_upstream_rev(self.apiurl, self.prjname, self.name, meta=self.meta) upstream_rev = show_upstream_rev(self.apiurl, self.prjname, self.name, meta=self.meta, include_service_files=include_service_files)
return upstream_rev return upstream_rev
def __get_files(self, fmeta_root): def __get_files(self, fmeta_root):
@ -3296,16 +3296,26 @@ def show_files_meta(apiurl, prj, pac, revision=None, expand=False, linkrev=None,
f = http_GET(makeurl(apiurl, ['source', prj, pac], query=query)) f = http_GET(makeurl(apiurl, ['source', prj, pac], query=query))
return f.read() return f.read()
def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None, meta=False): def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None, meta=False, include_service_files=False):
m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision, meta=meta) m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision, meta=meta)
return ET.fromstring(''.join(m)).get('srcmd5') et = ET.fromstring(''.join(m))
if include_service_files:
try:
if et.find('serviceinfo') and et.find('serviceinfo').get('xsrcmd5'):
return et.find('serviceinfo').get('xsrcmd5')
except:
pass
return et.get('srcmd5')
def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrepair=False, meta=False): def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrepair=False, meta=False, include_service_files=False):
m = show_files_meta(apiurl, prj, pac, revision=revision, linkrev=linkrev, linkrepair=linkrepair, meta=meta) m = show_files_meta(apiurl, prj, pac, revision=revision, linkrev=linkrev, linkrepair=linkrepair, meta=meta, expand=include_service_files)
et = ET.fromstring(''.join(m))
if include_service_files:
return et.get('srcmd5')
try: try:
# only source link packages have a <linkinfo> element. # only source link packages have a <linkinfo> element.
li_node = ET.fromstring(''.join(m)).find('linkinfo') li_node = et.find('linkinfo')
except: except:
return None return None
@ -3317,9 +3327,16 @@ def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrep
return li.xsrcmd5 return li.xsrcmd5
def show_upstream_rev(apiurl, prj, pac, revision=None, expand=False, linkrev=None, meta=False): def show_upstream_rev(apiurl, prj, pac, revision=None, expand=False, linkrev=None, meta=False, include_service_files=False):
m = show_files_meta(apiurl, prj, pac, revision=revision, expand=expand, linkrev=linkrev, meta=meta) m = show_files_meta(apiurl, prj, pac, revision=revision, expand=expand, linkrev=linkrev, meta=meta)
return ET.fromstring(''.join(m)).get('rev') et = ET.fromstring(''.join(m))
if include_service_files:
try:
if et.find('serviceinfo') and et.find('serviceinfo').get('xsrcmd5'):
return et.find('serviceinfo').get('xsrcmd5')
except:
pass
return et.get('rev')
def read_meta_from_spec(specfile, *args): def read_meta_from_spec(specfile, *args):
@ -4152,9 +4169,9 @@ def checkout_package(apiurl, project, package,
# if it is a link we use the xsrcmd5 as the revision to be # if it is a link we use the xsrcmd5 as the revision to be
# checked out # checked out
try: try:
x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta) x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta, include_service_files=server_service_files)
except: except:
x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta, linkrev='base') x = show_upstream_xsrcmd5(apiurl, project, package, revision=revision, meta=meta, linkrev='base', include_service_files=server_service_files)
if x: if x:
isfrozen = True isfrozen = True
if x: if x: