/[gnue]/gnue-common/setup-cvs.py
ViewVC logotype

Diff of /gnue-common/setup-cvs.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.54 by reinhard, Thu Sep 25 23:23:57 2003 UTC revision 1.55 by jcater, Fri Sep 26 01:07:46 2003 UTC
# Line 23  Line 23 
23  import sys, string, os, glob  import sys, string, os, glob
24    
25    
26  BASEDIR = os.path.abspath(os.path.join(os.getcwd(), '../.cvsdevelbase'))  BASEDIR = os.path.abspath(os.path.join(os.getcwd(), '.cvsdevelbase'))
27  CVSDIR = os.path.abspath(os.path.join(os.getcwd(),'..'))  CVSDIR = os.path.abspath(os.path.join(os.getcwd(),'..'))
28  PYTHONBIN=sys.executable  PYTHONBIN=sys.executable
29    
30    CURRENT_TOOL = ""
31  rootCommands = []  rootCommands = []
32    
33  def createCVS (scriptdir,script,py):  def createShell (script,py,scriptdir="scripts"):
34    script = "%s%s" % (script, SUFFIX)    script = "%s%s" % (script, SUFFIX)
35    print "Creating %s....." % os.path.join('..',scriptdir, script) ,    dest = os.path.join(CURRENT_DIR, scriptdir, script)
36      print "Creating %s....." % dest ,
37    try:    try:
38      file = open(os.path.join('..',scriptdir, script),'w')      file = open(dest,'w')
39      file.write(cvsbase % py)      file.write(cvsbase % py)
40      file.close()      file.close()
41      os.system ('chmod 700 %s/%s/%s' % (CVSDIR,scriptdir, script))      os.system ('chmod 700 %s' % dest)
42    
43      rootCommands.append ('rm -f %s/%s' % (BINDIR, script))      rootCommands.append ('rm -f %s/%s' % (BINDIR, script))
44      rootCommands.append ('ln -s %s/%s/%s %s/%s' % \      rootCommands.append ('ln -s %s %s/%s' % \
45            (CVSDIR, scriptdir, script, BINDIR, script))            (dest, BINDIR, script))
46      rootCommands.append ('chmod o+x %s/%s/%s' % (CVSDIR,scriptdir, script))      rootCommands.append ('chmod o+x %s' % dest)
47    except IOError:    except IOError:
48      print "Unable to create.  Do you have this package checked out?"      print "Unable to create.  Do you have this package checked out?"
49    else:    else:
50      print "ok"      print "ok"
51    
52  def createDocs(sgmlfile, destdir):  def createDocs(sgmlfile, destdir):
53    sgmlfile = os.path.join(CVSDIR, sgmlfile)    if not willInstallDocs:
54        return
55      sgmlfile = os.path.join(CURRENT_DIR, sgmlfile)
56    destdir  = os.path.join(DOCDIR, destdir)    destdir  = os.path.join(DOCDIR, destdir)
57    rootCommands.append("if [ ! -d %s ]; then mkdir %s; fi" % (destdir, destdir))    rootCommands.append("if [ ! -d %s ]; then mkdir %s; fi" % (destdir, destdir))
58    rootCommands.append("%s --output %s %s" %    rootCommands.append("%s --output %s %s" %
# Line 74  def getInput(message, default, responseS Line 78  def getInput(message, default, responseS
78        return val        return val
79    
80    
81  def getYesNo(message, default=None):  _getYesNoAllStat = {}
82    return getInput(message,default,('Y','N')) == 'Y'  
83    def getYesNo(message, default=None, category=None):
84      if category:
85        try:
86          response = _getYesNoAllStat[category]
87          print "\n" + message + ' ' + (response and 'Always' or 'Never')
88          return response
89        except KeyError:
90          pass
91    
92      response = getInput(message,default,('Y','N','A','V'))
93      val = response in ('Y','A')
94      if category and response in ('A','V'):
95        _getYesNoAllStat[category] = val
96      return val
97    
98    
99  def getBinPaths():  def getBinPaths():
# Line 99  def findAllPythonExes(): Line 117  def findAllPythonExes():
117        # Do not include python 1.x files        # Do not include python 1.x files
118        if version < '2':        if version < '2':
119          pass          pass
120          
121        # Do not include python2.2-popy-config        # Do not include python2.2-popy-config
122        elif len(version)>8:        elif len(version)>8:
123          pass          pass
# Line 113  def findAllPythonExes(): Line 131  def findAllPythonExes():
131    
132    return results    return results
133    
134    def findAllGNUePackages():
135      results = []
136      for file in glob.glob('../*'):
137        if os.path.isfile(os.path.join(file, 'setup.cvs')):
138          base = os.path.basename(file)
139          results.append(base)
140      results.sort()
141      return results
142    
143  def finddb2html():  def finddb2html():
144    for path in getBinPaths():    for path in getBinPaths():
# Line 264  ROOTINSTALL = getInput( Line 290  ROOTINSTALL = getInput(
290  if ROOTINSTALL:  if ROOTINSTALL:
291    BINDIR = "/usr/local/bin"    BINDIR = "/usr/local/bin"
292    CONFDIR = "/usr/local/gnue"    CONFDIR = "/usr/local/gnue"
293    DOCDIR = "/usr/share/doc/gnue"    DOCDIR = "/usr/local/gnue/doc/"
294  else:  else:
295    BINDIR = os.path.expanduser("~/bin")    BINDIR = os.path.expanduser("~/bin")
296    CONFDIR = os.path.expanduser("~/gnue")    CONFDIR = os.path.expanduser("~/gnue")
# Line 276  while 1: Line 302  while 1:
302           getInput ("Where shall I put executable files?", BINDIR))           getInput ("Where shall I put executable files?", BINDIR))
303    
304    if os.path.isdir(BINDIR) or \    if os.path.isdir(BINDIR) or \
305        getYesNo("Directory %s does not exist. Create?" % BINDIR, 'Y'):        getYesNo("Directory %s does not exist. Create? (Yes,No,All,neVer)" % BINDIR, 'Y','directories'):
306      break      break
307    
308  print """  print """
# Line 294  while 1: Line 320  while 1:
320           getInput ("Where shall I put configuration files?", CONFDIR))           getInput ("Where shall I put configuration files?", CONFDIR))
321    
322    if os.path.isdir(CONFDIR) or \    if os.path.isdir(CONFDIR) or \
323        getYesNo("Directory %s does not exist. Create?" % CONFDIR, 'Y'):        getYesNo("Directory %s does not exist. Create? (Yes,No,All,neVer)" % CONFDIR, 'Y','directories'):
324      break      break
325    
326  newdirs = [BINDIR, CONFDIR, "%s/etc" % CONFDIR, "%s/shared" % CONFDIR,  newdirs = [BINDIR, CONFDIR, "%s/etc" % CONFDIR, "%s/shared" % CONFDIR,
# Line 312  if DB2HTML: Line 338  if DB2HTML:
338               getInput ("Where shall I put the documentation files?", DOCDIR))               getInput ("Where shall I put the documentation files?", DOCDIR))
339    
340        if os.path.isdir(DOCDIR) or \        if os.path.isdir(DOCDIR) or \
341            getYesNo("Directory %s does not exist. Create?" % DOCDIR, 'Y'):            getYesNo("Directory %s does not exist. Create? (Yes,No,All,neVer)" % DOCDIR, 'Y','directories'):
342          newdirs.append(DOCDIR)          newdirs.append(DOCDIR)
343          break          break
344  else:  else:
345    print "Cannot generate documentation, could not find db2html in path\n";    print "Cannot generate documentation, could not find db2html in path\n";
346    
 ######### fixing bugs created by changed installer ###########  
 # remove "%s/shared/grpc" % CONFDIR link  
 if os.path.islink("%s/shared/grpc" % CONFDIR):  
   rootCommands.append("rm %s/shared/grpc" % CONFDIR)  
   
 # remove "%s/shared/grpc" % CVSDIR link  
 if os.path.islink("%s/appserver/grpc/GEAS.grpc" % CVSDIR):  
   rootCommands.append("rm %s/appserver/grpc/GEAS.grpc" % CVSDIR)  
 ##############################################################  
347    
348  for dir in newdirs:  for dir in newdirs:
349    rootCommands.append("if [ ! -d %s ]; then mkdir %s; fi" % (dir,dir))    rootCommands.append("if [ ! -d %s ]; then mkdir %s; fi" % (dir,dir))
# Line 348  cvsbase = """#!/bin/sh Line 365  cvsbase = """#!/bin/sh
365       fi       fi
366       PYTHONPATH=%(BASEDIR)s:$PYTHONPATH; export PYTHONPATH       PYTHONPATH=%(BASEDIR)s:$PYTHONPATH; export PYTHONPATH
367       SCRIPT="%%s"       SCRIPT="%%s"
368       if [ "$SCRIPT" != "" ]       if [ "$SCRIPT" != "" ]
369       then       then
370         %(PYTHONBIN)s %(GNUEDIR)s/${SCRIPT} "$@"         %(PYTHONBIN)s %(GNUEDIR)s/${SCRIPT} "$@"
371       else       else
372         %(PYTHONBIN)s "$@"         %(PYTHONBIN)s "$@"
373       fi       fi
374    """ % globals()    """ % globals()
375    
376    
# Line 374  output.write ("data = \"%s\"\n" % CONFDI Line 391  output.write ("data = \"%s\"\n" % CONFDI
391  output.write ("config = \"%s/etc\"\n" % CONFDIR)  output.write ("config = \"%s/etc\"\n" % CONFDIR)
392  output.close ()  output.close ()
393    
394  os.system ("""  
395    rootCommands.append("""
396      cd %(GNUEDIR)s      cd %(GNUEDIR)s
397      ln -s %(CVSDIR)s/gnue-common/module/base/__init__.py .      ln -s %(CVSDIR)s/gnue-common/module/base/__init__.py .
398      ln -s %(CVSDIR)s/gnue-common/src common      ln -s %(CVSDIR)s/gnue-common/src common
399      if [ -f %(CVSDIR)s/gnue-common/src/.GDTD.py ]; then rm -f %(CVSDIR)s/gnue-common/src/.GDTD.py; fi      if [ -f %(CVSDIR)s/gnue-common/src/.GDTD.py ]; then rm -f %(CVSDIR)s/gnue-common/src/.GDTD.py; fi
400      ln -s %(CVSDIR)s/gnue-common/scripts/gnuedtd %(CVSDIR)s/common/src/.GDTD.py  #    ln -s %(CVSDIR)s/gnue-common/scripts/gnuedtd %(CVSDIR)s/common/src/.GDTD.py
     ln -s %(CVSDIR)s/gnue-designer/src designer  
     ln -s %(CVSDIR)s/gnue-dbtools/src dbtools  
     ln -s %(CVSDIR)s/gnue-forms/src forms  
     ln -s %(CVSDIR)s/gnue-reports/src reports  
     ln -s %(CVSDIR)s/gnue-navigator/src navigator  
     ln -s %(CVSDIR)s/gnue-integrator/src integrator  
     ln -s %(CVSDIR)s/gnue-appserver/src appserver  
401    
402  """ % globals() )      cd %(CONFDIR)s/etc
403        rm -f sample.*
404        ln -s %(CVSDIR)s/gnue-common/etc/sample.* .
405    
406        cd %(CONFDIR)s/shared
407        rm -rf images filters
408        mkdir filters
409        mkdir images
410    
411        cd %(CONFDIR)s/translations
412        rm -f ?? ??_??
413        ln -s %(CVSDIR)s/gnue-common/translations/?? %(CONFDIR)s/translations/
414        ln -s %(CVSDIR)s/gnue-common/translations/??_?? %(CONFDIR)s/translations/
415    
416        """ % globals() )
417    
418    def createLink(file, dest, overwrite=0):
419      if overwrite:
420        rootCommands.append ("if [ -e %s ]; then rm -f %s; fi" % (dest, dest))
421      rootCommands.append("ln -s %s/%s %s" % (CURRENT_DIR, file, dest))
422    
423    
424    def linkModule(subdir, module):
425      rootCommands.append("ln -s %s/%s %s/%s" % (CURRENT_DIR, subdir, GNUEDIR, module))
426    
427    
428    for CURRENT_TOOL in ('gnue-designer',
429                         'gnue-dbtools',
430                         'gnue-forms',
431                         'gnue-reports',
432                         'gnue-navigator',
433                         'gnue-pos',
434                         'gnue-integrator',
435                         'gnue-appserver'):
436    
437      global CURRENT_DIR
438      CURRENT_DIR = os.path.join(CVSDIR, CURRENT_TOOL)
439      setupfile = os.path.join(CURRENT_DIR, 'setup.cvs')
440      print setupfile
441    
442      if os.path.isfile(setupfile) and \
443         getYesNo('Setup CVS environment for %s? (Yes,No,All,neVer)'% CURRENT_TOOL,
444                 'Y','autotools'):
445        execfile(setupfile,globals())
446    
447    
448    if getYesNo('Do you have any external/custom packages to setup?','N'):
449      while 1:
450        path = getInput("Path to package's directory containing a setup.cvs file? (blank line to end)")
451        if not path:
452          break
453    
454        CURRENT_TOOL = CURRENT_DIR = path
455        execfile(os.path.join(CURRENT_DIR,'setup.cvs'), globals())
456    
457    
 rootCommands.append("""  
 cd %(CONFDIR)s/etc  
 rm -f sample.*  
 ln -s %(CVSDIR)s/gnue-common/etc/sample.* .  
   
 cd %(CONFDIR)s/shared  
 rm -rf images filters  
 mkdir filters  
 mkdir images  
   
 cd %(CONFDIR)s/shared/grpc  
 rm -f appserver.grpc GEAS.grpc GRServer.grpc  
   
 ln -s %(CVSDIR)s/gnue-common/images/* %(CONFDIR)s/shared/images/  
 ln -s %(CVSDIR)s/gnue-forms/images %(CONFDIR)s/shared/images/forms  
 ln -s %(CVSDIR)s/gnue-designer/images %(CONFDIR)s/shared/images/designer  
   
 rm -f %(CONFDIR)s/shared/dialogs  
 ln -s %(CVSDIR)s/gnue-forms/dialogs %(CONFDIR)s/shared/dialogs  
   
 ln -s %(CVSDIR)s/gnue-reports/src/adapters/filters/Labels/etc %(CONFDIR)s/shared/filters/Labels  
 ln -s %(CVSDIR)s/gnue-reports/src/adapters/filters/SimpleTabulation/etc %(CONFDIR)s/shared/filters/SimpleTabulation  
   
 ln -s %(CVSDIR)s/gnue-appserver/grpc/appserver.grpc %(CONFDIR)s/shared/grpc/appserver.grpc  
 ln -s %(CVSDIR)s/gnue-reports/grpc/GRServer.grpc %(CONFDIR)s/shared/grpc/GRServer.grpc  
   
 cd %(CONFDIR)s/translations  
 rm -f ?? ??_??  
 ln -s %(CVSDIR)s/gnue-common/translations/?? %(CONFDIR)s/translations/  
 ln -s %(CVSDIR)s/gnue-common/translations/??_?? %(CONFDIR)s/translations/  
 """ % globals() )  
   
   
 createCVS ('gnue-forms/scripts',     'gfcvs','forms/GFClient.py')  
 createCVS ('gnue-reports/scripts',   'grcvs','reports/client/GRRun.py')  
 createCVS ('gnue-reports/scripts',   'grdcvs','reports/server/GRServer.py')  
 createCVS ('gnue-designer/scripts',  'gfdes','designer/Designer.py')  
 createCVS ('gnue-navigator/scripts', 'gncvs','navigator/GNClient.py')  
 createCVS ('gnue-integrator/scripts','gicvs','integrator/GIClient.py')  
 createCVS ('gnue-dbtools/scripts',   'glcvs','dbtools/loader/Loader.py')  
 createCVS ('gnue-dbtools/scripts',   'gscvs','dbtools/sql/Client.py')  
 createCVS ('gnue-common/scripts',    'grpcdoc','common/rpc/drivers/_helpers/RpcDoc.py')  
 #createCVS ('gnue-common/scripts',   'gtestcvs','common/GTest.py')  
 createCVS ('gnue-common/scripts',    'gdtdcvs','common/.GDTD.py')  
 createCVS ('gnue-common/scripts',    'gsscvs','common/schema/scripter/Scripter.py')  
 createCVS ('gnue-common/scripts',    'gcvs','')  
 createCVS ('gnue-appserver/scripts', 'gacvs','appserver/geasRpcServer.py')  
   
 if willInstallDocs:  
   createDocs('gnue-docbook/GNUEnterprise/main.sgml', 'GNUEnterprise')  
   createDocs('gnue-docbook/DevelopersIntroduction/main.sgml',  
              'DevelopersIntroduction')  
   createDocs('gnue-docbook/GDAQuickHackersGuide/main.sgml',  
              'GDAQuickHackersGuide')  
   createDocs('gnue-docbook/GNUeFormsTechRef/main.sgml', 'GNUeFormsTechRef')  
   createDocs('gnue-docbook/GNUeModuleGuide/main.sgml', 'GNUeModuleGuide')  
   createDocs('gnue-docbook/GNUeObjectServer/main.sgml',  
              'GNUeObjectServer')  
458    
459  willCreateConf = 0  willCreateConf = 0
460  willCreateConn = 0  willCreateConn = 0
461  willCreateFilt = 0  willCreateFilt = 0
462    
463  if os.path.isfile('/usr/local/gnue/etc/gnue.conf') and \  if os.path.isfile('/usr/local/gnue/etc/gnue.conf') and \
464     CONFDIR != '/usr/local/gnue':     CONFDIR != '/usr/local/gnue' and not os.path.isfile(CONFDIR+'/etc/gnue.conf'):
465    if getYesNo('Do you wish to use the current system-wide gnue.conf file?','N'):    if getYesNo('Do you wish to use the current system-wide gnue.conf file? (Yes,No,All,neVer)','N','conf'):
466      rootCommands.append("ln -s /usr/local/gnue/etc/gnue.conf %(CONFDIR)s/etc/gnue.conf" % globals())      rootCommands.append("ln -s /usr/local/gnue/etc/gnue.conf %(CONFDIR)s/etc/gnue.conf" % globals())
467      willCreateConf = 1      willCreateConf = 1
468    
469    
470  if os.path.isfile('/usr/local/gnue/etc/connections.conf') and \  if os.path.isfile('/usr/local/gnue/etc/connections.conf') and \
471     CONFDIR != '/usr/local/gnue':     CONFDIR != '/usr/local/gnue' and not os.path.isfile(CONFDIR+'/etc/connections.conf'):
472    if getYesNo('Do you wish to use the current system-wide connections.conf file?','Y'):    if getYesNo('Do you wish to use the current system-wide connections.conf file? (Yes,No,All,neVer)','Y','conf'):
473      rootCommands.append("ln -s /usr/local/gnue/etc/connections.conf %(CONFDIR)s/etc/connections.conf" % globals())      rootCommands.append("ln -s /usr/local/gnue/etc/connections.conf %(CONFDIR)s/etc/connections.conf" % globals())
474      willCreateConn = 1      willCreateConn = 1
475    
476    
477  if os.path.isfile('/usr/local/gnue/etc/report-filters.conf') and \  if os.path.isfile('/usr/local/gnue/etc/report-filters.conf') and \
478     CONFDIR != '/usr/local/gnue':     CONFDIR != '/usr/local/gnue' and not os.path.isfile(CONFDIR+'/etc/report-filters.conf'):
479    if getYesNo('Do you wish to use the current system-wide report-filters.conf file?','N'):    if getYesNo('Do you wish to use the current system-wide report-filters.conf file? (Yes,No,All,neVer)','N','conf'):
480      rootCommands.append("ln -s /usr/local/gnue/etc/report-filters.conf %(CONFDIR)s/etc/report-filters.conf" % globals())      rootCommands.append("ln -s /usr/local/gnue/etc/report-filters.conf %(CONFDIR)s/etc/report-filters.conf" % globals())
481      willCreateFilt = 1      willCreateFilt = 1
482    
483  if not willCreateConf and not os.path.isfile("%s/etc/gnue.conf"%CONFDIR):  if not willCreateConf and not os.path.isfile("%s/etc/gnue.conf"%CONFDIR):
484    print ""    print ""
485    print "You do not currently have a gnue.conf tools configuration file."    print "You do not currently have a gnue.conf tools configuration file."
486    if getYesNo("Do you want to create a gnue.conf based on the supplied examples?",'Y'):    if getYesNo("Do you want to create a gnue.conf based on the supplied examples? (Yes,No,All,neVer)",'Y','autoconf'):
487      print "Since the gnue.conf file format may change from time to time in CVS,"      print "Since the gnue.conf file format may change from time to time in CVS,"
488      print "we can create a symlinked gnue.conf file that always mirrors CVS. This"      print "we can create a symlinked gnue.conf file that always mirrors CVS. This"
489      print "will not allow you to customize gnue.conf, however."      print "will not allow you to customize gnue.conf, however."
490      if getYesNo ("Do you want to use a symlinked gnue.conf file?",'N'):      if getYesNo ("Do you want to use a symlinked gnue.conf file?",'N',):
491        command = "ln -s %(CVSDIR)s/gnue-common/etc/sample.gnue.conf %(CONFDIR)s/etc/gnue.conf" % globals()        command = "ln -s %(CVSDIR)s/gnue-common/etc/sample.gnue.conf %(CONFDIR)s/etc/gnue.conf" % globals()
492      else:      else:
493        command = "cp %(CVSDIR)s/gnue-common/etc/sample.gnue.conf %(CONFDIR)s/etc/gnue.conf" % globals()        command = "cp %(CVSDIR)s/gnue-common/etc/sample.gnue.conf %(CONFDIR)s/etc/gnue.conf" % globals()
# Line 492  if not willCreateConf and not os.path.is Line 498  if not willCreateConf and not os.path.is
498  if not willCreateConn and not os.path.isfile("%s/etc/connections.conf"%CONFDIR):  if not willCreateConn and not os.path.isfile("%s/etc/connections.conf"%CONFDIR):
499    print ""    print ""
500    print "You do not currently have a connections.conf configuration file."    print "You do not currently have a connections.conf configuration file."
501    if getYesNo("Do you want to create a connections.conf based on the supplied examples?",'Y'):    if getYesNo("Do you want to create a connections.conf based on the supplied examples? (Yes,No,All,neVer)",'Y','autoconf'):
502      rootCommands.append("cp %(CVSDIR)s/gnue-common/etc/sample.connections.conf %(CONFDIR)s/etc/connections.conf" % globals())      rootCommands.append("cp %(CVSDIR)s/gnue-common/etc/sample.connections.conf %(CONFDIR)s/etc/connections.conf" % globals())
503    
504    print    print
# Line 503  if not willCreateConn and not os.path.is Line 509  if not willCreateConn and not os.path.is
509  if not willCreateConf and not os.path.isfile("%s/etc/report-filters.conf"%CONFDIR):  if not willCreateConf and not os.path.isfile("%s/etc/report-filters.conf"%CONFDIR):
510    print ""    print ""
511    print "You do not currently have a report-filters.conf configuration file."    print "You do not currently have a report-filters.conf configuration file."
512    if getYesNo("Do you want to create a report-filters.conf based on the supplied examples?",'Y'):    if getYesNo("Do you want to create a report-filters.conf based on the supplied examples? (Yes,No,All,neVer)",'Y','autoconf'):
513      print "Since the report-filters.conf file format may change from time to time in CVS,"      print "Since the report-filters.conf file format may change from time to time in CVS,"
514      print "we can create a symlinked report-filters.conf file that always mirrors CVS. This"      print "we can create a symlinked report-filters.conf file that always mirrors CVS. This"
515      print "will not allow you to customize report-filters.conf, however."      print "will not allow you to customize report-filters.conf, however."
516      if getYesNo ("Do you want to use a symlinked report-filters.conf file?",'N'):      if getYesNo ("Do you want to use a symlinked report-filters.conf file? (Yes,No,All,neVer)",'N', 'symconf'):
517        command = "ln -s %(CVSDIR)s/gnue-common/etc/sample.report-filters.conf %(CONFDIR)s/etc/report-filters.conf" % globals()        command = "ln -s %(CVSDIR)s/gnue-common/etc/sample.report-filters.conf %(CONFDIR)s/etc/report-filters.conf" % globals()
518      else:      else:
519        command = "cp %(CVSDIR)s/gnue-common/etc/sample.report-filters.conf %(CONFDIR)s/etc/report-filters.conf" % globals()        command = "cp %(CVSDIR)s/gnue-common/etc/sample.report-filters.conf %(CONFDIR)s/etc/report-filters.conf" % globals()

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26