diff --git a/helpers/create-abi-bump.py b/helpers/create-abi-bump.py --- a/helpers/create-abi-bump.py +++ b/helpers/create-abi-bump.py @@ -234,6 +234,11 @@ lib.createABIDump() fileName = "abi_dumps/{name}/{name}_{version}.abi.tar.gz".format(name=lib.name,version=lib.version) # can replaced with f-String in python 3.6 - scmRevision = max([t['SONAME'] for t in lib.targets.values()]) # a more hackish way, to save the SONAME in the metadata + extraMetadata = { + "SONAME": max([t['SONAME'] for t in lib.targets.values()]), # use max because there may be more than one lib inside + "version": lib.version, + "libname": lib.name, + "targets": lib.targets.keys(), + } packageName = "{name}_{scmRevision}".format(name=lib.name, scmRevision=scmRevision) - ourArchive.storePackage(packageName, fileName, scmRevision) + ourArchive.storePackage(packageName, fileName, scmRevision, extraMetadata) diff --git a/helpers/helperslib/Packages.py b/helpers/helperslib/Packages.py --- a/helpers/helperslib/Packages.py +++ b/helpers/helperslib/Packages.py @@ -1,3 +1,4 @@ +import copy import os import re import stat @@ -134,17 +135,25 @@ return ( localContentsPath, localMetadata ) # Generates the metadata which is stored in the .yaml file that accompanies each package which is stored in the archive - def generateMetadataForFile( self, contentsNeedingMetadata, scmRevision ): + # Extra metadata saved to metadata file, and will be written to yaml file, needs to be a dict like object + def generateMetadataForFile( self, contentsNeedingMetadata, scmRevision, extraMetadata=None ): # First, determine the timestamp the file was last modified packageTimestamp = os.path.getmtime( contentsNeedingMetadata ) # Now the checksum packageChecksum = CommonUtils.generateFileChecksum( contentsNeedingMetadata ) - # Build the metadata which we'll be writing out - metadataForPackage = { + + metadataForPackage = {} + + # If we have extraMetadata for this Package pressed the metadata dictionary + if extraMetadata: + metadataForPackage = copy.copy(self.extraMetadata) + + # Update/adds the nessary keys, that we want to exist. + metadataForPackage.update({ 'timestamp': packageTimestamp, 'checksum': packageChecksum, 'scmRevision': scmRevision - } + }) # Write the YAML out to a temporary file latestMetadata = tempfile.NamedTemporaryFile(delete=False, mode='w', dir=self.temporaryFileLocation()) @@ -157,13 +166,14 @@ # Stores a package in the archive, either by creation of or updating of an existing package # As part of this process metadata will be generated for the package we are about to add to the archive to assist in caching later on # The package and it's metadata will then be uploaded to the remote archive and published, then transferred to our local cache - def storePackage( self, package, archiveFileToInclude, scmRevision = '' ): + # Extra metadata saved to metadata file, and will be written to yaml file, needs to be a dict like object + def storePackage( self, package, archiveFileToInclude, scmRevision = '', extraMetadata=None ): # Determine the names the metadata and archive files would have respectively metadataFilename = package + ".yaml" contentsFilename = package + ".tar" # Generate metadata for the package we are about to store - archiveMetadata = self.generateMetadataForFile( archiveFileToInclude, scmRevision ) + archiveMetadata = self.generateMetadataForFile( archiveFileToInclude, scmRevision, extraMetadata ) # Connect to the upload host privateKeyFile = os.path.join( os.path.expanduser('~'), 'Keys', self.name + '.key')