|
From: <dor...@us...> - 2009-01-30 15:03:14
|
Revision: 1197
http://andro.svn.sourceforge.net/andro/?rev=1197&view=rev
Author: dorgan1983
Date: 2009-01-30 15:02:42 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
Adding in "Smart" Builder Hopefully this wont break anything
Modified Paths:
--------------
trunk/andro/application/andro.dd.yaml
trunk/andro/application/androBuild.php
trunk/andro/application/instances_p.php
Modified: trunk/andro/application/andro.dd.yaml
===================================================================
--- trunk/andro/application/andro.dd.yaml 2009-01-30 14:32:12 UTC (rev 1196)
+++ trunk/andro/application/andro.dd.yaml 2009-01-30 15:02:42 UTC (rev 1197)
@@ -36,7 +36,7 @@
content configapp:
columns: [ x4menu, deprecated ]
update:
- - [ "N","N" ]
+ - [ N, N ]
# ========================================================================
@@ -145,6 +145,7 @@
description: Preferred Template
type_id: vchar
colprec: 40
+
table instances:
module: apps
description: Instances
@@ -177,7 +178,28 @@
description: Version Code
type_id: char
colprec: 10
+
+column checksum:
+ description: Checksum
+ type_id: vchar
+ colprec: 100
+table instance_spec_checksums:
+ module: apps
+ description: Instance Spec Checksums
+ nomenu: "Y"
+
+ foreign_key instances:
+ primary_key: "Y"
+ allow_empty: "Y"
+ column spec_name:
+ prefix: spec_
+ description: Spec File
+ uisearch: "Y"
+ column checksum:
+ primary_key: "Y"
+ uisearch: "Y"
+
table instbuilds:
module: apps
description: Instance Builds
Modified: trunk/andro/application/androBuild.php
===================================================================
--- trunk/andro/application/androBuild.php 2009-01-30 14:32:12 UTC (rev 1196)
+++ trunk/andro/application/androBuild.php 2009-01-30 15:02:42 UTC (rev 1197)
@@ -87,7 +87,11 @@
// always reduces.
#$retval = $retval && $this->JSMinify();
- if ( !isset( $_REQUEST['code_only'] ) ) {
+ // DO 1-29-2009 trying to make the builder a little smarter
+ // this way a full build will only happen if the db spec files
+ // have been changed
+ $dbFilesChanges = $this->checkDBFilesForChanges();
+ if ( $dbFilesChanges ) {
// If we passed most basic, we prepare the database
// by loading stored procedures and making the zdd
// schema to use during build.
@@ -154,6 +158,85 @@
// ===================================================================
// ==========================================================
+// Routines to check db building files for changes
+// ==========================================================
+
+function checkDBFilesForChanges() {
+ global $parm;
+
+ $this->LogStage("Checking spec files for changes");
+
+ $changed = false;
+ $checksums = array();
+ $specboot = $parm["SPEC_BOOT"].".add";
+ $checksums[] = array(
+ 'file'=>$specboot,
+ 'md5'=>md5_file( $parm['DIR_PUB']."lib/".$specboot ),
+ 'fullpath'=>$parm['DIR_PUB']."lib/".$specboot
+ );
+ if ($parm["SPEC_LIST"]<>"") {
+ $speclist = explode(",",$parm["SPEC_LIST"]);
+ foreach ($speclist as $spec) {
+ if(substr($spec,-5)<>'.yaml') {
+ $file = $spec.".add";
+ } else {
+ $file = $spec;
+ }
+ $checksums[] = array(
+ 'file'=>$file,
+ 'md5'=>md5_file( $parm["DIR_PUB"]."application/".$file ),
+ 'fullpath'=>$parm["DIR_PUB"]."application/".$file
+ );
+ }
+ }
+ $checkqry = "SELECT relname FROM pg_class WHERE relname='instance_spec_checksums'";
+ $checkrslts = SQL_AllRows( $checkqry );
+ if ( count( $checkrslts ) == 0 ) {
+ $this->LogEntry("Instance tracking table doesnt exist yet...ignoring until next build");
+ return true;
+ }
+
+ foreach( $checksums as $checksum ) {
+ $query = "SELECT checksum,skey FROM " .ddTable_idResolve( 'instance_spec_checksums' ) ." WHERE
+ application=" .SQLFC( $parm['APP'] ) ." AND spec_name=" .SQLFC( $checksum['file'] )
+ .( isset( $parm['INST'] ) ? " AND instance=" .SQLFC( $parm['INST'] ) : '' );
+ $row = SQL_OneRow( $query );
+
+ if ( $row ) {
+ $this->LogEntry( 'Entry for ' .$checksum['file'] .' file found' );
+ if ( $row['checksum'] != $checksum['md5'] ) {
+ $this->LogEntry("Spec File Changed: " .$checksum['file'] );
+ $changed = true;
+ $checksum_update = array(
+ 'skey'=>$row['skey'],
+ 'checksum'=>md5_file( $checksum['fullpath'] )
+ );
+ SQLX_Update( 'instance_spec_checksums', $checksum_update );
+ $this->LogEntry( "Updating Entry" );
+ }
+ } else {
+ $this->LogEntry( 'Entry for ' .$checksum['file'] .' not found' );
+ $checksum_entry = array(
+ 'application'=>$parm['APP'],
+ 'instance'=>( isset( $parm['ISTANCE'] ) ? $parm['INST'] : '' ),
+ 'spec_name'=>$checksum['file'],
+ 'checksum'=>md5_file( $checksum['fullpath'] )
+ );
+ SQLX_Insert( 'instance_spec_checksums', $checksum_entry );
+ $this->LogEntry("Spec File Change:" .$checksum['file'] );
+ $changed = true;
+ }
+
+ }
+ if ( $changed ) {
+ $this->LogEntry( 'One or more spec files have changed: Proceeding with full build' );
+ } else {
+ $this->LogEntry( 'Spec files have not changed: Proceeding with mini build' );
+ }
+ return $changed;
+}
+
+// ==========================================================
// Database Connect Routines
// ==========================================================
function DB_Connect()
Modified: trunk/andro/application/instances_p.php
===================================================================
--- trunk/andro/application/instances_p.php 2009-01-30 14:32:12 UTC (rev 1196)
+++ trunk/andro/application/instances_p.php 2009-01-30 15:02:42 UTC (rev 1197)
@@ -97,21 +97,6 @@
,'gp_ver'=>$verx
)
);
- echo( '<br />' );
- echo hLinkPopup(
- '',
- 'Deploy code from
- version '.$verx
- ,array(
- 'gp_app'=>gp('gp_app')
- ,'gp_inst'=>gp('gp_inst')
- ,'gp_posted'=>1
- ,'gp_page'=>'instances_p2'
- ,'gp_out'=>'none'
- ,'gp_ver'=>$verx
- ,'code_only'=>1
- )
- );
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|