You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/05/31 03:10:55 UTC
svn commit: r543005 - in
/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild:
config/projects/Genesis/Controller.groovy system/library/Library.groovy
Author: jdillon
Date: Wed May 30 18:10:54 2007
New Revision: 543005
URL: http://svn.apache.org/viewvc?view=rev&rev=543005
Log:
Add mirror/sync bits to library base
Modified:
geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Genesis/Controller.groovy
geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Genesis/Controller.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Genesis/Controller.groovy?view=diff&rev=543005&r1=543004&r2=543005
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Genesis/Controller.groovy (original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Genesis/Controller.groovy Wed May 30 18:10:54 2007
@@ -40,10 +40,13 @@
def repo = new gbuild.config.libraries.CodestationRepository()
def getLibrary = { name, version ->
- def lib = LibraryManager.getLibrary(repo, name, version)
+ return LibraryManager.getLibrary(repo, name, version)
}
- getLibrary('Build Harness/build/Build Harness', '3.*')
+ def lib = getLibrary('Build Harness/build/Build Harness', '3.*')
+
+ def workspaceDir = new File("${System.properties['user.home']}/gbuild/workspace/tmp")
+ lib.mirror(workspaceDir)
//
// .......
Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy?view=diff&rev=543005&r1=543004&r2=543005
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy (original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy Wed May 30 18:10:54 2007
@@ -44,6 +44,8 @@
this.baseDir = baseDir.canonicalFile
}
+ protected abstract Library createCloneForDir(File targetDir)
+
protected void exec(String command, List args) {
assert command
assert args
@@ -148,12 +150,63 @@
return lib
}
- protected abstract Library createCloneForDir(File targetDir)
-
Library copy(targetPath, String excludes) {
assert excludes
return copy(targetPath, [ excludes ])
+ }
+
+ Library mirror(targetPath, List excludes) {
+ assert targetPath
+
+ def targetDir = new File("$targetPath").canonicalFile
+
+ log.info "Mirroring library to: $targetDir; w/excludes: $excludes"
+
+ assert exists()
+
+ // Only make parent, so we don't end up with nested dir
+ targetDir.parentFile.mkdirs()
+
+ //
+ // NOTE: Using 'rsync' so that we can add excludes, and also have
+ // predictable behavior with trailing / on source dir
+ //
+
+ if (excludes) {
+ def excludesFile = File.createTempFile('rsync-excludes', '.txt')
+ excludesFile.deleteOnExit()
+ excludesFile.withPrintWriter { writer ->
+ excludes.each {
+ writer.println(it)
+ }
+ }
+
+ arg(value: "--exclude-from=$excludesFile")
+
+ exec('rsync', [ '--archive', '--recursive', '--delete', '--whole-file', '--no-perms', '--chmod=u+w', '--stats', '--human-readable', "--exclude-from=$excludesFile", "${baseDir}/", targetDir ])
+
+ excludesFile.delete()
+ }
+ else {
+ exec('rsync', [ '--archive', '--recursive', '--delete', '--whole-file', '--no-perms', '--chmod=u+w', '--stats', '--human-readable', "${baseDir}/", targetDir ])
+ }
+
+ // Return new library instance, which is rooted to new dir
+ def lib = createCloneForDir(targetDir)
+ lib.isCopy = true
+
+ return lib
+ }
+
+ Library mirror(targetPath, String excludes) {
+ assert excludes
+
+ return mirror(targetPath, [ excludes ])
+ }
+
+ Library mirror(targetPath) {
+ return mirror(targetPath, [])
}
/**