optimize AlienPackage.expand() method
metadata currently collected through the AlienPackage.expand() method (which requires to uncompress tar archives every time, and such archives sometimes are very huge and consume a lot of machine time) should be collected by tinfoilhat only once and stored in should be collected only when they are actually needed.tinfoilhat.json
files
Currently there are three specific operations that consume a lot of machine time in the expand() method, but each of them is needed only at a specific stage:
- package file checksums check, which checks if the file checksums in the aliensrc.json file match the actual checksums of the package files: it should be done only once, when adding an alienpackage
- get internal archive checksums, which extracts files in an internal archive and calculate all checksums: it is needed only by the spdxalien command
- get internal archive rootfolder, which tries to find if an internal archive has a main/root folder inside: it is needed only by the upload command
So three boolean options should be added to the expand() method, in order to trigger the above operations only when needed and save machine time
Edited by Alberto Pianon