Permalink
Browse files

Add rebuild command

  • Loading branch information...
1 parent 307fc43 commit 512e4a62cca15462e1aeb77a025704f83a89dfe0 Greg Smith committed Jun 21, 2011
Showing with 28 additions and 0 deletions.
  1. +1 −0 HISTORY
  2. +3 −0 README.rst
  3. +24 −0 peg
View
1 HISTORY
@@ -2,3 +2,4 @@
2010-01-04 Merged Solaris fixes from Robert Treat
2011-01-15 Add "clean" command and improve documentation
2011-05-08 Switch to git as default repo, more doc updates
+ 2011-06-20 Add "rebuild" command
View
3 README.rst
@@ -328,6 +328,9 @@ The following subcommands are accepted by peg:
don't start it. This is typically for if you know you need to modify the
database configuration before you start it.
* build: Build binaries, install them, create a cluster, start the database
+ * rebuild: Rebuild and install just the main binaries for the server in
+ the src/backend directory. When making changes to just the core server
+ code, this can save time over doing a full build.
* initdb: Create a cluster
* switch: Switch to an existing built binary set and cluster
* start: Start a cluster
View
24 peg
@@ -43,6 +43,7 @@ echo start: Start a cluster
echo stop: Stop a cluster
echo "rm: Remove all data from a project (but not the repo)"
echo "clean: Clean up the source code tree ('make maintainer-clean')"
+echo rebuild: Just build the main server files in the server backend
}
# Set $1 to $2 only if it's empty
@@ -385,6 +386,21 @@ function build {
$PGMAKE -j 4 && $PGMAKE install
}
+function rebuild {
+ # Check if initdb binary exists
+ if [ ! -x $PGENGINE/initdb ]; then
+ echo WARNING: No existing binary found, executing full build instead of rebuild
+ build
+ elif [ ! -f $PGSRC/$PGPROJECT/GNUmakefile ] ; then
+ echo "WARNING: Didn't find an existing GNUmakefile, executing full build instead of rebuild"
+ build
+ else
+ # Looks good to rebuild with install-bin here
+ cd $PGSRC/$PGPROJECT/src/backend
+ $PGMAKE install-bin
+ fi
+}
+
function initdb {
if [ ! -f "$PGDATA/PG_VERSION" ] ; then
$PGENGINE/initdb -D $PGDATA
@@ -587,6 +603,14 @@ elif [ "$COMMAND" = "build" ] ; then
wrap start
wrap add_user_db
+elif [ "$COMMAND" = "rebuild" ] ; then
+ wrap require_project
+ wrap rebuild
+ wrap require_binary
+ wrap initdb
+ wrap start
+ wrap add_user_db
+
elif [ "$COMMAND" = "initdb" ] ; then
# Explicitly calling initdb suggests the caller wants to adjust the
# postgresql.conf before starting

0 comments on commit 512e4a6

Please sign in to comment.