On 11/27/2012 11:34 AM, Richard Maw wrote:
On Tue, Nov 27, 2012 at 11:20:10AM +0000, Ben Brewer wrote:
> ---
> scripts/assemble-stratum | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/assemble-stratum b/scripts/assemble-stratum
> index 9addd36..e165e89 100755
> --- a/scripts/assemble-stratum
> +++ b/scripts/assemble-stratum
> @@ -31,14 +31,17 @@ class AssembleStratum(cliapp.Application):
> self.settings.string(['cachedir'],
> 'Where the cache basedir is')
> self.settings.string(['tarformat'],
> - 'What format to write tar to',
> + 'What format to write tar to (gz, bz2)',
> default='')
>
> def process_args(self, args):
> + if len(args) < 2:
> + raise cliapp.AppException('Need a stratum file and an output
file')
> +
> chunklist = json.load(open(args[0]))
> tarformat = 'w'
> if self.settings['tarformat'] != "":
> - tarformat += self.settings['tarformat']
> + tarformat += ':%s' % self.settings['tarformat']
> outfile = tarfile.open(args[1], tarformat)
> # concatenate chunk tarballs
> for chunk in chunklist:
Looks good, I only left the colon in for simplicity.
> @@ -50,10 +53,15 @@ class AssembleStratum(cliapp.Application):
> else:
> outfile.addfile(tarinfo)
> chunktar.close()
> +
> # add the stratum's metadata
> + metapath = args[0]
> + if len(args) > 2:
> + metapath = args[2]
> + metapath += '.meta'
> if os.path.exists(args[0] + '.meta'):
> outfile.add(args[0] + '.meta',
> - os.path.join('baserock', '%s.meta' %
args[2]))
> + os.path.join('baserock', metapath))
> outfile.close()
>
> AssembleStratum().run()
The second argument to outfile.add is the path that appears in the
tarball. metapath as it is, is the path to the file from your
filesystem, it's supposed to appear in the tarball as
baserock/$stratum_name.meta, with this it would appear as
/path/to/your/cache/$stratum.meta.
This is not necessary for fillers though, so perhaps making the meta
file not be included if it is not given would be better.
If the test suite no longer uses this script either, then feel free to
rename it to assemble-filler.
There are 3 tests and the bootstrap script that still use assemble-stratum.
Sam