diff -r 820b22e13ff1 -r 39c28ec933dd buildframework/helium/tools/publish/publish.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/tools/publish/publish.ant.xml Mon May 10 19:54:49 2010 +0100 @@ -0,0 +1,935 @@ + + + + + + Zipping, delta zipping and copying targets + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0: + filelist = [] + for config in configs: + if config.get_boolean("grace.metadata", False): + metadata = os.path.join(config['archives.dir'], config['name']+ ".metadata.xml") + if os.path.exists(metadata): + LOGGER.info("Found %s" % metadata) + filelist.append(metadata) + + merger = None + metadata_main = os.path.join(configs[0]['archives.dir'], "release_metadata.xml") + if os.path.exists(metadata_main): + merger = symrec.MetadataMerger(metadata_main) + merge_filelist(merger, filelist) + LOGGER.info(str("Writing %s" % metadata_main)) + merger.save() + elif len(filelist) > 0: + input = filelist.pop(0) + merger = symrec.MetadataMerger(input) + merge_filelist(merger, filelist) + LOGGER.info(str("Writing %s" % metadata_main)) + merger.save(metadata_main) + os.unlink(input) +except Exception, e: + LOGGER.error('ERROR: %s' % e) + sys.exit(-1) +]]> + + + + + + + + + + + + + + + + + + + + + + + 0: + if os.path.exists(os.path.join(configs[0]['archives.dir'], "release_metadata.xml")): + md5update = symrec.MD5Updater(os.path.join(configs[0]['archives.dir'], "release_metadata.xml")) + md5update.update() + md5update.save() + else: + LOGGER.warning(str('WARNING: Could not find %s.' % os.path.join(configs[0]['archives.dir'], "release_metadata.xml"))) + else: + LOGGER.warning('WARNING: No config.') +except Exception, e: + LOGGER.error('ERROR: %s' % e) + sys.exit(-1) +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + emake.root.to.append=${emake.root.to.append} + + + + + + + + + + + + + + + + + + +import archive +import configuration + +builder = configuration.NestedConfigurationBuilder(open(r'${zip.config.file.parsed}', 'r')) +configSet = builder.getConfiguration() +configs = configSet.getConfigurations(r'${zips.@{type}.spec.name}') +prebuilder = archive.ArchivePreBuilder(configuration.ConfigurationSet(configs), r'${zips.@{type}.spec.name}') +prebuilder.cleanupSubstDrives() + + + + + + + ERROR: ${exception} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 or not failonemptyconfig: + prebuilder = archive.ArchivePreBuilder(configuration.ConfigurationSet(configs), config_type, outputtype) + if os.sep == '\\': + toAppendEmakeRoot = prebuilder.checkRootDirValue(builder, config_parsed_filename, project.getProperty('build.drive'), config_type) + if toAppendEmakeRoot is not None: + project.setProperty("emake.root.to.append", str(toAppendEmakeRoot)) + prebuilder.writeTopLevel(os.path.join(project.getProperty('build.drive') + os.sep, 'ZIP_' + config_type + outputext), project.getProperty('temp.build.dir'), config_parsed_filename) +else: + raise Exception('There are no archive configs to build. Looked for %s' % config_type) +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +import sys, smtplib, string + +fromaddr = r'${email.from}' +toaddrs = r'${diamonds.mail}' +smtpserver = r'${email.smtp.server}' +subject = "[DIAMONDS_DATA] ${build.id}>>>${diamonds.host}>>>${diamonds.path}" +file = open(r'${diamonds.log.file}', 'r') +msg = file.read() +body = string.join(("From: %s" %fromaddr, "To: %s" %toaddrs, "Subject: %s" %subject, "", msg), "\r\n") +try: + server = smtplib.SMTP(smtpserver) + server.sendmail(fromaddr, toaddrs, body) + server.quit() + print "Mail sent to " , toaddrs +except Exception: + print "SMTP server " + smtpserver + " unavailable!! Unable to send log to " , toaddrs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +import os +import delta_zip +builder = delta_zip.MD5SignatureBuilderEBS("${build.drive}", r"${md5.split}", r"${delta.zip.temp.location}", r"${delta.exclude.commasep}", r"${delta.zip.temp.location}\list_files.txt") +builder.build(r"${md5.signature.file}") + + + + + + + + + delta.zip.temp.location: ${delta.zip.temp.location} + +import os +import delta_zip +builder = delta_zip.MD5SignatureBuilderEC("${build.drive}", r"${md5.split}", r"${delta.zip.temp.location}", r"${delta.exclude.commasep}", "${ec.cluster.manager}", "${ec.build.class}", r"${delta.zip.temp.location}\list_files.txt") +builder.build("${md5.signature.file}") + + + + + + + + + + + build MD5 started + + + + build EC MD5 + + + + build EBS MD5 + + + + + + + + + +import delta_zip + +delta = delta_zip.DeltaZipBuilder(r'${build.drive}', r'${delta.zip.temp.location}', r'${old.md5.file}', r'${md5.signature.file}') +delta.create_delta_zip(r'${delta.zip.file}', r'${delta.zip.delete.file}', r'${number.of.threads}', r'${delta.ant.file}') + + + + + +import ant +import os +md5file = os.path.basename(ant.get_property(r'${old.md5.file}')) +print md5file.replace('.md5', '') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +import re +import ant +import os + +previousbuildnumber = 1 +buildnum = r"${build.number}" + +while(previousbuildnumber > 0 and previousbuildnumber != ''): + previousbuildnumber = ant.get_previous_build_number(buildnum) + + try: + md5lastbuild = re.sub(r'\.(${build.number})([\/_.])', r'.' + previousbuildnumber + r'\2', r'${md5.current.build}') + if os.path.exists(md5lastbuild): + print md5lastbuild + break + except ValueError: + print "Old MD5 cannot be found" + + buildnum = previousbuildnumber +if not os.path.exists(md5lastbuild): + print "Old MD5 cannot be found" + + old.md5.file: ${old.md5.file} + + ${old.md5.file.present} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inputfile: antProperty(ado.mapping.file) + ant: antProperties() + data: eval(' + java.io.FileInputStream pin = new java.io.FileInputStream(filename); + java.util.Properties props = new java.util.Properties(); + props.load(pin); + return props; + ', {filename:get(inputfile)}) + + + + + +