def create(self):
        gp = ghostPackage.ghostPackage(cmt.CMT())
        gp.allInterfacesCreate()
        pkgdict = gp.allInterfacesCollectVersions(self.cmtconfig)
        gp.allInterfacesRemove()

        doc = Document()

        pkgs = doc.createElement("packages")
        doc.appendChild(pkgs)

        for p in pkgdict:

            # Create the main <card> element
            pkg = doc.createElement("pkg")
            pkg.setAttribute("name", p)
            pkg.setAttribute('path', pkgdict[p][2])
            pkgs.appendChild(pkg)

        # Print our newly created XML
        ff = os.path.join(self.location, self.filename)
        f = open(ff, 'w')
        f.write(doc.toprettyxml(indent=" " * self.indent))
        f.close()
        self.msg.info('Wrote file ' + ff)
Example #2
0
  def __init__(self, msgLevel='ALL'):

    self.argv0 = sys.argv[0]
    self.cmt = cmt.CMT()

    self.cfg = lcg.aa.config.config()

    self.pkgRoot = self.cmt.macros['PACKAGE_ROOT']
    self.pkgName = self.pkgRoot.split(os.sep)[-1]

    self.msgLevel = msgLevel
    self.msg = lcg.msg.msg(os.path.basename(self.argv0), self.msgLevel, '[%s] '% self.pkgName)

    if 'LCG_Builders' not in self.pkgRoot.split(os.sep) :
      self.msg.debug('Package %s is not a builder package - skipping' % self.pkgRoot)
    
    self.xmlDir = '%s%sxml' % (self.cmt.macros['PACKAGE_ROOT'], os.sep)
    self.dtdDir = '%s%sxml' % (self.cmt.macros['LCG_BUILDPOLICYROOT'], os.sep)
    self.xmlFileBase = 'package.xml'
    self.dtdFileBase = 'package.dtd'
    self.xmlFile = '%s%s%s' % ( self.xmlDir, os.sep, self.xmlFileBase)
    self.dtdFile = '%s%s%s' % ( self.dtdDir, os.sep, self.dtdFileBase)

    self.err = 0
    self.data = None
Example #3
0
  def __init__(self, msgLevel,reldate=''):
    cmtextra = os.environ.get('CMTEXTRATAGS')
    if not cmtextra : cmtextra = ''
    if not cmtextra or 'NOPYLCG' not in map(lambda x: x.strip(),cmtextra.split(',')) :
      if cmtextra : cmtextra += ','
      cmtextra += 'NOPYLCG'
      os.environ['CMTEXTRATAGS'] = cmtextra
    self.cfg = config.config()
    self.argv0 = sys.argv[0]
    self.lcgcmtroot = self.cfg.lcg_lcgcmtroot_dir
    self.all_interface_dirs_lower = []
    self.all_interface_dirs = []
    self.all_builder_dirs = []
    self.interface_dirs = []
    self.builder_dirs = []
    self.pkg_low2real_dict = {'cmt':'CMT'}
    self.pkg_vers_dict = {}
    self.cmt = cmt.CMT()
    self.msgLevel = msgLevel
    self.msg = msg.msg(os.path.basename(self.argv0), self.msgLevel)

    self.lcgcmt             = {}
    self.lcgcmt['general']  = {}
    self.lcgcmt['plat_def'] = {}
    self.lcgcmt['pkg']      = {}

    self.reldate = time.time()
    if reldate : self.reldate = time.mktime(date(reldate[0],reldate[1],reldate[2]).timetuple())
Example #4
0
 def __init__(self,fr,to,msgLvl,dry,pkg):
   self.fr = fr
   self.to = to
   self.cmt = cmt.CMT()
   self.dry = dry
   self.pkg = pkg
   self.cfg = config.config()
   self.msg = msg.msg(os.path.basename(sys.argv[0]), msgLevel=msgLvl)
Example #5
0
    def __init__(self, lcgcmt, cmtconfig, pkglist, verbose, force, dry):

        self.cfg = config.config()
        self.argv0 = sys.argv[0]
        self.msg = msg.msg(os.path.basename(self.argv0))
        self.dry = dry
        self.verbose = verbose
        self.force = force

        if cmtconfig:
            self.msg.error(
                'option -c/--cmtconfig not implemented yet, please set $CMTCONFIG'
            )
            sys.exit(1)

        self.package_results = {}
        self.project_results = {}
        self.packages = {}
        self.sel_packages = pkglist
        self.cmtconfig = cmtconfig
        self.lcgsystem = ''
        self.tarball_platform_tags = self.cfg.tarball_platform_tags
        self.tarball_platform_tags += ['src', 'doc']
        if os.environ.has_key('CMTCONFIG'):
            self.cmtconfig = os.environ['CMTCONFIG']
            if self.cmtconfig not in self.cfg.tarball_platform_tags:
                self.msg.error('%s is not a tar platform, change $CMTCONFIG' %
                               self.cmtconfig)
                sys.exit(1)
            if self.cmtconfig[-4:] == '_dbg':
                self.lcgsystem = self.cmtconfig[:-4]
            else:
                self.lcgsystem = self.cmtconfig
        else:
            self.msg.error(
                'environment variable CMTCONFIG not set, please set')
            sys.exit(1)

        self.start_dir = os.path.realpath(os.curdir)
        self.lcgcmt_dir = ''
        if lcgcmt: self.lcgcmt_dir = lcgcmt
        else: self.lcgcmt_dir = self.cfg.lcg_lcgcmtroot_dir
        self.cmt = cmt.CMT()
Example #6
0
 def __init__(self):
     # argv0 needed for msgs
     self.argv0 = sys.argv[0]
     # the cmt instance
     self.cmt = cmt.CMT()
     # the fallback directory for tar balls (afs)
     self.LCG_tardir_fallback = ''
     # a list of source files to be copied
     self.source_files = []
     self.LCG_cvsdir = ''
     # needed sets / macros
     macros = ('package', 'LCG_sourcefiles', 'LCG_get', 'LCG_cvsdir')
     sets = ('LCG_tardir', 'LCG_tarfilename', 'LCG_builddir', 'LCG_tarurl',
             'LCG_package_config_version', 'LCG_CVSROOT', 'LCG_SVNROOT',
             'LCG_svnpath', 'LCG_svndir', 'LCG_svntag', 'LCG_svnfolder',
             'LCG_CheckoutDir', 'LCG_cvstag', "LCG_cvsproj")
     # getting macros and sets
     for m in macros:
         try:
             self.__dict__[m] = self.cmt.macros[m]
         except Exception, e:
             pass
Example #7
0
  def __init__(self):
    
    self.msg = lcg.msg.msg('LCG AA Configuration')

    lcg.config.config.__init__(self)

    self.cmt = cmt.CMT()

    # the names of the LCG/AA projects
    self.lcg_projects = ['LCGCMT','RELAX','CORAL', 'COOL','ROOT']
    self.not_lcgaa_packages = ['GAUDI']

    # important directories
    self.lcg_lcgcmtroot_dir   = os.sep.join(os.path.dirname(lcg.aa.config.__file__).split(os.sep)[:-4])+os.sep
    self.lcg_distNew_dirname  = 'distNew4'
    self.lcg_external_dir     = ''
    self.lcg_release_dir      = ''
    self.lcg_distribution_dir = ''
    self.lcg_distNew_dir      = ''

    # retrieve macros from LCG_Settings
    sav_dir = os.path.realpath(os.curdir)
    os.chdir(self.lcg_lcgcmtroot_dir + 'LCG_Settings' + os.sep + 'cmt')
    self.cmt.init_macros()
    if self.lcg_external_dir == '' and self.cmt.macros.has_key('LCG_external') :
      self.lcg_external_dir = self.normalize_path(self.cmt.macros['LCG_external'])
    if self.lcg_release_dir == '' and self.cmt.macros.has_key('LCG_releases') :
      self.lcg_release_dir = self.normalize_path(self.cmt.macros['LCG_releases'])
    os.chdir(sav_dir)

    self.lcg_distribution_dir = self.lcg_external_dir + os.sep + 'distribution'
    self.lcg_distNew_dir = self.lcg_external_dir + os.sep + self.lcg_distNew_dirname

    # actual lcg tags
    self.all_platform_tags = [
      'i686-slc5-gcc43-opt',
      'i686-slc5-gcc43-dbg',
      'x86_64-slc5-icc11-opt',
      'x86_64-slc5-icc11-dbg',
      'x86_64-slc5-gcc43-opt',
      'x86_64-slc5-gcc43-dbg',
      'x86_64-slc5-gcc46-opt',
      'x86_64-slc5-gcc46-dbg',
      'x86_64-slc6-gcc46-opt',
      'x86_64-slc6-gcc46-dbg',
      'x86_64-mac106-gcc42-opt',
      'x86_64-mac106-gcc42-dbg'
      ]
    self.release_platform_tags = [
      'i686-slc5-gcc43-opt',
      'i686-slc5-gcc43-dbg',
      'x86_64-slc5-icc11-opt',
      'x86_64-slc5-icc11-dbg',
      'x86_64-slc5-gcc43-opt',
      'x86_64-slc5-gcc43-dbg',
      'x86_64-slc5-gcc46-opt',
      'x86_64-slc5-gcc46-dbg',
      'x86_64-slc6-gcc46-opt',
      'x86_64-slc6-gcc46-dbg',
      'x86_64-mac106-gcc42-opt',
      'x86_64-mac106-gcc42-dbg'
      ]

    self.tarball_platform_tags = [
      'i686-slc5-gcc43-opt',
      'i686-slc5-gcc43-dbg',
      'x86_64-slc5-gcc43-opt',
      'x86_64-slc5-gcc43-dbg',
      'x86_64-slc6-gcc46-opt',
      'x86_64-slc6-gcc46-dbg',
      'x86_64-mac106-gcc42-opt'
     ]
    
    self.old_platform_tags = [
      'osx104_ia32_gcc401',
      'osx104_ia32_gcc401_dbg',
      'osx104_ppc_gcc401',
      'osx104_ppc_gcc401_dbg',
      'slc3_ia32_gcc323',
      'slc3_ia32_gcc323_dbg'
      'slc4_amd64_gcc41',
      'slc4_amd64_gcc41_dbg', 
      'slc4_ia32_gcc41',
      'slc4_ia32_gcc41_dbg',
      ]

    # checks
    for t in self.release_platform_tags :
      if t not in self.all_platform_tags :
        msg.error('Consistency check: release tag %s not in container of all tags' % t)

    for t in self.tarball_platform_tags :
      if t not in self.release_platform_tags :
        msg.error('Consistency check: tarball tag %s not in container of release tags' % t)

    for t in self.old_platform_tags :
      if t in self.all_platform_tags :
        msg.error('Consistency check: old platform tag %s is part of container of all tags' % t)


    # compiler settings
    # variables
    self.compiler = ''
    self.compilerMax = 0
    self.compilerMaj = 0
    self.compilerMin = 0

    # checks
    if self.isWin32 :

      pass

    else :

      # try gcc
      p = Popen('gcc --version', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) 
      i,o,e = p.stdin, p.stdout, p.stderr

      err = e.readlines()
      if len(err) : self.msg.error(err)
      else :
        self.compiler = 'gcc'
        patt = re.compile('.*\s(\d+)\.(\d+)(\.(\d+))*\s.*')
        mobj = patt.match(o.readlines()[0])
        self.compilerMax = int(mobj.group(1))
        self.compilerMaj = int(mobj.group(2))
        self.compilerMin = int(mobj.group(4))

    # lcg tag
    # variables
    self.lcg_tag = ''
    self.lcg_tag_dbg = ''

    # setup
    if self.isLinux :

      if self.osReleaseStr in ('slc3', 'slc4', 'slc5', 'slc6') : self.lcg_tag += '%s' % self.osReleaseStr
      else : self.msg.error('Trying to setup tag info, unknown string for OS %s' % self.osReleaseStr)

      if self.is32bit : self.lcg_tag += '_ia32'
      elif self.is64bit : self.lcg_tag += '_amd64'

      if self.compiler == 'gcc' :
        if self.compilerMax == 3 and self.compilerMaj == 2 and self.compilerMin == 3 :
          self.lcg_tag += '_gcc%s%s%s' % (self.compilerMax, self.compilerMaj, self.compilerMin)
        else                       : self.lcg_tag += '_gcc%s%s' % ( self.compilerMax, self.compilerMaj)

      else : self.msg.warning('Nothing known about compiler %s' % self.compiler)

    elif self.isMacOS :

      self.lcg_tag += 'osx%s%s' % ( self.osMaxRelease, self.osMajRelease )

      if self.processor == 'powerpc' : self.lcg_tag += '_ppc'
      elif self.processor == 'i386'  : self.lcg_tag += '_ia32'
      else : self.msg.error('Processor type %s unknown' % self.processor )

      if self.compiler == 'gcc' :
        if self.compilerMax == 4 and self.compilerMaj == 0 and self.compilerMin == 1 : self.lcg_tag += '_gcc401'
        else : self.lcg_tag += '_gcc%s%s' % (self.compilerMax, self.compilerMaj)

    elif self.isWin32 :

      pass

    
    self.lcg_tag_dbg = '%s_dbg' % self.lcg_tag


    # licenses
    self.licenseURLs = {
                        '4SUITE'  : 'http://4suite.org/COPYRIGHT.doc',
                        'APACHE'  : 'http://www.apache.org/licenses/',
                        'BOOST'   : 'http://boost.org/more/license_info.html',
                        'BLAS'    : 'http://www.netlib.org/blas/faq.html#2',
                        'BSD'     : 'http://www.opensource.org/licenses/bsd-license.php',
                        'BZ2LIB'  : 'http://service-spi.web.cern.ch/service-spi/external/bz2lib/_SPI/LICENSE',
                        'CGAL'    : 'http://www.cgal.org/license.html',
                        'CMT'     : 'http://www.cecill.info/licences/Licence_CeCILL_V2-en.html',
                        'CMAKE'   : 'http://www.cmake.org/HTML/Copyright.html',
                        'CNRI'    : 'http://www.opensource.org/licenses/pythonpl.php',
                        'CXORACLE': 'http://www.python.net/crew/atuining/cx_Oracle/LICENSE.txt',
                        'CYGWIN'  : 'http://cygwin.com/licensing.html',
                        'GCCXML'  : 'http://www.gccxml.org/HTML/Copyright.html',
                        'GPL'     : 'http://www.gnu.org/copyleft/gpl.html',
                        'LAPACK'  : 'http://www.netlib.org/lapack/COPYING',
                        'LCGAA'   : '',
                        'LGPL'    : 'http://www.gnu.org/licenses/lgpl.html',
                        'LIBPNG'  : 'http://www.libpng.org/pub/png/src/libpng-LICENSE.txt',
                        'LLVM'    : 'http://llvm.org/releases/2.5/LICENSE.TXT',
                        'MATPLOTLIB': 'http://matplotlib.sourceforge.net/users/license.html',
                        'MIT'     : 'http://www.opensource.org/licenses/mit-license.php',
                        'MYSQL'   : 'http://www.mysql.com/company/legal/licensing/opensource-license.html',
                        'ORACLE'  : 'http://www.oracle.com/corporate/license/agreements.html',
                        'PCRE'    : 'http://www.pcre.org/license.txt',
                        'PYTHON'  : 'http://www.opensource.org/licenses/PythonSoftFoundation.php',
                        'SCONS'   : 'http://service-spi.web.cern.ch/service-spi/external/scons/_SPI/LICENSE.txt',
                        'SQLITE'  : 'http://www.sqlite.org/copyright.html',
                        'SUBVERSION': 'http://subversion.tigris.org/license-1.html',
                        'X11'     : 'http://www.xfree86.org/3.3.6/COPYRIGHT2.html',
                        'UNKNOWN' : '',
                        }
    
    self.licenses = self.licenseURLs.keys()
Example #8
0
    def __init__(self):

        self.cmt = cmt.CMT()
        self.builderPackages = []