From: Will P. <pa...@us...> - 2002-09-27 16:55:23
|
Update of /cvsroot/ark/ARK/arkbase/ark In directory usw-pr-cvs1:/tmp/cvs-serv15701/arkbase/ark Modified Files: ChangeLog host.py thing.py Log Message: updates Index: ChangeLog =================================================================== RCS file: /cvsroot/ark/ARK/arkbase/ark/ChangeLog,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** ChangeLog 26 Sep 2002 17:13:00 -0000 1.40 --- ChangeLog 27 Sep 2002 16:55:19 -0000 1.41 *************** *** 1,2 **** --- 1,12 ---- + 2002-09-27 Will Partain <wil...@ve...> + + * host.py (ArkHost.pgmResource): If we get a program resource + with no '/' in its value (e.g. not an absolute path), then we + return that straight away. We presume that something PATH-ish + will help the user to find what it wants. + + * thing.py (ArkHost.preambleSh): add sidaiPickProgram shell + function; makes things much tidier elsewhere (in the .xml files). + 2002-09-26 Will Partain <wil...@ve...> Index: host.py =================================================================== RCS file: /cvsroot/ark/ARK/arkbase/ark/host.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** host.py 26 Sep 2002 17:13:01 -0000 1.53 --- host.py 27 Sep 2002 16:55:19 -0000 1.54 *************** *** 457,461 **** # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ! #sys.__stderr__.write('user_ok=%(acting_user_is_correct)s,group_ok=%(acting_group_is_correct)s; invokee: %(invokee)s\ncode:<<>>\n'%vars()) # %(code)s sh = os.popen(invokee,'w', 0) # 0 => unbuffered --- 457,461 ---- # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ! #sys.__stderr__.write('user_ok=%(acting_user_is_correct)s,group_ok=%(acting_group_is_correct)s; invokee: %(invokee)s\ncode:<<%(code)s>>\n'%vars()) # sh = os.popen(invokee,'w', 0) # 0 => unbuffered *************** *** 554,557 **** --- 554,565 ---- # ---------------------------------------------------- + def __rel_pathname(self, name): + """ + If it's 'just a word', then yes; otherwise no. + """ + if string.find(name, '/'): + return 0 + return 1 + def pgmResource(self, res_name, check_on_host=1, fall_back_to=None): """ *************** *** 562,565 **** --- 570,577 ---- try the resources in the 'fall_back_to' list (if any). + At any point, if we hit a "relative pathname" (no / anywhere + in it), then we declare victory and return that. (We assume + some sort of path will ride to the rescue.) + Note: if not check_on_host, then we don't/can't do any falling back. *************** *** 568,572 **** pgm_w1 = string.split(pgm,' ')[0] # first word... ! if not check_on_host: return pgm run_host = RUN_HOST() --- 580,585 ---- pgm_w1 = string.split(pgm,' ')[0] # first word... ! if self.__rel_pathname(pgm) or not check_on_host: ! return pgm run_host = RUN_HOST() *************** *** 586,590 **** pgm = ark.utils.evalArkString(getattr(self, fb)()) pgm_w1 = string.split(pgm,' ')[0] # first word... ! if os.path.exists(pgm_w1): return pgm raise ark.error.NoSuchResource, no_such_msg --- 599,603 ---- pgm = ark.utils.evalArkString(getattr(self, fb)()) pgm_w1 = string.split(pgm,' ')[0] # first word... ! if self.__rel_pathname(pgm) or os.path.exists(pgm_w1): return pgm raise ark.error.NoSuchResource, no_such_msg Index: thing.py =================================================================== RCS file: /cvsroot/ark/ARK/arkbase/ark/thing.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -r1.62 -r1.63 *** thing.py 24 Sep 2002 13:24:10 -0000 1.62 --- thing.py 27 Sep 2002 16:55:19 -0000 1.63 *************** *** 2011,2027 **** envvars = string.join(envvars,'; ') # dynamic typing, what? ! preamble="""%s ! VERBOSE='%s' ! PRETEND='%s' ! KEEP_GOING='%s' ! HARD_UNDO='%s' ! PATH='%s';export PATH # don't leave PATH to chance! ! """ % ( envvars ! , verbose ! , pretend ! , keep_going ! , hard_undo ! , ark.utils.evalArkString(proxy_host.ARK_BUILDING_PATH()) ! ) if what == 'team': --- 2011,2046 ---- envvars = string.join(envvars,'; ') # dynamic typing, what? ! ark_building_PATH = ark.utils.evalArkString(proxy_host.ARK_BUILDING_PATH()) ! ! preamble="""%(envvars)s ! VERBOSE='%(verbose)s' ! PRETEND='%(pretend)s' ! KEEP_GOING='%(keep_going)s' ! HARD_UNDO='%(hard_undo)s' ! PATH='%(ark_building_PATH)s';export PATH # don't leave PATH to chance! ! ! # useful shell function: ! sidaiPickProgram () { ! for p in "$@" ; do ! case "$p" in ! /*|./*|../*) ! p_w1=`echo $p | sed -e 's/ .*//'` ! if [ -x "$p_w1" ] ; then ! echo $p ! return ! fi ! ;; ! ! *) # relative path, so don't even try ! echo $p ! return ! ;; ! esac ! done ! echo "No executable program among: $*" 2>& 1 ! exit 1 ! } ! ! """ % vars() if what == 'team': *************** *** 2051,2062 **** (pkg_deploy_dirs,xxx) = thing.deployDirs() preamble=preamble+""" ! umask %s # so we don't pick up something random from ssh/rsh ! PKG_BUILD_DIR='%s' ! PKG_DEPLOY_DIRS='%s' ! """ % ( package_umask ! , this_pkg_build_dir ! , string.join(pkg_deploy_dirs,' ') # ToDo: won't work if these pathnames include spaces ! ) #ark-site:{{self.actExtra('package','preamble-sh',indent=12)}} --- 2070,2080 ---- (pkg_deploy_dirs,xxx) = thing.deployDirs() + pkg_deploy_dirs2 = string.join(pkg_deploy_dirs,' ') # ToDo: won't work if these pathnames include spaces + preamble=preamble+""" ! umask %(package_umask)s # so we don't pick up something random from ssh/rsh ! PKG_BUILD_DIR='%(this_pkg_build_dir)s' ! PKG_DEPLOY_DIRS='%(pkg_deploy_dirs2)s' ! """ % vars () #ark-site:{{self.actExtra('package','preamble-sh',indent=12)}} *************** *** 2071,2077 **** set -e set -u ! %s ! """ % ( set_x ! ) #print 'preamble=',`preamble` --- 2089,2094 ---- set -e set -u ! %(set_x)s ! """ % vars() #print 'preamble=',`preamble` |