28 |
28 |
29 <!-- Tools configuration for basic Helium tools. --> |
29 <!-- Tools configuration for basic Helium tools. --> |
30 <hlm:envdata id="helium.tools.envdata"> |
30 <hlm:envdata id="helium.tools.envdata"> |
31 <hlm:executable name="7za" versionArgs="" versionRegex="7-Zip (\S+)"/> |
31 <hlm:executable name="7za" versionArgs="" versionRegex="7-Zip (\S+)"/> |
32 <hlm:executable name="ant" versionArgs="-version" versionRegex="Apache Ant version (\S+)"/> |
32 <hlm:executable name="ant" versionArgs="-version" versionRegex="Apache Ant version (\S+)"/> |
33 <hlm:executable name="armcc" versionArgs="" versionRegex="RVCT(.+)" output="stderr"/> |
33 <hlm:executable name="armcc" versionArgs="" versionRegex="RVCT(.+)"/> |
34 <hlm:executable name="ccm" versionArgs="version -c" versionRegex="(\S+)"/> |
34 <hlm:executable name="ccm" versionArgs="version -c" versionRegex="(\S+)"/> |
35 <hlm:executable name="codescanner" versionArgs="" versionRegex="version (\S+)"/> |
35 <hlm:executable name="codescanner" versionArgs="" versionRegex="version (\S+)"/> |
36 <hlm:executable name="ctc" versionArgs="" versionRegex="This is CTC\+\+ \(v(\S+)\)"/> |
36 <hlm:executable name="ctc" versionArgs="" versionRegex="This is CTC\+\+ \(v(\S+)\)"/> |
37 <hlm:executable name="java" versionArgs="-version" versionRegex="java version "(\S+)\""/> |
37 <hlm:executable name="java" versionArgs="-version" versionRegex="java version "(\S+)\""/> |
38 <hlm:executable name="perl" versionArgs="-v" versionRegex="This is perl, v(\S+)"/> |
38 <hlm:executable name="perl" versionArgs="-v" versionRegex="This is perl, v(\S+)"/> |
325 LOGGER.setLevel(level=logging.INFO) |
325 LOGGER.setLevel(level=logging.INFO) |
326 logging.basicConfig(level=logging.INFO) |
326 logging.basicConfig(level=logging.INFO) |
327 |
327 |
328 def merge_filelist(merger, filelist): |
328 def merge_filelist(merger, filelist): |
329 for filename in filelist: |
329 for filename in filelist: |
330 try: |
330 LOGGER.info("Merging %s" % filename) |
331 LOGGER.info("Merging %s" % filename) |
331 merger.merge(filename) |
332 merger.merge(filename) |
332 os.unlink(filename) |
333 os.unlink(filename) |
333 |
334 except Exception, exc: |
334 filename = ant.get_property(r'@{file}') |
335 LOGGER.warning("Warning: %s" % exc) |
335 if filename == None: |
336 |
336 raise IOError(r'@{file} not found') |
337 try: |
337 builder = configuration.NestedConfigurationBuilder(open(filename), 'r') |
338 builder = configuration.NestedConfigurationBuilder(open(ant.get_property(r'@{file}')), 'r') |
338 configSet = builder.getConfiguration() |
339 configSet = builder.getConfiguration() |
339 configs = configSet.getConfigurations(ant.get_property(r'@{config}')) |
340 configs = configSet.getConfigurations(ant.get_property(r'@{config}')) |
340 |
341 |
341 if len(configs) > 0: |
342 if len(configs) > 0: |
342 filelist = [] |
343 filelist = [] |
343 for config in configs: |
344 for config in configs: |
344 if config.get_boolean("release.metadata", False): |
345 if config.get_boolean("grace.metadata", False): |
345 metadata = os.path.join(config['archives.dir'], config['name']+ ".metadata.xml") |
346 metadata = os.path.join(config['archives.dir'], config['name']+ ".metadata.xml") |
346 if os.path.exists(metadata): |
347 if os.path.exists(metadata): |
347 LOGGER.info("Found %s" % metadata) |
348 LOGGER.info("Found %s" % metadata) |
348 filelist.append(metadata) |
349 filelist.append(metadata) |
349 |
350 |
350 merger = None |
351 merger = None |
351 metadata_main = os.path.join(configs[0]['archives.dir'], "release_metadata.xml") |
352 metadata_main = os.path.join(configs[0]['archives.dir'], "release_metadata.xml") |
352 if os.path.exists(metadata_main): |
353 if os.path.exists(metadata_main): |
353 merger = symrec.MetadataMerger(metadata_main) |
354 merger = symrec.MetadataMerger(metadata_main) |
354 merge_filelist(merger, filelist) |
355 merge_filelist(merger, filelist) |
355 LOGGER.info(str("Writing %s" % metadata_main)) |
356 LOGGER.info(str("Writing %s" % metadata_main)) |
356 merger.save() |
357 merger.save() |
357 elif len(filelist) > 0: |
358 elif len(filelist) > 0: |
358 input = filelist.pop(0) |
359 input = filelist.pop(0) |
359 merger = symrec.MetadataMerger(input) |
360 merger = symrec.MetadataMerger(input) |
360 merge_filelist(merger, filelist) |
361 merge_filelist(merger, filelist) |
361 LOGGER.info(str("Writing %s" % metadata_main)) |
362 LOGGER.info(str("Writing %s" % metadata_main)) |
362 merger.save(metadata_main) |
363 merger.save(metadata_main) |
363 os.unlink(input) |
364 os.unlink(input) |
|
365 except Exception, e: |
|
366 LOGGER.error('ERROR: %s' % e) |
|
367 sys.exit(-1) |
|
368 ]]> |
364 ]]> |
369 </hlm:python> |
365 </hlm:python> |
370 </sequential> |
366 </sequential> |
371 </macrodef> |
367 </macrodef> |
372 |
368 |
403 raise Exception('archive attribute is not defined.') |
399 raise Exception('archive attribute is not defined.') |
404 filters = None |
400 filters = None |
405 if ant.get_property(r'@{filters}') is not None: |
401 if ant.get_property(r'@{filters}') is not None: |
406 filters = ant.get_property(r'@{filters}').split(r',') |
402 filters = ant.get_property(r'@{filters}').split(r',') |
407 |
403 |
408 try: |
404 filename = ant.get_property(r'@{file}') |
409 filename = ant.get_property(r'@{file}') |
405 archive = ant.get_property(r'@{archive}') |
410 archive = ant.get_property(r'@{archive}') |
406 if not os.path.exists(filename): |
411 if not os.path.exists(filename): |
407 raise Exception("Could not find file: %s" % filename) |
412 raise Exception("Could not find file: %s" % filename) |
408 if not os.path.exists(archive): |
413 if not os.path.exists(archive): |
409 raise Exception("Could not find file: %s" % archive) |
414 raise Exception("Could not find file: %s" % archive) |
410 |
415 |
411 LOGGER.info(str("Opening %s" % filename)) |
416 LOGGER.info(str("Opening %s" % filename)) |
412 md = symrec.ReleaseMetadata(filename) |
417 md = symrec.ReleaseMetadata(filename) |
413 if os.path.basename(archive) not in md.keys(): |
418 if os.path.basename(archive) not in md.keys(): |
414 LOGGER.info(str("Adding %s to metadata" % os.path.basename(archive))) |
419 LOGGER.info(str("Adding %s to metadata" % os.path.basename(archive))) |
415 md.add_package(os.path.basename(archive), md5checksum=fileutils.getmd5(archive), size=os.path.getsize(archive), filters=filters) |
420 md.add_package(os.path.basename(archive), md5checksum=fileutils.getmd5(archive), size=os.path.getsize(archive), filters=filters) |
416 else: |
421 else: |
417 LOGGER.info(str("Updating %s to metadata" % os.path.basename(archive))) |
422 LOGGER.info(str("Updating %s to metadata" % os.path.basename(archive))) |
418 result = md[os.path.basename(archive)] |
423 result = md[os.path.basename(archive)] |
419 result['md5checksum'] = unicode(fileutils.getmd5(archive)) |
424 result['md5checksum'] = unicode(fileutils.getmd5(archive)) |
420 result['size'] = unicode(os.path.getsize(archive)) |
425 result['size'] = unicode(os.path.getsize(archive)) |
421 if filters is not None: |
426 if filters is not None: |
422 result['filters'] = filters |
427 result['filters'] = filters |
423 md[os.path.basename(archive)] = result |
428 md[os.path.basename(archive)] = result |
424 md.save() |
429 md.save() |
|
430 except Exception, e: |
|
431 LOGGER.error('ERROR: %s' % e) |
|
432 sys.exit(-1) |
|
433 ]]> |
425 ]]> |
434 </hlm:python> |
426 </hlm:python> |
435 </sequential> |
427 </sequential> |
436 </macrodef> |
428 </macrodef> |
437 |
429 |
460 LOGGER = logging.getLogger("metadataMD5updater") |
452 LOGGER = logging.getLogger("metadataMD5updater") |
461 LOGGER.setLevel(level=logging.INFO) |
453 LOGGER.setLevel(level=logging.INFO) |
462 logging.basicConfig(level=logging.INFO) |
454 logging.basicConfig(level=logging.INFO) |
463 |
455 |
464 # Reading the config from Ant |
456 # Reading the config from Ant |
465 try: |
457 config_filename = ant.get_property(r'@{file}') |
466 config_filename = ant.get_property(r'@{file}') |
458 spec_name = ant.get_property(r'@{config}') |
467 spec_name = ant.get_property(r'@{config}') |
459 # Loading the config file. |
468 # Loading the config file. |
460 if config_filename == None: |
469 builder = configuration.NestedConfigurationBuilder(open(config_filename, 'r')) |
461 raise IOError(r'@{file} not found') |
470 configSet = builder.getConfiguration() |
462 builder = configuration.NestedConfigurationBuilder(open(config_filename, 'r')) |
471 configs = configSet.getConfigurations(spec_name) |
463 configSet = builder.getConfiguration() |
472 |
464 configs = configSet.getConfigurations(spec_name) |
473 if len(configs) > 0: |
465 |
474 if os.path.exists(os.path.join(configs[0]['archives.dir'], "release_metadata.xml")): |
466 if len(configs) > 0: |
475 md5update = symrec.MD5Updater(os.path.join(configs[0]['archives.dir'], "release_metadata.xml")) |
467 if os.path.exists(os.path.join(configs[0]['archives.dir'], "release_metadata.xml")): |
476 md5update.update() |
468 md5update = symrec.MD5Updater(os.path.join(configs[0]['archives.dir'], "release_metadata.xml")) |
477 md5update.save() |
469 md5update.update() |
478 else: |
470 md5update.save() |
479 LOGGER.warning(str('WARNING: Could not find %s.' % os.path.join(configs[0]['archives.dir'], "release_metadata.xml"))) |
|
480 else: |
471 else: |
481 LOGGER.warning('WARNING: No config.') |
472 LOGGER.warning(str('WARNING: Could not find %s.' % os.path.join(configs[0]['archives.dir'], "release_metadata.xml"))) |
482 except Exception, e: |
473 else: |
483 LOGGER.error('ERROR: %s' % e) |
474 LOGGER.warning('WARNING: No config.') |
484 sys.exit(-1) |
|
485 ]]> |
475 ]]> |
486 </hlm:python> |
476 </hlm:python> |
487 </sequential> |
477 </sequential> |
488 </macrodef> |
478 </macrodef> |
489 |
479 |
641 prebuilder = archive.ArchivePreBuilder(configuration.ConfigurationSet(configs), config_type, outputtype) |
631 prebuilder = archive.ArchivePreBuilder(configuration.ConfigurationSet(configs), config_type, outputtype) |
642 if os.sep == '\\': |
632 if os.sep == '\\': |
643 toAppendEmakeRoot = prebuilder.checkRootDirValue(builder, config_parsed_filename, project.getProperty('build.drive'), config_type) |
633 toAppendEmakeRoot = prebuilder.checkRootDirValue(builder, config_parsed_filename, project.getProperty('build.drive'), config_type) |
644 if toAppendEmakeRoot is not None: |
634 if toAppendEmakeRoot is not None: |
645 project.setProperty("emake.root.to.append", str(toAppendEmakeRoot)) |
635 project.setProperty("emake.root.to.append", str(toAppendEmakeRoot)) |
|
636 else: |
|
637 project.setProperty("emake.root.to.append", "") |
646 prebuilder.writeTopLevel(os.path.join(project.getProperty('build.drive') + os.sep, 'ZIP_' + config_type + outputext), project.getProperty('temp.build.dir'), config_parsed_filename) |
638 prebuilder.writeTopLevel(os.path.join(project.getProperty('build.drive') + os.sep, 'ZIP_' + config_type + outputext), project.getProperty('temp.build.dir'), config_parsed_filename) |
647 else: |
639 else: |
648 raise Exception('There are no archive configs to build. Looked for %s' % config_type) |
640 raise Exception('There are no archive configs to build. Looked for %s' % config_type) |
649 ]]> |
641 ]]> |
650 </scriptdef> |
642 </scriptdef> |
892 print md5file.replace('.md5', '') |
884 print md5file.replace('.md5', '') |
893 </hlm:python> |
885 </hlm:python> |
894 |
886 |
895 <move file="${delta.zip.delete.file}" todir="${delta.zip.temp.location}" /> |
887 <move file="${delta.zip.delete.file}" todir="${delta.zip.temp.location}" /> |
896 <move file="${md5.signature.file}" todir="${delta.zip.temp.location}" /> |
888 <move file="${md5.signature.file}" todir="${delta.zip.temp.location}" /> |
897 |
889 |
898 <exec executable="C:\APPS\symrec\symrec" failonerror="${failonerror}"> |
890 <exec osfamily="windows" executable="C:\APPS\symrec\symrec" failonerror="${failonerror}"> |
899 <arg value="create" /> |
891 <arg value="create" /> |
900 <arg value="-ser" /> |
892 <arg value="-ser" /> |
901 <arg value="${release.grace.service}" /> |
893 <arg value="${hydra.service}" /> |
902 <arg value="-pro" /> |
894 <arg value="-pro" /> |
903 <arg value="${release.grace.product}" /> |
895 <arg value="${hydra.product}" /> |
904 <arg value="-rel" /> |
896 <arg value="-rel" /> |
905 <arg value="${release.label}" /> |
897 <arg value="${release.label}" /> |
906 <arg value="-relroot" /> |
898 <arg value="-relroot" /> |
907 <arg value="${delta.zip.location}" /> |
899 <arg value="${delta.zip.location}" /> |
908 <arg value="-dep" /> |
900 <arg value="-dep" /> |
909 <arg value="${release.grace.service}/${release.grace.product}/${old.release.label}" /> |
901 <arg value="${hydra.service}/${hydra.product}/${old.release.label}" /> |
910 </exec> |
902 </exec> |
911 |
903 |
912 <move file="${delta.zip.temp.location}/specialInstructions.xml" tofile="${delta.zip.delete.file}" /> |
904 <move file="${delta.zip.temp.location}/specialInstructions.xml" tofile="${delta.zip.delete.file}" /> |
913 <move file="${delta.zip.temp.location}/${build.id}.md5" tofile="${md5.signature.file}" /> |
905 <move file="${delta.zip.temp.location}/${build.id}.md5" tofile="${md5.signature.file}" /> |
914 </target> |
906 </target> |
950 </target> |
942 </target> |
951 |
943 |
952 |
944 |
953 <!-- Creates a delta from the prevous build to the current one --> |
945 <!-- Creates a delta from the prevous build to the current one --> |
954 <target name="delta-zip" depends="delta-use-last-build,build-md5,generate-delta" description="Generate a delta between two build areas" /> |
946 <target name="delta-zip" depends="delta-use-last-build,build-md5,generate-delta" description="Generate a delta between two build areas" /> |
955 |
|
956 |
|
957 <!-- Upload the delta and config into Grace --> |
|
958 <target name="delta-zip-grace-upload"> |
|
959 <fileset id="grace.delta.zips.id" dir="${delta.zip.location}"> |
|
960 <include name="**/*.zip" /> |
|
961 <include name="**/*.xml" /> |
|
962 </fileset> |
|
963 |
|
964 <antcall target="grace-upload"> |
|
965 <reference refid="grace.delta.zips.id" torefid="release.zips" /> |
|
966 </antcall> |
|
967 </target> |
|
968 |
|
969 |
947 |
970 <!-- Publishes the Ant build log. |
948 <!-- Publishes the Ant build log. |
971 |
949 |
972 First the logging should be stopped, before the file is copied. Hence this target should be called |
950 First the logging should be stopped, before the file is copied. Hence this target should be called |
973 by the "final" target last. |
951 by the "final" target last. |
1044 <!-- Does any wrap-up at the end of the build. This should be the last target for every top-level target. --> |
1022 <!-- Does any wrap-up at the end of the build. This should be the last target for every top-level target. --> |
1045 <target name="final" depends="build-status, build-log-summary, copy-debug-logs, publish-build-log, log-environment" /> |
1023 <target name="final" depends="build-status, build-log-summary, copy-debug-logs, publish-build-log, log-environment" /> |
1046 |
1024 |
1047 |
1025 |
1048 <!-- This target will zip the WA depending on the ado mapping file --> |
1026 <!-- This target will zip the WA depending on the ado mapping file --> |
1049 <target name="zip-wa" depends="ido-create-ado-mapping" if="internal.archive.wa.enabled"> |
1027 <target name="zip-wa" if="internal.archive.wa.enabled"> |
|
1028 <property name="zip.mapping.file" location="${build.output.dir}/build/ado_mapping_zip.ini" /> |
|
1029 <hlm:createAdoMappingMacro adoMapFile="${zip.mapping.file}" /> |
1050 <tempfile property="zipwa.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/> |
1030 <tempfile property="zipwa.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/> |
1051 <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/zip-ant-wa-copy.xml.ftl" outputFile="${zipwa.dynamic.config}"> |
1031 <fmpp sourceFile="${helium.dir}/tools/publish/templates/zip-ant-wa-copy.xml.ftl" outputFile="${zipwa.dynamic.config}"> |
1052 <data expandProperties="yes"> |
1032 <data expandProperties="yes"> |
1053 inputfile: antProperty(ado.mapping.file) |
1033 inputfile: antProperty(zip.mapping.file) |
1054 ant: antProperties() |
1034 ant: antProperties() |
1055 data: eval(' |
1035 data: eval(' |
1056 java.io.FileInputStream pin = new java.io.FileInputStream(filename); |
1036 java.io.FileInputStream pin = new java.io.FileInputStream(filename); |
1057 java.util.Properties props = new java.util.Properties(); |
1037 java.util.Properties props = new java.util.Properties(); |
1058 props.load(pin); |
1038 props.load(pin); |