mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 07:06:13 +01:00
- Serviceinfo.execute: create tmpdir in the package wc
The advantage is that we can use os.rename instead of shutil.move to move the files.
This commit is contained in:
parent
f6324f2aa0
commit
d6bd44a9a4
@ -401,7 +401,7 @@ class Serviceinfo:
|
|||||||
continue
|
continue
|
||||||
temp_dir = None
|
temp_dir = None
|
||||||
try:
|
try:
|
||||||
temp_dir = tempfile.mkdtemp()
|
temp_dir = tempfile.mkdtemp(suffix='.%s.service' % service['name'])
|
||||||
cmd = service['command']
|
cmd = service['command']
|
||||||
if not os.path.exists("/usr/lib/obs/service/"+cmd[0]):
|
if not os.path.exists("/usr/lib/obs/service/"+cmd[0]):
|
||||||
raise oscerr.PackageNotInstalled("obs-service-%s"%cmd[0])
|
raise oscerr.PackageNotInstalled("obs-service-%s"%cmd[0])
|
||||||
@ -419,11 +419,11 @@ class Serviceinfo:
|
|||||||
|
|
||||||
if service['mode'] == "disabled" or service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local" or callmode == "trylocal":
|
if service['mode'] == "disabled" or service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local" or callmode == "trylocal":
|
||||||
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) )
|
os.rename(os.path.join(temp_dir, filename), os.path.join(dir, filename))
|
||||||
else:
|
else:
|
||||||
name = service['name']
|
name = service['name']
|
||||||
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, "_service:"+name+":"+filename) )
|
os.rename(os.path.join(temp_dir, filename), os.path.join(dir, "_service:"+name+":"+filename))
|
||||||
finally:
|
finally:
|
||||||
if temp_dir is not None:
|
if temp_dir is not None:
|
||||||
shutil.rmtree(temp_dir)
|
shutil.rmtree(temp_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user