From: g0dil Date: Fri, 31 Aug 2007 12:50:56 +0000 (+0000) Subject: Improve handling of SConfig and Doxyfile.local in debian build X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=c448a643750c87940ac41b3cef33b6379950aa54;p=senf.git Improve handling of SConfig and Doxyfile.local in debian build Add missing cleanup files git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@422 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/SConscript b/Packets/SConscript index 3ed13bf..37de48e 100644 --- a/Packets/SConscript +++ b/Packets/SConscript @@ -15,6 +15,7 @@ source_headers = [ f for f in glob.glob("*.hh") if 'defined(SENF_PACKETS_DECL_ONLY)' in file(f).read() ] source_headers.sort() makeAllIncludesHH('all_includes.hh', source_headers) +env.Clean('all','all_includes.hh') SENFSCons.StandardTargets(env) SENFSCons.Lib(env, @@ -26,3 +27,4 @@ SENFSCons.Doxygen(env, extra_sources = [ ]) SConscript(glob.glob("*/SConscript")) + diff --git a/debian/README b/README similarity index 100% rename from debian/README rename to README diff --git a/SConstruct b/SConstruct index 8739426..13e6954 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,6 @@ # -*- python -*- -import sys, glob, os.path, datetime, pwd, time +import sys, glob, os.path, datetime, pwd, time, fnmatch sys.path.append('senfscons') import SENFSCons @@ -28,6 +28,22 @@ def updateRevision(target, source, env): 'date': time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) } file('debian/changelog','w').write(changelog) +def nonemptyFile(f): + try: return os.stat(f).st_size > 0 + except OSError: return False + +def checkLocalConf(target, source, env): + if nonemptyFile('SConfig') or nonemptyFile('Doxyfile.local'): + print + print "You have made local modifications to 'SConfig' and/or 'Doxyfile.local'." + print "Building a debian package would remove those files." + print + print "To continue, remove the offending file(s) and try again. Alternatively," + print "build a source package using 'scons debsrc' and may then build debian" + print "binary packages from this source-package without disrupting your print local" + print "configuration." + print + return 1 ########################################################################### # Load utilities and setup libraries and configure build @@ -67,6 +83,8 @@ env.Append( 'LOGNAME' : logname, # needed by the debian build scripts 'CONCURRENCY_LEVEL' : env.GetOption('num_jobs') or "1" }, + CLEAN_PATTERNS = [ '*.pyc', 'semantic.cache', '.sconsign', '.sconsign.dblite' ], + BUILDPACKAGE_COMMAND = "dpkg-buildpackage -us -uc -rfakeroot -I.svn -IDoxyfile.local -ISConfig", ) Export('env') @@ -96,13 +114,20 @@ env.Default(libsenf) env.Alias('install_all', env.Install('$LIBINSTALLDIR', libsenf)) env.AlwaysBuild( - env.Alias('deb', [], [ updateRevision, - "dpkg-buildpackage -us -uc -rfakeroot -I.svn" ])) + env.Alias('deb', [], [ checkLocalConf, + updateRevision, + "$BUILDPACKAGE_COMMAND" ])) env.AlwaysBuild( env.Alias('debsrc', [], [ updateRevision, - "dpkg-buildpackage -us -uc -rfakeroot -S -I.svn" ])) + "$BUILDPACKAGE_COMMAND -S" ])) env.AlwaysBuild( - env.Alias('debbin', [], [ updateRevision, - "dpkg-buildpackage -us -uc -rfakeroot -nc" ])) + env.Alias('debbin', [], [ checkLocalConf, + updateRevision, + "$BUILDPACKAGE_COMMAND -nc" ])) + +env.Clean('all', [ os.path.join(path,f) + for path, subdirs, files in os.walk('.') + for pattern in env['CLEAN_PATTERNS'] + for f in fnmatch.filter(files,pattern) ]) diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index e69de29..0000000 diff --git a/debian/libsenf-dev.install b/debian/libsenf-dev.install index 8c16ec5..2bcc289 100644 --- a/debian/libsenf-dev.install +++ b/debian/libsenf-dev.install @@ -1,4 +1,4 @@ debian/tmp/usr/lib/libsenf.a debian/tmp/usr/lib/*.o usr/lib/senf-packets debian/tmp/usr/include -debian/README usr/share/doc/libsenf-dev +README usr/share/doc/libsenf-dev diff --git a/debian/libsenf-doc.install b/debian/libsenf-doc.install index 98ad065..4e4f96c 100644 --- a/debian/libsenf-doc.install +++ b/debian/libsenf-doc.install @@ -1,3 +1,3 @@ debian/tmp/usr/share/doc/libsenf-doc -debian/README usr/share/doc/libsenf-doc +README usr/share/doc/libsenf-doc debian/index.html usr/share/doc/libsenf-doc diff --git a/debian/rules b/debian/rules index 4491055..558debd 100755 --- a/debian/rules +++ b/debian/rules @@ -23,8 +23,8 @@ else endif # shared library versions, option 1 -version=2.0.5 -major=2 +#version=2.0.5 +#major=2 # option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so #version=`ls src/.libs/lib*.so.* | \ # awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` @@ -37,14 +37,18 @@ configure: configure-stamp configure-stamp: dh_testdir # # Add here commands to configure the package. + rm -f Doxyfile.local SConfig +# If needed, we could create new 'Doxyfile.local' and/or 'SConfig' files here. +# We don't remove them in 'clean' to allow building a source package from an +# individually configured svn working copy. touch configure-stamp - build: build-stamp build-stamp: configure-stamp dh_testdir # # Add here commands to compile the package. - scons -j $(CONCURRENCY_LEVEL) all final=1 + scons -j $(CONCURRENCY_LEVEL) final=1 + scons -j $(CONCURRENCY_LEVEL) all_docs final=1 touch $@ clean: @@ -53,7 +57,7 @@ clean: rm -f build-stamp configure-stamp # # Add here commands to clean up after the build process. -scons -c all - dh_clean + dh_clean install: build dh_testdir @@ -61,7 +65,7 @@ install: build dh_clean -k dh_installdirs # # Add here commands to install the package into debian/tmp - scons install_all final=1\ + scons -j $(CONCURRENCY_LEVEL) install_all final=1\ PREFIX='$(destdir)/usr' \ DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc' # We need to install the example sourcecode