Commits

Anonymous committed 15ca852

Create Debian package installation

Comments (0)

Files changed (10)

 $aesub = cons::whereis('aesub');
 $rpm = cons::whereis('rpm');
 $jw = cons::whereis('jw');
+$dh_builddeb = cons::whereis('dh_builddeb');
+$fakeroot = cons::whereis('fakeroot');
 
 #
 # Now grab the information that we "build" into the files (using sed).
 	chomp(@src_files);
 
 	foreach $file (@src_files) {
-	    $env->Command("build/$project-src/$file", $file, "%SEDCOM");
+	    $env->Command("build/$project-src/$file", 
+			  $file, 
+	                  qq(%SEDCOM
+                             chmod --reference=%< %>)
+            );
 	}
 
 	$env->Command("build/dist/$project-src-$version.tar.gz",
 		      map("build/$project-src/$_", @src_files),
 		      qq(
 		rm -rf build/$project-src-$version
-		cp -r build/$project-src build/$project-src-$version
+		cp -rp build/$project-src build/$project-src-$version
 		find build/$project-src-$version -name .consign -exec rm {} \\;
 		tar zcf %> -C build $project-src-$version
 	));
     }
 }
+
+#
+# Build the Debian packages if debhelper and fakeroot are available
+#
+if ($dh_builddeb && $fakeroot){
+    @deb_targets = ("build/dist/scons_$version-1_all.deb", 
+		    "build/dist/python-scons_$version-1_all.deb",
+		    "build/dist/python2-scons_$version-1_all.deb"
+		   );
+    
+    @deb_deps = ("debian/rules",
+		 "debian/control",
+		 "debian/changelog",
+		 "debian/copyright",
+		 "debian/python-scons.postinst",
+		 "debian/python-scons.prerm",
+		 "debian/python2-scons.postinst",
+		 "debian/python2-scons.prerm"
+		);
+    
+    chomp(@engine_files = `cat src/engine/MANIFEST`);
+    chomp(@script_files = `cat src/script/MANIFEST`);
+    
+    $env->Command([@deb_targets], 
+		  @deb_deps,
+		  map("build/engine/$_", @engine_files),
+		  map("build/script/$_", @script_files),
+		  qq(rm -rf build/engine/build build/engine/dist
+		     rm -rf build/script/build build/script/dist
+		     fakeroot debian/rules ENVOKED_BY_CONSTRUCT=1 binary
+		     env DH_COMPAT=3 dh_clean
+    ));
+}
         The Aegis configuration, governing much of how we use Aegis to
         build, test, control source, etc.
 
+debian/
+	Files needed to construct a Debian package. The contents of this
+	directory are dictated by the Debian Policy Manual
+	(http://www.debian.org/doc/debian-policy). The package will not be
+	accepted into the Debian distribution unless the contents of this
+	directory satisfy the relevant Debian policies.
+
 etc/
         A subdirectory for miscellaneous things that we need.  Right
         now, it has copies of Python modules that we use for testing,
+scons (0.01-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Anthony Roach <aroach@electriceyeball.com>  Mon,  1 Oct 2001 23:24:45 -0500
+
+
+Source: scons
+Section: devel
+Priority: extra
+Maintainer: Anthony Roach <aroach@electriceyeball.com>
+Standards-Version: 3.5.6.0
+Build-Depends: debhelper
+
+Package: scons
+Architecture: all
+Depends: python-scons|python2-scons,python-base(>=1.5.2)|python2-base
+Suggests: python-scons, python2-scons
+Description: An Open Source software construction tool
+ 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.
+
+Package: python-scons
+Architecture: all
+Depends: python-base(<<2.0), python-base(>=1.5.2)
+Description: SCons Python 1.5.2 extension modules
+ 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.
+
+Package: python2-scons
+Architecture: all
+Depends: python2-base(<<2.1), python2-base(>=2.0)
+Description: SCons Python 2.0 extension modules
+ 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.
+This package was debianized by Anthony Roach <aroach@electriceyeball.com>
+
+The package source can be downloaded from http://www.scons.org/
+
+Upstream Author: Steven Knight <knight@baldmt.com>
+
+Copyright (c) 2001 Steven Knight
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+

debian/python-scons.postinst

+#! /bin/sh -e
+#
+# postinst script for Debian python2 packages.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+# Modified for SCons 2001 by Anthony Roach <aroach@electriceyeball.com>.
+#
+
+PACKAGE=python-scons
+DIRLIST="/usr/lib/python1.5/site-packages/SCons"
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+        for i in $DIRLIST ; do
+            python2 -O /usr/lib/python1.5/compileall.py -q $i
+            python2 /usr/lib/python1.5/compileall.py -q $i
+        done
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0

debian/python-scons.prerm

+#! /bin/sh -e
+#
+# sample prerm script for Debian python2 packages.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+# Modified for SCons 2001 by Anthony Roach <aroach@electriceyeball.com>.
+#
+
+PACKAGE=python-scons
+
+dpkg --listfiles $PACKAGE |
+	awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+	xargs rm -f >&2
+
+#DEBHELPER#

debian/python2-scons.postinst

+#! /bin/sh -e
+#
+# postinst script for Debian python2 packages.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+# Modified for SCons 2001 by Anthony Roach <aroach@electriceyeball.com>.
+#
+
+PACKAGE=python2-scons
+DIRLIST="/usr/lib/python2.0/site-packages/SCons"
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+        for i in $DIRLIST ; do
+            python2 -O /usr/lib/python2.0/compileall.py -q $i
+            python2 /usr/lib/python2.0/compileall.py -q $i
+        done
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0

debian/python2-scons.prerm

+#! /bin/sh -e
+#
+# sample prerm script for Debian python2 packages.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+# Modified for SCons 2001 by Anthony Roach <aroach@electriceyeball.com>.
+#
+
+PACKAGE=python2-scons
+
+dpkg --listfiles $PACKAGE |
+	awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+	xargs rm -f >&2
+
+#DEBHELPER#
+#!/usr/bin/make -f
+
+#
+# This file is more complex than it needs to be to just build binary packages,
+# because it satisfies the relevant Debian policies. See ../README for more
+# information.
+#
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=3
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+ifeq ($(ENVOKED_BY_CONSTRUCT),1)
+BUILDDEB_OPTIONS=--destdir=build/dist
+endif
+
+build: build-stamp
+build-stamp:
+ifneq ($(ENVOKED_BY_CONSTRUCT),1)
+	dh_testdir
+	cons
+	touch build-stamp
+endif
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+	rm -rf build
+	find -name .construct -exec rm "{}" ";"
+	dh_clean
+
+install: DH_OPTIONS=
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+	python build/engine/setup.py install \
+--install-purelib=`pwd`/debian/python-scons/usr/lib/python1.5/site-packages --no-compile
+
+	python build/script/setup.py install \
+--install-scripts=`pwd`/debian/scons/usr/bin --no-compile
+
+	python build/engine/setup.py install \
+--install-purelib=`pwd`/debian/python2-scons/usr/lib/python2.0/site-packages --no-compile
+
+
+# This single target is used to build all the packages, all at once, or
+# one at a time. So keep in mind: any options passed to commands here will
+# affect _all_ packages. Anything you want to only affect one package
+# should be put in another target, such as the install target.
+binary-common:
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples
+# uncomment the following line once there is a man page:
+#	dh_installman build/doc/MAN/scons.1]
+	dh_installchangelogs 
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb $(BUILDDEB_OPTIONS)
+
+# Build architecture independant packages using the common target.
+binary-indep: build install
+	$(MAKE) ENVOKED_BY_CONSTRUCT=$(ENVOKED_BY_CONSTRUCT) -f debian/rules DH_OPTIONS=-i binary-common
+
+# Build architecture dependant packages using the common target.
+binary-arch: build install
+
+# Any other binary targets build just one binary package at a time.
+binary-scons: build install
+	$(MAKE) ENVOKED_BY_CONSTRUCT=$(ENVOKED_BY_CONSTRUCT) -f debian/rules binary-common DH_OPTIONS=-pscons
+
+binary-python-scons: build install
+	$(MAKE) ENVOKED_BY_CONSTRUCT=$(ENVOKED_BY_CONSTRUCT) -f debian/rules binary-common DH_OPTIONS=-ppython-scons
+
+binary-python2-scons: build install
+	$(MAKE) ENVOKED_BY_CONSTRUCT=$(ENVOKED_BY_CONSTRUCT) -f debian/rules binary-common DH_OPTIONS=-ppython2-scons
+
+binary: binary-indep binary-arch
+
+.PHONY: build clean binary-indep binary-arch binary install binary-scons binary-python-scons binary-python2-scons
+
+