Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [r6912] Maximize Restore History

Reorg the scripts so we have better idea what goes with what.

wdashley 2011-04-07

removed /websites/build/trunk/docroot/builds/scripts/orxbuilddeb.rex
removed /websites/build/trunk/docroot/builds/scripts/orxbuilddocs.rex
removed /websites/build/trunk/docroot/builds/scripts/orxbuildrpm.rex
copied /websites/build/trunk/docroot/builds/scripts/orxbuilddeb.rex -> /websites/build/trunk/docroot/builds/scripts/guests/orxbuilddeb.rex
copied /websites/build/trunk/docroot/builds/scripts/orxbuilddocs.rex -> /websites/build/trunk/docroot/builds/scripts/guests/orxbuilddocs.rex
copied /websites/build/trunk/docroot/builds/scripts/orxbuildrpm.rex -> /websites/build/trunk/docroot/builds/scripts/guests/orxbuildrpm.rex
copied /websites/build/trunk/docroot/builds/scripts/buildall.rex -> /websites/build/trunk/docroot/builds/scripts/host/buildall.rex
copied /websites/build/trunk/docroot/builds/scripts/kvmdomain.cls -> /websites/build/trunk/docroot/builds/scripts/host/kvmdomain.cls
copied /websites/build/trunk/docroot/builds/scripts/orxbuildmachines.txt -> /websites/build/trunk/docroot/builds/scripts/host/orxbuildmachines.txt
copied /websites/build/trunk/docroot/builds/scripts/buildall.rex -> /websites/build/trunk/docroot/builds/scripts/host/copyall.rex
copied /websites/build/trunk/docroot/builds/scripts/kvmdomain.cls -> /websites/build/trunk/docroot/builds/scripts/host/buildmachine.cls
copied /websites/build/trunk/docroot/builds/scripts/orxbuildmachines.txt -> /websites/build/trunk/docroot/builds/scripts/guests/orxbuild.local.properties
/websites/build/trunk/docroot/builds/scripts/buildall.rex to /websites/build/trunk/docroot/builds/scripts/host/copyall.rex
--- a/websites/build/trunk/docroot/builds/scripts/buildall.rex
+++ b/websites/build/trunk/docroot/builds/scripts/host/copyall.rex
@@ -43,29 +43,17 @@
 
 -- This script should be invoked as follows:
 --
--- buildall.rex [location [machine [email]]]
+-- copyall.rex file [machine]
 --
 -- where
 --
--- location - (optional) the build type - trunk or branch
--- machine  - (optional) the target virtual machine
--- email    - (optional) The email address for the build report
+-- file    - the file to be copied
+-- machine - (optional) the target virtual machine
 
 
 -- initialization
 cmdline = arg(1)~strip()
-parse var cmdline location specific_machine email .
-if location = 'branch' then do
-   cmdargs = 'http://oorexx.svn.sourceforge.net/svnroot/oorexx/main/branches/4.1.0/trunk/'
-   cmdargs = cmdargs '/pub/www/build/docroot/builds/interpreter-main'
-   cmdargs = cmdargs email
-   end
-else do  -- trunk
-   cmdargs = 'http://oorexx.svn.sourceforge.net/svnroot/oorexx/main/trunk/'
-   cmdargs = cmdargs '/pub/www/build/docroot/builds/interpreter-main'
-   cmdargs = cmdargs email
-   end
-cmdargs = cmdargs~strip()
+parse var file specific_machine .
 machines = './orxbuildmachines.txt'
 
 -- get the contentst of the input file and create the build array
@@ -73,10 +61,10 @@
 
 -- do the build(s)
 if specific_machine <> '' then do
-   buildmachines~build_one(specific_machine, cmdargs)
+   buildmachines~copy_one(specific_machine, cmdargs)
    end
 else do  -- do all the machines
-   buildmachines~build_all(cmdargs)
+   buildmachines~copy_all(cmdargs)
    end
 return
 
/websites/build/trunk/docroot/builds/scripts/kvmdomain.cls to /websites/build/trunk/docroot/builds/scripts/host/buildmachine.cls
--- a/websites/build/trunk/docroot/builds/scripts/kvmdomain.cls
+++ b/websites/build/trunk/docroot/builds/scripts/host/buildmachine.cls
@@ -1,6 +1,7 @@
+#!/usr/bin/rexx
 /*----------------------------------------------------------------------------*/
 /*                                                                            */
-/* Description: Manage a KVM virtual domain.                                  */
+/* Description: Build ooRexx on all build machines.                           */
 /*                                                                            */
 /* Copyright (c) 2010-2011 Rexx Language Association. All rights reserved.    */
 /*                                                                            */
@@ -40,84 +41,138 @@
 /*----------------------------------------------------------------------------*/
 
 
+::requires 'kvmdomain.cls'
 
-::class kvmdomain public
 
-::attribute domainname get
-::attribute domainname set private
+/*----------------------------------------------------------------------------*/
+/* Class: buildmachines                                                       */
+/*----------------------------------------------------------------------------*/
+
+::class buildmachines public
+
+::attribute arr
 
 ::method init
-expose domainname
-use strict arg domainname
+use strict arg file
+lines = file_arrayin(file)
+self~arr = .array~new()
+do line over lines
+   if line~strip() = '' then iterate
+   if line~strip()~substr(1, 1) = '#' then iterate
+   if line~strip()~substr(1, 2) = '--' then iterate
+   parse var line osname addr userid cmd virt_flag .
+   self~arr~append(.buildmachine~new(osname, addr, userid, cmd, virt_flag))
+   end
 return
 
-::method startup
--- start a domain
-use strict arg
-domainid = self~name2id()
-if domainid <> '-' then return -1
-if userid() = 'root' then self~docmd('virsh start' self~domainname)
-else self~docmd('sudo virsh start' self~domainname)
-domainid = self~name2id()
-if domainid = '-' then return -1
-return 0
+::method build_all
+use strict arg cmdargs
+do machine over self~arr  -- do all the machines
+   machine~do_build(cmdargs)
+   end
+return
 
-::method shutdown
--- shutdown a domain
-use strict arg wait = .false
-domainid = self~name2id()
-if domainid = '-' then return 0
-if userid() = 'root' then self~docmd('virsh shutdown' self~domainname)
-else self~docmd('sudo virsh shutdown' self~domainname)
-if wait = .true then do i = 1 to 10
-   call SysSleep 5
-   domainid = self~name2id()
-   if domainid = '-' then return 0
+::method build_one
+use strict arg specific_machine, cmdargs
+if specific_machine <> '' then do
+   -- find the machine and do the build
+   do machine over buildarr
+      if specific_machine = machine~osname() then do
+         machine~do_build(cmdargs)
+         leave
+         end
+      end
+   else say specific_machine 'Error: not found.'
    end
-return 0
+else say 'Error: no machine specified.'
+return
 
-::method reboot
--- reboot a domain
-use strict arg
-domainid = self~name2id()
-if domainid = '-' then return 0
-if userid() = 'root' then self~docmd('virsh reboot' self~domainname)
-else self~docmd('sudo virsh reboot' self~domainname)
-return 0
+::method copy_all
+use strict arg cmdargs
+do machine over self~arr  -- do all the machines
+   machine~do_copy(cmdargs)
+   end
+return
 
-::method status
--- return the status of a domain
-use strict arg
-if userid() = 'root' then status = self~doCmd('virsh list --all', , self~domainname)
-else status = self~doCmd('sudo virsh list --all', , self~domainname)
-if status = .nil then return 'unknown'
-parse var status . . status
-return status~strip()
+::method copy_one
+use strict arg specific_machine, cmdargs
+if specific_machine <> '' then do
+   -- find the machine and do the build
+   do machine over buildarr
+      if specific_machine = machine~osname() then do
+         machine~do_copy(cmdargs)
+         leave
+         end
+      end
+   else say specific_machine 'Error: not found.'
+   end
+else say 'Error: no machine specified.'
+return
 
-::method name2id private
--- if the domain is running converts a domain name to a domainid,
--- otherwise it returns .nil
-use strict arg
-if userid() = 'root' then id = self~doCmd('virsh domid' self~domainname, 1)
-else  id = self~doCmd('sudo virsh domid' self~domainname, 1)
-if id = .nil then return id
-return id~strip()
 
-::method doCmd private
--- perform the command and possibly return one line of the resulting output
-use strict arg cmd, line = '', srch = ''
-tmpname = SystempFileName('/tmp/kvmdomain.???')
-address bash cmd '2>&1 >' tmpname
-tmp = .stream~new(tmpname)
-tmp~open('read')
-arr = tmp~arrayin()
-tmp~close()
-call SysFileDelete tmpname
-if line = '' & srch = '' then return .nil
-if line <> '' & srch <> '' then return .nil
-if line <> '' & srch = '' then return arr[line]
-else do mem over arr
-   if mem~pos(srch) > 0 then return mem
+/*----------------------------------------------------------------------------*/
+/* Class: buildmachine                                                        */
+/*----------------------------------------------------------------------------*/
+
+::class buildmachine
+
+::attribute osname
+::attribute addr
+::attribute userid
+::attribute cmd
+::attribute virt_flag
+
+::method init
+expose osname addr userid cmd virt_flag
+use strict arg osname, addr, userid, cmd, virt_flag = .true
+return
+
+::method do_build
+expose osname addr userid cmd virt_flag
+use strict arg cmdargs
+if virt_flag = .true then do
+   -- start the domain
+   domain = .kvmdomain~new(osname)
+   retc = domain~startup()
+   if retc <> 0 then return
+   call SysSleep 90  -- allow some time for the domain to fully start
    end
-return .nil
+if cmdargs = '' then cmdline = cmd
+else cmdline = cmd cmdargs
+'ssh' userid'@'addr '"'cmdline'"'
+if virt_flag = .true then do
+   retc = domain~shutdown()
+   call SysSleep 90  -- allow some time for the domain to fully stop
+   end
+return
 
+::method do_copy
+expose osname addr userid virt_flag
+use strict arg file
+if virt_flag = .true then do
+   -- start the domain
+   domain = .kvmdomain~new(osname)
+   retc = domain~startup()
+   if retc <> 0 then return
+   call SysSleep 90  -- allow some time for the domain to fully start
+   end
+'scp' file userid'@'addr':/home/'userid
+if virt_flag = .true then do
+   retc = domain~shutdown()
+   call SysSleep 90  -- allow some time for the domain to fully stop
+   end
+return
+
+
+/*----------------------------------------------------------------------------*/
+/* Routine: file_arrayin                                                      */
+/*----------------------------------------------------------------------------*/
+
+::routine file_arrayin
+use strict arg file
+strm = .stream~new(file)
+strm~open('read')
+arr = strm~arrayin()
+strm~close()
+return arr
+
/websites/build/trunk/docroot/builds/scripts/orxbuildmachines.txt to /websites/build/trunk/docroot/builds/scripts/guests/orxbuild.local.properties
--- a/websites/build/trunk/docroot/builds/scripts/orxbuildmachines.txt
+++ b/websites/build/trunk/docroot/builds/scripts/guests/orxbuild.local.properties
@@ -1,15 +1,11 @@
-# This file contains the list of build machine and all the information needed
-# to build ooRexx on each machine.
-
-# Always do the docs first
-fedora13-i386-orxbuild-1      192.168.0.21            dashley  /home/dashley/orxbuilddocs.rex  1
-
-# The rest can be done in any order
-fedora13-i386-orxbuild-1      192.168.0.21            dashley  /home/dashley/orxbuildrpm.rex   1
-fedora13-x86_64-orxbuild-1    192.168.0.22            dashley  /home/dashley/orxbuildrpm.rex   1
-ubuntu1004-i386-orxbuild-1    192.168.0.23            dashley  /home/dashley/orxbuilddeb.rex   1
-ubuntu1004-x86_64-orxbuild-1  192.168.0.24            dashley  /home/dashley/orxbuilddeb.rex   1
-
-#SLES10-s390x-orxbuild-1      oorexx.osdl.marist.edu  dashley  /home/dashley/orxbuildrpm.rex   0
+-- This is just a sample ooRexx build properties file.
+-- Note: Do not quote the string data. Do not place spaces on either side of the
+-- equal (=) sign. Doing either of these will cause strange problems.
 
 
+osname=fedora13-i386
+homedir=/home/dashley
+builddir=/home/dashley/buildorx
+lockfile=/tmp/ooRexxBuild.lock
+targetsys=dashley@build.oorexx.org
+