mirror of https://github.com/apache/cloudstack.git
Patch generation (tar waf tool) fixed to work properly on windows and linux.
This commit is contained in:
parent
df2455a39e
commit
b670b7f656
|
|
@ -10,7 +10,7 @@ for virttech in Utils.to_list(bld.path.ant_glob("*",dir=True)):
|
|||
source = patchfiles,
|
||||
target = '%s-patch.tgz'%virttech,
|
||||
name = '%s-patch_tgz'%virttech,
|
||||
root = "patches/%s"%virttech,
|
||||
root = os.path.join("patches",virttech),
|
||||
rename = lambda x: re.sub(".subst$","",x),
|
||||
after = 'patchsubst',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import Utils
|
|||
import tarfile
|
||||
from TaskGen import feature, before
|
||||
import Task
|
||||
import os
|
||||
import os, sys
|
||||
|
||||
# this is a clever little thing
|
||||
# given a list of nodes, build or source
|
||||
|
|
@ -14,9 +14,9 @@ import os
|
|||
def tar_up(task):
|
||||
tgt = task.outputs[0].bldpath(task.env)
|
||||
if os.path.exists(tgt): os.unlink(tgt)
|
||||
if tgt.lower().endswith(".bz2"): z = tarfile.open(tgt,"w:bz2")
|
||||
elif tgt.lower().endswith(".gz"): z = tarfile.open(tgt,"w:gz")
|
||||
elif tgt.lower().endswith(".tgz"): z = tarfile.open(tgt,"w:gz")
|
||||
if tgt.lower().endswith(".bz2"): z = tarfile.open(tgt,"w:bz2")
|
||||
elif tgt.lower().endswith(".gz"): z = tarfile.open(tgt,"w:gz")
|
||||
elif tgt.lower().endswith(".tgz"): z = tarfile.open(tgt,"w:gz")
|
||||
else: z = tarfile.open(tgt,"w")
|
||||
fileset = {}
|
||||
for inp in task.inputs:
|
||||
|
|
@ -25,16 +25,16 @@ def tar_up(task):
|
|||
srcname = Utils.relpath(src,os.path.join("..",".")) # file in source dir
|
||||
else:
|
||||
srcname = Utils.relpath(src,os.path.join(task.env.variant(),".")) # file in artifacts dir
|
||||
srcname = srcname.split(os.path.sep,len(task.generator.root.split(os.path.sep)))[-1]
|
||||
if task.generator.rename: srcname = task.generator.rename(srcname)
|
||||
for dummy in task.generator.root.split("/"):
|
||||
splittedname = srcname.split("/")
|
||||
srcname = "/".join(splittedname[1:])
|
||||
fileset[srcname] = src
|
||||
for srcname,src in fileset.items():
|
||||
ti = tarfile.TarInfo(srcname)
|
||||
ti.mode = 0755
|
||||
ti.size = os.path.getsize(src)
|
||||
f = file(src)
|
||||
openmode = 'r'
|
||||
if sys.platform == 'win32': openmode = openmode + 'b'
|
||||
f = file(src,openmode)
|
||||
z.addfile(ti,fileobj=f)
|
||||
f.close()
|
||||
z.close()
|
||||
|
|
|
|||
Loading…
Reference in New Issue