def collectintargz(target, source, env): """ Puts all source files into a tar.gz file. """ # the rpm tool depends on a source package, until this is changed # this hack needs to be here that tries to pack all sources in. sources = env.FindSourceFiles() # filter out the target we are building the source list for. sources = [s for s in sources if s not in target] # find the .spec file for rpm and add it since it is not necessarily found # by the FindSourceFiles function. sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] ) # sort to keep sources from changing order across builds sources.sort() # as the source contains the url of the source package this rpm package # is built from, we extract the target name tarball = (str(target[0])+".tar.gz").replace('.rpm', '') try: tarball = env['SOURCE_URL'].split('/')[-1] except KeyError as e: raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0] ) tarball = src_targz.package(env, source=sources, target=tarball, PACKAGEROOT=env['PACKAGEROOT'], ) return (target, tarball)
# by the FindSourceFiles function. #sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] ) spec_file = lambda s: string.rfind(str(s), '.spec') != -1 sources.extend( filter(spec_file, source) ) # as the source contains the url of the source package this rpm package # is built from, we extract the target name #tarball = (str(target[0])+".tar.gz").replace('.rpm', '') tarball = string.replace(str(target[0])+".tar.gz", '.rpm', '') try: #tarball = env['SOURCE_URL'].split('/')[-1] tarball = string.split(env['SOURCE_URL'], '/')[-1] except KeyError, e: raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0] ) tarball = src_targz.package(env, source=sources, target=tarball, PACKAGEROOT=env['PACKAGEROOT'], ) return (target, tarball) def addspecfile(target, source, env): specfile = "%s-%s" % (env['NAME'], env['VERSION']) bld = SCons.Builder.Builder(action = build_specfile, suffix = '.spec', target_factory = SCons.Node.FS.File) source.extend(bld(env, specfile, source)) return (target,source) def build_specfile(target, source, env):
sources.extend(list(filter(spec_file, source))) # as the source contains the url of the source package this rpm package # is built from, we extract the target name #tarball = (str(target[0])+".tar.gz").replace('.rpm', '') tarball = (str(target[0]) + ".tar.gz").replace('.rpm', '') try: #tarball = env['SOURCE_URL'].split('/')[-1] tarball = env['SOURCE_URL'].split('/')[-1] except KeyError, e: raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0]) tarball = src_targz.package( env, source=sources, target=tarball, PACKAGEROOT=env['PACKAGEROOT'], ) return (target, tarball) def addspecfile(target, source, env): specfile = "%s-%s" % (env['NAME'], env['VERSION']) bld = SCons.Builder.Builder(action=build_specfile, suffix='.spec', target_factory=SCons.Node.FS.File) source.extend(bld(env, specfile, source))