]> git.imager.perl.org - bse.git/blobdiff - Makefile
make sure the version installed is updated on a testup with changed files
[bse.git] / Makefile
index b8609a68688044f9ec3aec7727696213176b0c49..2d8f39cb05eab258d52ea0a046e1f2c051804e8d 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,20 @@
-VERSION=0.14_22
+VERSION=0.19
 DISTNAME=bse-$(VERSION)
 DISTBUILD=$(DISTNAME)
 DISTTAR=../$(DISTNAME).tar
 DISTTGZ=$(DISTTAR).gz
 WEBBASE=/home/httpd/html/bse
 
+MODULES=$(shell grep cgi-bin/.*\.pm MANIFEST | sed -e '/^\#/d' -e 's/[ \t].*//' -e '/^site\/cgi-bin\/modules\/BSE\/\(Modules\|Version\)\.pm/d' )
+VERSIONDEPS=$(shell perl site/util/bse_versiondeps.pl MANIFEST)
+
 help:
        @echo make dist - build the tar.gz file and copy to distribution directory
-       @echo make archive - build the tar.gz (in the parent directory)
+       @echo make 'archive - build the tar.gz (in the parent directory)'
        @echo make clean - delete generated files
        @echo make distdir - build distribution directory
        @echo make docs - build documentation
+       @echo make testup - upgrade an installation
 
 # this target needs to be modified so that the output directory includes
 # the release number
@@ -18,14 +22,15 @@ dist: cleantree $(DISTTGZ)
        cp $(DISTTGZ) $(WEBBASE)/dists/
        cp site/docs/bse.html $(WEBBASE)/relnotes/bse-$(VERSION).html
        cp site/docs/*.html $(WEBBASE)/docs
-       cvs tag r`echo $(VERSION) | tr . _`
+       git tag -m "$(VERSION) release" r$(VERSION)
 
 # make sure everything is committed
 cleantree:
-       if cvs status 2>/dev/null | grep -q '^\?\|Locally Modified' ; \
-          then echo '***' The tree has modified or unadded files ; \
-          exit 1 ; \
-        fi
+       if grep -q 'perl.*-d:ptkdb' site/cgi-bin/*.pl site/cgi-bin/admin/*.pl ; \
+         then echo '***' The debugger is still enabled ; \
+         exit 1; \
+       fi
+       test -z "`git status -s`" || ( echo "Uncommitted files in the tree"; exit 1 )
 
 archive: $(DISTTGZ)
 
@@ -40,11 +45,14 @@ $(DISTTGZ): distdir
 
 #      tar czf $(DISTFILE) -C .. bse --exclude '*~' --exclude '*,v' --exclude 'pod2html-*cache'
 
-distdir: docs dbinfo version
+# recent ExtUtils::Manifest don't copy the executable bit, fix that here
+
+distdir: docs dbinfo version modversion
        -perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
        perl -MExtUtils::Manifest=manicopy,maniread -e "manicopy(maniread(), '$(DISTBUILD)')"
        mkdir $(DISTBUILD)/site/htdocs/shop
        find $(DISTBUILD) -type f | xargs chmod u+w
+       for i in `cat MANIFEST` ; do if [ -x $$i ] ; then chmod a+x $(DISTBUILD)/$$i ; fi ; done
 
 clean:
        -perl -MExtUtils::Command -e rm_f site/htdocs/index.html site/htdocs/shop/*.html site/htdocs/a/*.html
@@ -64,7 +72,7 @@ INSTALL.txt: INSTALL.pod
 
 INSTALL.html: INSTALL.pod
        pod2html --infile=INSTALL.pod --outfile=INSTALL.html
-       -rm pod2html-dircache pod2html-itemcache
+       -rm pod2html-dircache pod2html-itemcache pod2htmd.tmp pod2htmi.tmp
 
 otherdocs:
        cd site/docs ; make all
@@ -76,30 +84,38 @@ site/util/mysql.str: schema/bse.sql
 
 version: site/cgi-bin/modules/BSE/Version.pm
 
-site/cgi-bin/modules/BSE/Version.pm: Makefile
-       echo 'package BSE::Version;' >site/cgi-bin/modules/BSE/Version.pm
-       echo 'use strict;' >>site/cgi-bin/modules/BSE/Version.pm
-       echo  >>site/cgi-bin/modules/BSE/Version.pm
-       echo 'my $$VERSION = "$(VERSION)";' >>site/cgi-bin/modules/BSE/Version.pm
-       echo  >>site/cgi-bin/modules/BSE/Version.pm
-       echo 'sub version { $$VERSION }' >>site/cgi-bin/modules/BSE/Version.pm
-       echo  >>site/cgi-bin/modules/BSE/Version.pm
-       echo '1;' >>site/cgi-bin/modules/BSE/Version.pm
+site/cgi-bin/modules/BSE/Version.pm: $(VERSIONDEPS)
+       perl site/util/bse_mkgitversion.pl $(VERSION) site/cgi-bin/modules/BSE/Version.pm
+
+modversion: site/cgi-bin/modules/BSE/Modules.pm
+
+site/cgi-bin/modules/BSE/Modules.pm: $(MODULES) site/util/make_versions.pl
+       perl site/util/make_versions.pl site/cgi-bin/modules/BSE/Modules.pm
 
 # this is very rough
 testinst: distdir
        perl localinst.perl $(DISTBUILD)
        perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       cd `perl -lne 'do { print $$1; exit; } if /^base_dir\s*=\s*(.*)/' test.cfg`/util ; perl loaddata.pl ../data/db
 
-testfiles: distdir
+testup: checkver distdir
        perl localinst.perl $(DISTBUILD) leavedb
        perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
+       cd `perl -lne 'do { print $$1; exit; } if /^base_dir\s*=\s*(.*)/' test.cfg`/util ; perl upgrade_mysql.pl -b ; perl loaddata.pl ../data/db
+
+checkver:
+       if [ -d .git ] ; then perl site/util/check_versions.pl ; fi
 
-test: testinst
-       perl -MTest::Harness=runtests -Isite/cgi-bin/modules -It -e 'runtests glob q!t/*.t!'
+TEST_FILES=t/*.t
+
+test: testup
+       perl -MTest::Harness=runtests -Isite/cgi-bin/modules -It -e 'runtests @ARGV' $(TEST_FILES)
 
 manicheck:
        perl -MExtUtils::Manifest=manicheck -e 'manicheck()'
 
 filecheck:
        perl -MExtUtils::Manifest=filecheck -e 'filecheck()'
+
+manifest:
+       perl -MExtUtils::Manifest=mkmanifest -e mkmanifest