
theory at bricolage
Apr 29, 2008, 7:11 PM
Post #1 of 1
(68 views)
Permalink
|
|
[8204] More simplifications of the Makefile, this time for creating
|
|
Revision: 8204 Author: theory Date: 2008-04-29 19:11:31 -0700 (Tue, 29 Apr 2008) ViewCVS: http://viewsvn.bricolage.cc/?rev=8204&view=rev Log Message: ----------- More simplifications of the Makefile, this time for creating inst/*.sql and getting rid of useless code for cloning. Now there are no more `:=`s in the Makefile. Modified Paths: -------------- bricolage/trunk/Makefile bricolage/trunk/inst/dist_sql.pl Modified: bricolage/trunk/Makefile =================================================================== --- bricolage/trunk/Makefile 2008-04-30 00:08:30 UTC (rev 8203) +++ bricolage/trunk/Makefile 2008-04-30 02:11:31 UTC (rev 8204) @@ -115,14 +115,11 @@ tar cvf bricolage-$(BRIC_VERSION).tar bricolage-$(BRIC_VERSION) gzip --best bricolage-$(BRIC_VERSION).tar -SQL_FILES := $(shell find lib -name '*.sql' -o -name '*.val' -o -name '*.con') -SQL_DIRS := $(shell find sql -maxdepth 1 -regex 'sql/.*' -a \! -regex 'sql/\.svn') - # This creates the apropriate sql initialization scripts for the databases with # directories in sql (directory names should conform to DBD:: package name, # ex: Pg for PostgresSQL). -inst/dist_sql : $(SQL_FILES) inst/dist_sql.pl - $(PERL) inst/dist_sql.pl $(SQL_DIRS) +inst/dist_sql : inst/dist_sql.pl + $(PERL) inst/dist_sql.pl sql/* .PHONY : distclean inst/dist_sql dist_dir rm_svn dist_tar check_dist @@ -169,9 +166,7 @@ clone_lightweight : $(PERL) inst/clone_lightweight.pl -CLONE_SQL_FILES := $(shell find inst -name 'clone_sql_*.pl') - -clone_sql : $(CLONE_SQL_FILES) +clone_sql : $(PERL) inst/clone_sql.pl clone_tar : @@ -213,7 +208,7 @@ $(PERL) inst/files.pl db : inst/db.pl database.db - $(PERL) inst/db.pl inst/dbload_*.sql + $(PERL) inst/db.pl files_with_hot_copy : config.db bconf/bricolage.conf $(PERL) inst/files.pl INSTALL HOT_COPY @@ -278,9 +273,8 @@ prep_uninstall : $(PERL) inst/uninstall.pl -DB_UNINST_FILES := $(shell find inst -name 'db_uninst_*.pl') -db_uninstall :$(DB_UNINST_FILES) - $(PERL) inst/db_uninstall.pl +db_uninstall : + $(PERL) inst/db_uninstall.pl inst/db_uninst_*.pl rm_files : $(PERL) inst/rm_files.pl Modified: bricolage/trunk/inst/dist_sql.pl =================================================================== --- bricolage/trunk/inst/dist_sql.pl 2008-04-30 00:08:30 UTC (rev 8203) +++ bricolage/trunk/inst/dist_sql.pl 2008-04-30 02:11:31 UTC (rev 8204) @@ -2,7 +2,7 @@ =head1 NAME -dist_sql.pl - script to create init scripts for the database sql files found +dist_sql.pl - script to create init scripts for the database sql files found in sql directory depending in directory name =head1 DESCRIPTION @@ -22,33 +22,13 @@ use strict; -our @SQL; +my @rdbmss = map { s/^sql//; $_ } grep { $_ !~ /[.]svn/ } @ARGV; -get_db_sql(); -create_sqls(); - -#all done -exit 0; - -sub get_db_sql { - my $temp; - while (@ARGV) { - $temp=shift @ARGV; - $temp=~s/sql\///; - unshift @SQL, $temp; - } +for my $rdbms (@rdbmss) { + for my $type qw(sql val con) { + system ( + "grep -vh '^--' `find sql/$rdbms -name '*.$type' | env " + . "LANG= LANGUAGE= LC_ALL=POSIX sort` > inst/$rdbms.sql" + ) and die "Errror concatenating *.$type files in sql/$rdbms into inst/$rdbms.sql"; + } } - -sub create_sqls { - my ($temp,$temp1); - while (@SQL) { - $temp=shift @SQL; - system ("grep -vh '^--' `find sql/".$temp ." -name '*.sql' | env " - . "LANG= LANGUAGE= LC_ALL=POSIX sort` > inst/".$temp.".sql"); - system ("grep -vh '^--' `find sql/".$temp ." -name '*.val' | env " - . "LANG= LANGUAGE= LC_ALL=POSIX sort` >> inst/".$temp.".sql"); - system ("grep -vh '^--' `find sql/".$temp ." -name '*.con' | env " - . "LANG= LANGUAGE= LC_ALL=POSIX sort` >> inst/".$temp.".sql"); - } -} -
|