-
Notifications
You must be signed in to change notification settings - Fork 51
Build Aliases
Here are the aliases I use to build and rebuild Bricolage as I hack on it, run tests, etc. The trick is that I essentially use make dev
with different combinations of environment variables to get the build I want. The nice thing about make dev
is that the lib
and conf
directories are aliased to the Git checkout, and it handles all of the database building stuff. Together with the environment variable stuff added to 1.11.x, I can build and rebuild without any prompts.
First, there’s a function that does most of the work:
bbuild() { sudo /usr/local/bricolage/bin/bric_apachectl stop rm -rf /usr/local/bricolage perl Makefile.PL sudo make $@ BRICOLAGE_SSL_CERT=/etc/ssl/certs/servercert.pem BRICOLAGE_SSL_KEY=/etc/ssl/private/serverkey.pem dev }
The first line shuts down an existing instance of Bricolage, if any. The next line deletes it. The CERT stuff isn’t used for all my builds (not all use SSL), but they’re ignored if they’re not needed.
Now here are all of my build aliases:
alias pbuilds="bbuild BRICOLAGE_HTTPD_VERSION=apache2 BRICOLAGE_DB_TYPE=Pg BRICOLAGE_SSL=1" alias pbuilds1="bbuild BRICOLAGE_HTTPD_VERSION=apache BRICOLAGE_DB_TYPE=Pg BRICOLAGE_SSL=1" alias mbuilds="bbuild BRICOLAGE_HTTPD_VERSION=apache2 BRICOLAGE_DB_TYPE=mysql BRICOLAGE_SSL=1" alias mbuilds1="bbuild BRICOLAGE_HTTPD_VERSION=apache BRICOLAGE_DB_TYPE=mysql BRICOLAGE_SSL=1" alias pbuild="bbuild BRICOLAGE_HTTPD_VERSION=apache2 BRICOLAGE_DB_TYPE=Pg BRICOLAGE_SSL=0" alias pbuild1="bbuild BRICOLAGE_HTTPD_VERSION=apache BRICOLAGE_DB_TYPE=Pg BRICOLAGE_SSL=0" alias mbuild="bbuild BRICOLAGE_HTTPD_VERSION=apache2 BRICOLAGE_DB_TYPE=mysql BRICOLAGE_SSL=0" alias mbuild1="bbuild BRICOLAGE_HTTPD_VERSION=apache BRICOLAGE_DB_TYPE=mysql BRICOLAGE_SSL=0"
So they just vary the version of Apache, the RDBMS, and the SSL support. They all run for me without any prompts, so I can rebuild Bricolage in about a minute if I want to switch databases or Apache Web servers (as when I’m running Unit tests and want to make sure that everything passes in all environments). Be warned, however, that these aliases always drop and recreate the database, so if you have test data you want to keep, you’ll need to dump and restore the database yourself.
Hope you find this useful. Happy hacking!