summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SConstruct73
-rw-r--r--rpm/scons.spec171
-rw-r--r--rpm/scons.spec.in53
3 files changed, 102 insertions, 195 deletions
diff --git a/SConstruct b/SConstruct
index 2c4164e..1a8fd29 100644
--- a/SConstruct
+++ b/SConstruct
@@ -82,7 +82,7 @@ try:
date = ARGUMENTS['date']
except:
date = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(time.time()))
-
+
if ARGUMENTS.has_key('developer'):
developer = ARGUMENTS['developer']
elif os.environ.has_key('USERNAME'):
@@ -173,7 +173,7 @@ else:
zcat = 'gzip -d -c'
-
+
#
# Figure out if we can handle .zip files.
#
@@ -221,7 +221,7 @@ except:
def SCons_revision(target, source, env):
"""Interpolate specific values from the environment into a file.
-
+
This is used to copy files into a tree that gets packaged up
into the source file package.
"""
@@ -250,7 +250,7 @@ revbuilder = Builder(action = Action(SCons_revision, varlist=['VERSION']))
env = Environment(
ENV = ENV,
-
+
BUILD = build_id,
BUILDSYS = build_system,
COPYRIGHT = copyright,
@@ -307,6 +307,7 @@ python_scons = {
'pkg' : 'python-' + project,
'src_subdir' : 'engine',
'inst_subdir' : os.path.join('lib', 'python1.5', 'site-packages'),
+ 'rpm_dir' : '/usr/lib/scons',
'debian_deps' : [
'debian/changelog',
@@ -370,6 +371,7 @@ scons_script = {
'pkg' : project + '-script',
'src_subdir' : 'script',
'inst_subdir' : 'bin',
+ 'rpm_dir' : '/usr/bin',
'debian_deps' : [
'debian/changelog',
@@ -398,7 +400,7 @@ scons_script = {
scons = {
'pkg' : project,
- 'debian_deps' : [
+ 'debian_deps' : [
'debian/changelog',
'debian/control',
'debian/copyright',
@@ -409,7 +411,7 @@ scons = {
'debian/rules',
],
- 'files' : [
+ 'files' : [
'CHANGES.txt',
'LICENSE.txt',
'README.txt',
@@ -484,6 +486,7 @@ for p in [ scons ]:
open(manifest_in).readlines())
raw_files = src_files[:]
dst_files = src_files[:]
+ rpm_files = []
MANIFEST_in_list = []
@@ -499,12 +502,17 @@ for p in [ scons ]:
isubdir = p['subinst_dirs'][sp['pkg']]
MANIFEST_in = File(os.path.join(src, ssubdir, 'MANIFEST.in')).rstr()
MANIFEST_in_list.append(MANIFEST_in)
- f = map(lambda x: x[:-1], open(MANIFEST_in).readlines())
- raw_files.extend(f)
- src_files.extend(map(lambda x, s=ssubdir: os.path.join(s, x), f))
+ files = map(lambda x: x[:-1], open(MANIFEST_in).readlines())
+ raw_files.extend(files)
+ src_files.extend(map(lambda x, s=ssubdir: os.path.join(s, x), files))
+ for f in files:
+ r = os.path.join(sp['rpm_dir'], f)
+ rpm_files.append(r)
+ if f[-3:] == ".py":
+ rpm_files.append(r + 'c')
if isubdir:
- f = map(lambda x, i=isubdir: os.path.join(i, x), f)
- dst_files.extend(f)
+ files = map(lambda x, i=isubdir: os.path.join(i, x), files)
+ dst_files.extend(files)
for k in sp['filemap'].keys():
f = sp['filemap'][k]
if f:
@@ -589,7 +597,7 @@ for p in [ scons ]:
"tar xf .temp -C $UNPACK_TAR_GZ_DIR",
"rm -f .temp",
])
-
+
#
# Run setup.py in the unpacked subdirectory to "install" everything
# into our build/test subdirectory. The runtest.py script will set
@@ -655,18 +663,35 @@ for p in [ scons ]:
topdir = os.path.join(os.getcwd(), build, 'build',
'bdist.' + platform, 'rpm')
- BUILDdir = os.path.join(topdir, 'BUILD', pkg + '-' + version)
- RPMSdir = os.path.join(topdir, 'RPMS', 'noarch')
- SOURCESdir = os.path.join(topdir, 'SOURCES')
- SPECSdir = os.path.join(topdir, 'SPECS')
- SRPMSdir = os.path.join(topdir, 'SRPMS')
+ BUILDdir = os.path.join(topdir, 'BUILD', pkg + '-' + version)
+ RPMSdir = os.path.join(topdir, 'RPMS', 'noarch')
+ SOURCESdir = os.path.join(topdir, 'SOURCES')
+ SPECSdir = os.path.join(topdir, 'SPECS')
+ SRPMSdir = os.path.join(topdir, 'SRPMS')
+ specfile_in = os.path.join('rpm', "%s.spec.in" % pkg)
specfile = os.path.join(SPECSdir, "%s-1.spec" % pkg_version)
sourcefile = os.path.join(SOURCESdir, "%s.tar.gz" % pkg_version);
noarch_rpm = os.path.join(RPMSdir, "%s-1.noarch.rpm" % pkg_version)
src_rpm = os.path.join(SRPMSdir, "%s-1.src.rpm" % pkg_version)
- env.InstallAs(specfile, os.path.join('rpm', "%s.spec" % pkg))
+ def spec_function(target, source, env):
+ """Generate the RPM .spec file from the template file.
+
+ This fills in the %files portion of the .spec file with a
+ list generated from our MANIFEST(s), so we don't have to
+ maintain multiple lists.
+ """
+ c = open(str(source[0]), 'rb').read()
+ c = string.replace(c, '__RPM_FILES__', env['RPM_FILES'])
+ open(str(target[0]), 'wb').write(c)
+
+ rpm_files.sort()
+ rpm_files_str = string.join(rpm_files, "\n") + "\n"
+ rpm_spec_env = env.Copy(RPM_FILES = rpm_files_str)
+ rpm_spec_action = Action(spec_function, varlist=['RPM_FILES'])
+ rpm_spec_env.Command(specfile, specfile_in, rpm_spec_action)
+
env.InstallAs(sourcefile, tar_gz)
targets = [ noarch_rpm, src_rpm ]
@@ -875,14 +900,14 @@ if change:
env.Command(src_tar_gz, b_psv_stamp,
"tar cz${TAR_HFLAG} -f $TARGET -C build %s" % psv)
-
+
#
# Unpack the archive into build/unpack/scons-{version}.
#
unpack_tar_gz_files = map(lambda x, u=unpack_tar_gz_dir, psv=psv:
os.path.join(u, psv, x),
sfiles)
-
+
#
# We'd like to replace the last three lines with the following:
#
@@ -896,7 +921,7 @@ if change:
"tar xf .temp -C $UNPACK_TAR_GZ_DIR",
"rm -f .temp",
])
-
+
#
# Run setup.py in the unpacked subdirectory to "install" everything
# into our build/test subdirectory. The runtest.py script will set
@@ -938,16 +963,16 @@ if change:
zipenv = env.Copy(CD = 'build', PSV = psv)
zipenv.Command(src_zip, b_psv_stamp, zipit)
-
+
#
# Unpack the archive into build/unpack/scons-{version}.
#
unpack_zip_files = map(lambda x, u=unpack_zip_dir, psv=psv:
os.path.join(u, psv, x),
sfiles)
-
+
env.Command(unpack_zip_files, src_zip, unzipit)
-
+
#
# Run setup.py in the unpacked subdirectory to "install" everything
# into our build/test subdirectory. The runtest.py script will set
diff --git a/rpm/scons.spec b/rpm/scons.spec
deleted file mode 100644
index b746214..0000000
--- a/rpm/scons.spec
+++ /dev/null
@@ -1,171 +0,0 @@
-%define name scons
-%define version 0.11
-%define release 1
-
-Summary: an Open Source software construction tool
-Name: %{name}
-Version: %{version}
-Release: %{release}
-Source0: %{name}-%{version}.tar.gz
-#Copyright: Steven Knight
-License: MIT, freely distributable
-Group: Development/Tools
-BuildRoot: %{_tmppath}/%{name}-buildroot
-Prefix: %{_prefix}
-BuildArchitectures: noarch
-Vendor: Steven Knight <knight@scons.org>
-Packager: Steven Knight <knight@scons.org>
-Requires: python >= 1.5
-Url: http://www.scons.org/
-
-%description
-SCons is an Open Source software construction tool--that is, a build
-tool; an improved substitute for the classic Make utility; a better way
-to build software. SCons is based on the design which won the Software
-Carpentry build tool design competition in August 2000.
-
-SCons "configuration files" are Python scripts, eliminating the need
-to learn a new build tool syntax. SCons maintains a global view of
-all dependencies in a tree, and can scan source (or other) files for
-implicit dependencies, such as files specified on #include lines. SCons
-uses MD5 signatures to rebuild only when the contents of a file have
-really changed, not just when the timestamp has been touched. SCons
-supports side-by-side variant builds, and is easily extended with user-
-defined Builder and/or Scanner objects.
-
-%prep
-%setup
-
-%build
-python setup.py build
-
-%install
-python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
-mkdir -p $RPM_BUILD_ROOT/usr/man/man1
-gzip -c scons.1 > $RPM_BUILD_ROOT/usr/man/man1/scons.1.gz
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-/usr/bin/scons
-/usr/lib/scons/SCons/Action.py
-/usr/lib/scons/SCons/Action.pyc
-/usr/lib/scons/SCons/Builder.py
-/usr/lib/scons/SCons/Builder.pyc
-/usr/lib/scons/SCons/Defaults.py
-/usr/lib/scons/SCons/Defaults.pyc
-/usr/lib/scons/SCons/Environment.py
-/usr/lib/scons/SCons/Environment.pyc
-/usr/lib/scons/SCons/Errors.py
-/usr/lib/scons/SCons/Errors.pyc
-/usr/lib/scons/SCons/Job.py
-/usr/lib/scons/SCons/Job.pyc
-/usr/lib/scons/SCons/Node/Alias.py
-/usr/lib/scons/SCons/Node/Alias.pyc
-/usr/lib/scons/SCons/Node/FS.py
-/usr/lib/scons/SCons/Node/FS.pyc
-/usr/lib/scons/SCons/Node/__init__.py
-/usr/lib/scons/SCons/Node/__init__.pyc
-/usr/lib/scons/SCons/Optik/__init__.py
-/usr/lib/scons/SCons/Optik/__init__.pyc
-/usr/lib/scons/SCons/Optik/errors.py
-/usr/lib/scons/SCons/Optik/errors.pyc
-/usr/lib/scons/SCons/Optik/option.py
-/usr/lib/scons/SCons/Optik/option.pyc
-/usr/lib/scons/SCons/Optik/option_parser.py
-/usr/lib/scons/SCons/Optik/option_parser.pyc
-/usr/lib/scons/SCons/Options.py
-/usr/lib/scons/SCons/Options.pyc
-/usr/lib/scons/SCons/Platform/cygwin.py
-/usr/lib/scons/SCons/Platform/cygwin.pyc
-/usr/lib/scons/SCons/Platform/os2.py
-/usr/lib/scons/SCons/Platform/os2.pyc
-/usr/lib/scons/SCons/Platform/posix.py
-/usr/lib/scons/SCons/Platform/posix.pyc
-/usr/lib/scons/SCons/Platform/win32.py
-/usr/lib/scons/SCons/Platform/win32.pyc
-/usr/lib/scons/SCons/Platform/__init__.py
-/usr/lib/scons/SCons/Platform/__init__.pyc
-/usr/lib/scons/SCons/Scanner/C.py
-/usr/lib/scons/SCons/Scanner/C.pyc
-/usr/lib/scons/SCons/Scanner/Fortran.py
-/usr/lib/scons/SCons/Scanner/Fortran.pyc
-/usr/lib/scons/SCons/Scanner/Prog.py
-/usr/lib/scons/SCons/Scanner/Prog.pyc
-/usr/lib/scons/SCons/Scanner/__init__.py
-/usr/lib/scons/SCons/Scanner/__init__.pyc
-/usr/lib/scons/SCons/Script/__init__.py
-/usr/lib/scons/SCons/Script/__init__.pyc
-/usr/lib/scons/SCons/Script/SConscript.py
-/usr/lib/scons/SCons/Script/SConscript.pyc
-/usr/lib/scons/SCons/Sig/MD5.py
-/usr/lib/scons/SCons/Sig/MD5.pyc
-/usr/lib/scons/SCons/Sig/TimeStamp.py
-/usr/lib/scons/SCons/Sig/TimeStamp.pyc
-/usr/lib/scons/SCons/Sig/__init__.py
-/usr/lib/scons/SCons/Sig/__init__.pyc
-/usr/lib/scons/SCons/Taskmaster.py
-/usr/lib/scons/SCons/Taskmaster.pyc
-/usr/lib/scons/SCons/Tool/__init__.py
-/usr/lib/scons/SCons/Tool/__init__.pyc
-/usr/lib/scons/SCons/Tool/ar.py
-/usr/lib/scons/SCons/Tool/ar.pyc
-/usr/lib/scons/SCons/Tool/default.py
-/usr/lib/scons/SCons/Tool/default.pyc
-/usr/lib/scons/SCons/Tool/dvipdf.py
-/usr/lib/scons/SCons/Tool/dvipdf.pyc
-/usr/lib/scons/SCons/Tool/dvips.py
-/usr/lib/scons/SCons/Tool/dvips.pyc
-/usr/lib/scons/SCons/Tool/g++.py
-/usr/lib/scons/SCons/Tool/g++.pyc
-/usr/lib/scons/SCons/Tool/g77.py
-/usr/lib/scons/SCons/Tool/g77.pyc
-/usr/lib/scons/SCons/Tool/gas.py
-/usr/lib/scons/SCons/Tool/gas.pyc
-/usr/lib/scons/SCons/Tool/gcc.py
-/usr/lib/scons/SCons/Tool/gcc.pyc
-/usr/lib/scons/SCons/Tool/gnulink.py
-/usr/lib/scons/SCons/Tool/gnulink.pyc
-/usr/lib/scons/SCons/Tool/icc.py
-/usr/lib/scons/SCons/Tool/icc.pyc
-/usr/lib/scons/SCons/Tool/ifl.py
-/usr/lib/scons/SCons/Tool/ifl.pyc
-/usr/lib/scons/SCons/Tool/ilink.py
-/usr/lib/scons/SCons/Tool/ilink.pyc
-/usr/lib/scons/SCons/Tool/latex.py
-/usr/lib/scons/SCons/Tool/latex.pyc
-/usr/lib/scons/SCons/Tool/lex.py
-/usr/lib/scons/SCons/Tool/lex.pyc
-/usr/lib/scons/SCons/Tool/masm.py
-/usr/lib/scons/SCons/Tool/masm.pyc
-/usr/lib/scons/SCons/Tool/mingw.py
-/usr/lib/scons/SCons/Tool/mingw.pyc
-/usr/lib/scons/SCons/Tool/mslib.py
-/usr/lib/scons/SCons/Tool/mslib.pyc
-/usr/lib/scons/SCons/Tool/mslink.py
-/usr/lib/scons/SCons/Tool/mslink.pyc
-/usr/lib/scons/SCons/Tool/msvc.py
-/usr/lib/scons/SCons/Tool/msvc.pyc
-/usr/lib/scons/SCons/Tool/nasm.py
-/usr/lib/scons/SCons/Tool/nasm.pyc
-/usr/lib/scons/SCons/Tool/pdflatex.py
-/usr/lib/scons/SCons/Tool/pdflatex.pyc
-/usr/lib/scons/SCons/Tool/pdftex.py
-/usr/lib/scons/SCons/Tool/pdftex.pyc
-/usr/lib/scons/SCons/Tool/tar.py
-/usr/lib/scons/SCons/Tool/tar.pyc
-/usr/lib/scons/SCons/Tool/tex.py
-/usr/lib/scons/SCons/Tool/tex.pyc
-/usr/lib/scons/SCons/Tool/yacc.py
-/usr/lib/scons/SCons/Tool/yacc.pyc
-/usr/lib/scons/SCons/Util.py
-/usr/lib/scons/SCons/Util.pyc
-/usr/lib/scons/SCons/Warnings.py
-/usr/lib/scons/SCons/Warnings.pyc
-/usr/lib/scons/SCons/__init__.py
-/usr/lib/scons/SCons/__init__.pyc
-/usr/lib/scons/SCons/exitfuncs.py
-/usr/lib/scons/SCons/exitfuncs.pyc
-%doc /usr/man/man1/scons.1.gz
diff --git a/rpm/scons.spec.in b/rpm/scons.spec.in
new file mode 100644
index 0000000..57e69c3
--- /dev/null
+++ b/rpm/scons.spec.in
@@ -0,0 +1,53 @@
+%define name scons
+%define version 0.11
+%define release 1
+
+Summary: an Open Source software construction tool
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Source0: %{name}-%{version}.tar.gz
+#Copyright: Steven Knight
+License: MIT, freely distributable
+Group: Development/Tools
+BuildRoot: %{_tmppath}/%{name}-buildroot
+Prefix: %{_prefix}
+BuildArchitectures: noarch
+Vendor: Steven Knight <knight@scons.org>
+Packager: Steven Knight <knight@scons.org>
+Requires: python >= 1.5
+Url: http://www.scons.org/
+
+%description
+SCons is an Open Source software construction tool--that is, a build
+tool; an improved substitute for the classic Make utility; a better way
+to build software. SCons is based on the design which won the Software
+Carpentry build tool design competition in August 2000.
+
+SCons "configuration files" are Python scripts, eliminating the need
+to learn a new build tool syntax. SCons maintains a global view of
+all dependencies in a tree, and can scan source (or other) files for
+implicit dependencies, such as files specified on #include lines. SCons
+uses MD5 signatures to rebuild only when the contents of a file have
+really changed, not just when the timestamp has been touched. SCons
+supports side-by-side variant builds, and is easily extended with user-
+defined Builder and/or Scanner objects.
+
+%prep
+%setup
+
+%build
+python setup.py build
+
+%install
+python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
+mkdir -p $RPM_BUILD_ROOT/usr/man/man1
+gzip -c scons.1 > $RPM_BUILD_ROOT/usr/man/man1/scons.1.gz
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+__RPM_FILES__
+%doc /usr/man/man1/scons.1.gz