SCons: remove the homebrew tarballer

that was a nice SCons learning exercise, but never used
moreover, packaing is not the concern of a build system
This commit is contained in:
Fischlurch 2011-01-29 14:16:15 +01:00
parent a6810957b4
commit 7993759f8e
2 changed files with 1 additions and 87 deletions

View file

@ -169,8 +169,6 @@ def defineCmdlineVariables():
,PathVariable('INSTALLDIR', 'Root output directory for install. Final installation will happen in INSTALLDIR/PREFIX/... ', '/', PathVariable.PathIsDir)
,PathVariable('PKGLIBDIR', 'Installation dir for plugins, defaults to PREFIX/lib/lumiera/modules', '',PathVariable.PathAccept)
,PathVariable('PKGDATADIR', 'Installation dir for default config, usually PREFIX/share/lumiera', '',PathVariable.PathAccept)
,PathVariable('SRCTAR', 'Create source tarball prior to compiling', '..', PathVariable.PathAccept)
,PathVariable('DOCTAR', 'Create tarball with developer documentation', '..', PathVariable.PathAccept)
)
return vars
@ -314,15 +312,7 @@ def definePackagingTargets(env, artifacts):
""" build operations and targets to be done /before/ compiling.
things like creating a source tarball or preparing a version header.
"""
t = Tarball(env,location='$SRCTAR',dirs='$SRCDIR')
artifacts['src.tar'] = t
env.Alias('src.tar', t)
env.Alias('tar', t)
t = Tarball(env,location='$DOCTAR',suffix='-doc',dirs='admin doc wiki uml tests')
artifacts['doc.tar'] = t
env.Alias('doc.tar', t)
env.Alias('tar', t)
pass

View file

@ -231,79 +231,3 @@ def RegisterIcon_Builder(env):
env.Append(BUILDERS = {'IconRender' : buildIcon})
env.AddMethod(IconCopy)
def Tarball(env,location,dirs,suffix=''):
""" Custom Command: create Tarball of some subdirs
location: where to create the tar (may optionally include filename.tar.gz)
suffix: (optional) suffix to include in the tar name
dirs: directories to include in the tar
This is a bit of a hack, because we want to be able to include arbitrary directories,
without creating new dependencies on those dirs. Esp. we want to tar the source tree
prior to compiling. Solution is
- use the Command-Builder, but pass all target specifications as custom build vars
- create a pseudo-target located in the parent directory (not built by default)
"""
targetID = '../extern-tar%s' % suffix
versionID = env['VERSION']
defaultName = 'lumiera%s_%s' % (suffix, versionID)
nameprefix = 'lumiera-%s/' % (versionID)
location = env.subst(location)
dirs = env.subst(dirs)
return env.Command(targetID,None, createTarball,
location=location, defaultName=defaultName, dirs=dirs, nameprefix=nameprefix)
def createTarball(target,source,env):
""" helper, builds the tar using the python2.3 tarfile lib.
This allows us to prefix all paths, thus moving the tree
into a virtual subdirectory containing the Version number,
as needed by common packaging systems.
"""
name = getTarName( location = env['location']
, defaultName = env['defaultName'])
targetspec = env['dirs']
nameprefix = env['nameprefix'] or ''
print 'Running: tar -czf %s %s ...' % (name,targetspec)
if os.path.isfile(name):
os.remove(name)
tar = tarfile.open(name,'w:gz')
for name in targetspec.split():
tar.add(name,nameprefix+name)
tar.close()
#
# old version using shell command:
#
# cmd = 'tar -czf %s %s' % (name,targetspec)
# print 'running ', cmd, ' ... '
# pipe = os.popen (cmd)
# return pipe.close ()
def getTarName(location, defaultName):
""" create a suitable name for the tarball.
- if location contains a name (*.tar.gz) then use this
- otherwise append the defaultName to the specified dir
"""
spec = os.path.abspath(location)
(head,tail) = os.path.split(spec)
if not os.path.isdir(head):
print 'Target dir "%s" for Tar doesn\'t exist.' % head
Exit(1)
mat = re.match(r'([\w\.\-\+:\~]+)\.((tar)|(tar\.gz)|(tgz))', tail)
if mat:
name = mat.group(1)
ext = '.'+mat.group(2)
else:
ext = '.tar.gz'
if os.path.isdir(spec):
head = spec
name = defaultName
else:
name = tail
return os.path.join(head,name+ext)