mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
- patchinfo call can work without checked out copy now
This commit is contained in:
parent
bb373a9c9d
commit
94a670e067
2
NEWS
2
NEWS
@ -1,5 +1,5 @@
|
|||||||
0.134
|
0.134
|
||||||
-
|
- patchinfo call can work without checked out copy now
|
||||||
#
|
#
|
||||||
# Features which requires OBS 2.3
|
# Features which requires OBS 2.3
|
||||||
#
|
#
|
||||||
|
@ -437,46 +437,51 @@ class Osc(cmdln.Cmdln):
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
osc patchinfo
|
osc patchinfo
|
||||||
osc patchinfo PATCH_NAME
|
osc patchinfo [PROJECT [PATCH_NAME]]
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
apiurl = self.get_api_url()
|
||||||
project_dir = localdir = os.getcwd()
|
project_dir = localdir = os.getcwd()
|
||||||
patchinfo = None
|
patchinfo = 'patchinfo'
|
||||||
if is_project_dir(localdir):
|
if len(args) == 0:
|
||||||
project = store_read_project(localdir)
|
if is_project_dir(localdir):
|
||||||
apiurl = self.get_api_url()
|
project = store_read_project(localdir)
|
||||||
for p in meta_get_packagelist(apiurl, project):
|
apiurl = self.get_api_url()
|
||||||
if p.startswith("_patchinfo") or p.startswith("patchinfo"):
|
for p in meta_get_packagelist(apiurl, project):
|
||||||
patchinfo = p
|
if p.startswith("_patchinfo") or p.startswith("patchinfo"):
|
||||||
else:
|
patchinfo = p
|
||||||
if is_package_dir(localdir):
|
|
||||||
project = store_read_project(localdir)
|
|
||||||
patchinfo = store_read_package(localdir)
|
|
||||||
apiurl = self.get_api_url()
|
|
||||||
else:
|
else:
|
||||||
sys.exit('This command must be called in a checked out project or patchinfo package.')
|
if is_package_dir(localdir):
|
||||||
|
project = store_read_project(localdir)
|
||||||
|
patchinfo = store_read_package(localdir)
|
||||||
|
apiurl = self.get_api_url()
|
||||||
|
else:
|
||||||
|
sys.exit('This command must be called in a checked out project or patchinfo package.')
|
||||||
|
else:
|
||||||
|
project = args[0]
|
||||||
|
if len(args) > 1:
|
||||||
|
patchinfo = args[1]
|
||||||
|
|
||||||
filelist = None
|
filelist = None
|
||||||
if patchinfo:
|
if patchinfo:
|
||||||
filelist = meta_get_filelist(apiurl, project, patchinfo)
|
try:
|
||||||
|
filelist = meta_get_filelist(apiurl, project, patchinfo)
|
||||||
|
except urllib2.HTTPError:
|
||||||
|
pass
|
||||||
|
|
||||||
if opts.force or not patchinfo or not '_patchinfo' in filelist:
|
if opts.force or not filelist or not '_patchinfo' in filelist:
|
||||||
print "Creating initial patchinfo..."
|
print "Creating new patchinfo..."
|
||||||
query='cmd=createpatchinfo'
|
query='cmd=createpatchinfo&name=' + patchinfo
|
||||||
if opts.force:
|
if opts.force:
|
||||||
query += "&force=1"
|
query += "&force=1"
|
||||||
if args and args[0]:
|
|
||||||
query += "&name=" + args[0]
|
|
||||||
elif patchinfo:
|
|
||||||
query += "&name=" + patchinfo
|
|
||||||
url = makeurl(apiurl, ['source', project], query=query)
|
url = makeurl(apiurl, ['source', project], query=query)
|
||||||
f = http_POST(url)
|
f = http_POST(url)
|
||||||
for p in meta_get_packagelist(apiurl, project):
|
for p in meta_get_packagelist(apiurl, project):
|
||||||
if p.startswith("_patchinfo") or p.startswith("patchinfo"):
|
if p.startswith("_patchinfo") or p.startswith("patchinfo"):
|
||||||
patchinfo = p
|
patchinfo = p
|
||||||
else:
|
else:
|
||||||
print "Update _patchinfo file..."
|
print "Update existing _patchinfo file..."
|
||||||
query='cmd=updatepatchinfo'
|
query='cmd=updatepatchinfo'
|
||||||
url = makeurl(apiurl, ['source', project, patchinfo], query=query)
|
url = makeurl(apiurl, ['source', project, patchinfo], query=query)
|
||||||
f = http_POST(url)
|
f = http_POST(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user