mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-22 21:16:16 +01:00
new source service commands "localrun" and "disabledrun" to generate files without _service: prefix
This commit is contained in:
parent
146a2d4f72
commit
373727ba55
1
NEWS
1
NEWS
@ -8,6 +8,7 @@
|
|||||||
- fallback to unexpanded diff mode on "osc diff" on merge error.
|
- fallback to unexpanded diff mode on "osc diff" on merge error.
|
||||||
- support viewing the commit history of deleted packages
|
- support viewing the commit history of deleted packages
|
||||||
- show review states on "review list"
|
- show review states on "review list"
|
||||||
|
- new source service commands "localrun" and "disabledrun" to generate files without _service: prefix
|
||||||
#
|
#
|
||||||
# Features which requires OBS 2.2
|
# Features which requires OBS 2.2
|
||||||
#
|
#
|
||||||
|
@ -4635,8 +4635,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
osc service COMMAND PROJECT PACKAGE
|
osc service COMMAND PROJECT PACKAGE
|
||||||
|
|
||||||
COMMAND can be:
|
COMMAND can be:
|
||||||
run run defined services locally
|
run r run defined services locally
|
||||||
remoterun trigger a re-run on the server side
|
localrun lr run defined services locally and store files as local created (skip _service: prefix).
|
||||||
|
disabledrun dr run only disabled services locally and store files as local created
|
||||||
|
remoterun rr trigger a re-run on the server side
|
||||||
|
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
@ -4661,14 +4663,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
command = args[0]
|
command = args[0]
|
||||||
|
|
||||||
if command == "remoterun":
|
if command == "remoterun" or command == "r":
|
||||||
print runservice(apiurl, project, package)
|
print runservice(apiurl, project, package)
|
||||||
|
|
||||||
if command == "run":
|
if command == "run" or command == "localrun" or command == "disabledrun" or command == "lr" or command == "dr" or command == "r":
|
||||||
if not is_package_dir(os.curdir):
|
if not is_package_dir(os.curdir):
|
||||||
raise oscerr.WrongArgs('Local directory is no package')
|
raise oscerr.WrongArgs('Local directory is no package')
|
||||||
p = Package(".")
|
p = Package(".")
|
||||||
p.run_source_services()
|
if command == "localrun" or command == "lr":
|
||||||
|
p.run_source_services( "local" )
|
||||||
|
elif command == "disabledrun" or command == "dr":
|
||||||
|
p.run_source_services( "disabled" )
|
||||||
|
else:
|
||||||
|
p.run_source_services()
|
||||||
|
|
||||||
@cmdln.option('-a', '--arch', metavar='ARCH',
|
@cmdln.option('-a', '--arch', metavar='ARCH',
|
||||||
help='trigger rebuilds for a specific architecture')
|
help='trigger rebuilds for a specific architecture')
|
||||||
|
14
osc/core.py
14
osc/core.py
@ -313,7 +313,7 @@ class Serviceinfo:
|
|||||||
r.append( s )
|
r.append( s )
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def execute(self, dir):
|
def execute(self, dir, callmode = ""):
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
# cleanup existing generated files
|
# cleanup existing generated files
|
||||||
@ -323,8 +323,10 @@ class Serviceinfo:
|
|||||||
|
|
||||||
# recreate files
|
# recreate files
|
||||||
for service in self.services:
|
for service in self.services:
|
||||||
if service['mode'] == "disabled":
|
if service['mode'] == "disabled" and callmode != "disabled":
|
||||||
next
|
continue
|
||||||
|
if service['mode'] != "disabled" and callmode == "disabled":
|
||||||
|
continue
|
||||||
call = service['command']
|
call = service['command']
|
||||||
temp_dir = tempfile.mkdtemp()
|
temp_dir = tempfile.mkdtemp()
|
||||||
name = call.split(None, 1)[0]
|
name = call.split(None, 1)[0]
|
||||||
@ -342,7 +344,7 @@ class Serviceinfo:
|
|||||||
# updating _services.
|
# updating _services.
|
||||||
print " (your _services file may be corrupt now)"
|
print " (your _services file may be corrupt now)"
|
||||||
|
|
||||||
if service['mode'] == "trylocal" or service['mode'] == "localonly":
|
if service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local":
|
||||||
for filename in os.listdir(temp_dir):
|
for filename in os.listdir(temp_dir):
|
||||||
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, filename) )
|
shutil.move( os.path.join(temp_dir, filename), os.path.join(dir, filename) )
|
||||||
else:
|
else:
|
||||||
@ -2026,12 +2028,12 @@ rev: %s
|
|||||||
|
|
||||||
print 'At revision %s.' % self.rev
|
print 'At revision %s.' % self.rev
|
||||||
|
|
||||||
def run_source_services(self):
|
def run_source_services(self, mode=""):
|
||||||
if self.filenamelist.count('_service') or self.filenamelist_unvers.count('_service'):
|
if self.filenamelist.count('_service') or self.filenamelist_unvers.count('_service'):
|
||||||
service = ET.parse(os.path.join(self.absdir, '_service')).getroot()
|
service = ET.parse(os.path.join(self.absdir, '_service')).getroot()
|
||||||
si = Serviceinfo()
|
si = Serviceinfo()
|
||||||
si.read(service)
|
si.read(service)
|
||||||
si.execute(self.absdir)
|
si.execute(self.absdir, mode)
|
||||||
|
|
||||||
def prepare_filelist(self):
|
def prepare_filelist(self):
|
||||||
"""Prepare a list of files, which will be processed by process_filelist
|
"""Prepare a list of files, which will be processed by process_filelist
|
||||||
|
Loading…
Reference in New Issue
Block a user