summaryrefslogtreecommitdiffstats
path: root/SConstruct
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-05-27 11:55:49 (GMT)
committerSteven Knight <knight@baldmt.com>2003-05-27 11:55:49 (GMT)
commitdd46e3d77cb07573d2ff1cb0caed60e5f474cc3c (patch)
tree7afc2577bcedf2a05d39da624ce5b3e14e6c72a1 /SConstruct
parentb7f2dfccaae3d1a25a6114ad054bbc13492ecaec (diff)
downloadSCons-dd46e3d77cb07573d2ff1cb0caed60e5f474cc3c.zip
SCons-dd46e3d77cb07573d2ff1cb0caed60e5f474cc3c.tar.gz
SCons-dd46e3d77cb07573d2ff1cb0caed60e5f474cc3c.tar.bz2
Generate our own copies of Gentoo files (.ebuild, and a digest record).
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct32
1 files changed, 32 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 59f7088..570570d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -241,6 +241,7 @@ def SCons_revision(target, source, env):
line = string.replace(line, '__FILE' + '__', str(source[0]))
line = string.replace(line, '__REVISION' + '__', env['REVISION'])
line = string.replace(line, '__VERSION' + '__', env['VERSION'])
+ line = string.replace(line, '__NULL' + '__', '')
outf.write(line)
inf.close()
outf.close()
@@ -733,6 +734,37 @@ for p in [ scons ]:
deb,
"dpkg --fsys-tarfile $SOURCES | (cd $TEST_DEB_DIR && tar -xf -)")
+
+ #
+ # Generate portage files for submission to Gentoo Linux.
+ #
+ gentoo = os.path.join('build', 'gentoo')
+ ebuild = os.path.join(gentoo, 'scons-%s.ebuild' % version)
+ digest = os.path.join(gentoo, 'files', 'digest-scons-%s' % version)
+ env.Command(ebuild, os.path.join('gentoo', 'scons.ebuild.in'), SCons_revision)
+ def Digestify(target, source, env):
+ import md5
+ def hexdigest(s):
+ """Return a signature as a string of hex characters.
+ """
+ # NOTE: This routine is a method in the Python 2.0 interface
+ # of the native md5 module, but we want SCons to operate all
+ # the way back to at least Python 1.5.2, which doesn't have it.
+ h = string.hexdigits
+ r = ''
+ for c in s:
+ i = ord(c)
+ r = r + h[(i >> 4) & 0xF] + h[i & 0xF]
+ return r
+ src = source[0].rfile()
+ contents = open(str(src)).read()
+ sig = hexdigest(md5.new(contents).digest())
+ bytes = os.stat(str(src))[6]
+ open(str(target[0]), 'w').write("MD5 %s %s %d\n" % (sig,
+ src.name,
+ bytes))
+ env.Command(digest, tar_gz, Digestify)
+
#
# Use the Python distutils to generate the appropriate packages.
#