Commit 5e0a2e46 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Updated project_manifest.py to generate the correct list of externals

See LBCORE-677.
Note that this is only for CMT builds at the moment.

From: Marco Clemencic <marco.clemencic@cern.ch>


git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/Gaudi/trunk@7581 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent 23aa0466
......@@ -2,6 +2,11 @@ package GaudiPolicy
package manager: Marco Clemencic
Commit Id: $Format:%H$
! 2014-11-26 - Marco Clemencic
- Updated project_manifest.py to generate the correct list of externals in
the manifest.xml file (see LBCORE-677).
Note that this is only for CMT builds at the moment.
============================= GaudiPolicy v15r1 ==============================
! 2014-10-07 - Marco Clemencic
- LBCORE-632: Enable -pedantic flag by default.
......
......@@ -4,7 +4,9 @@
import sys
import os
from xml.etree import ElementTree as ET
from subprocess import Popen, PIPE
import re
import logging
def indent(elem, level=0):
'''
......@@ -89,6 +91,8 @@ if __name__ == '__main__':
cmake_lists, lcg_version, platform = args
logging.basicConfig(level=logging.INFO)
# look for the CMake configuration file
if not os.path.exists(cmake_lists):
print 'The project does not have a CMake configuration, I cannot produce a manifest.xml'
......@@ -155,7 +159,46 @@ if __name__ == '__main__':
for pkg, vers in data_pkgs(parsed_args['DATA']))
manifest.append(used_data_pkgs)
logging.debug('collecting external dependencies info (with CMT)')
p = Popen(['cmt', 'show', 'uses'], stdout=PIPE)
externals = [l.split()[1]
for l in p.stdout
if l.startswith('use') and
'LCG_Interfaces' in l]
externals.sort()
# get the versions of the externals
def get_ext_vers(ext):
'''
Ask CMT the version of an external.
'''
logging.debug('getting version of %s', ext)
vers = Popen(['cmt', 'show', 'macro_value',
'%s_config_version' % ext],
stdout=PIPE).communicate()[0].strip()
logging.debug('using %s %s', ext, vers)
if vers == 'dummy': # special case in LCG
vers = ''
return vers
packages = ET.Element('packages')
packages.extend([ET.Element('package', name=ext, version=vers)
for ext, vers in [(ext, get_ext_vers(ext))
for ext in externals]
if vers])
heptools.append(packages)
destdir = os.path.dirname(output)
if not os.path.exists(destdir):
logging.debug('creating directory %s', destdir)
os.makedirs(destdir)
# finally write the produced XML
logging.debug('writing manifest file %s', output)
indent(manifest)
ET.ElementTree(manifest).write(output,
encoding="UTF-8", xml_declaration=True)
logging.debug('%s written', output)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment