Merge lp://qastaging/~james-w/linaro-image-tools/create-hwpack-skeleton into lp://qastaging/linaro-image-tools/11.11
Proposed by
James Westby
Status: | Merged |
---|---|
Merged at revision: | 56 |
Proposed branch: | lp://qastaging/~james-w/linaro-image-tools/create-hwpack-skeleton |
Merge into: | lp://qastaging/linaro-image-tools/11.11 |
Prerequisite: | lp://qastaging/~james-w/linaro-image-tools/tarfile-matchers |
Diff against target: |
632 lines (+391/-84) 5 files modified
hwpack/config.py (+26/-20) hwpack/hardwarepack.py (+120/-0) hwpack/tests/__init__.py (+1/-0) hwpack/tests/test_config.py (+56/-64) hwpack/tests/test_hardwarepack.py (+188/-0) |
To merge this branch: | bzr merge lp://qastaging/~james-w/linaro-image-tools/create-hwpack-skeleton |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guilherme Salgado (community) | Approve | ||
Review via email:
|
Description of the change
Hi,
Here's the skeleton of hwpack creation. It's a couple of classes that you can
instantiate and have them co-operate to produce a perfectly valid, if useless,
hardware pack.
I wanted to push this up, and then I'll followup with methods to actually add
packages etc. once I know what API we want for that.
Thanks,
James
To post a comment you must log in.
Hi James,
I have a few suggestions, but this looks very good.
review approve
On Tue, 2010-08-31 at 18:44 +0000, James Westby wrote: infrastructure) hardwarepack. py' hardwarepack. py 1970-01-01 00:00:00 +0000 hardwarepack. py 2010-08-31 18:44:46 +0000 better_ tarfile import writeable_tarfile object) : LIST_DIRNAME = "sources.list.d" LIST_GPG_ DIRNAME = "sources. list.d. gpg" support is None: support %s_%s%s. tar.gz" % ( version, support_suffix)
> James Westby has proposed merging lp:~james-w/linaro-image-tools/create-hwpack-skeleton into lp:linaro-image-tools with lp:~james-w/linaro-image-tools/tarfile-matchers as a prerequisite.
>
> Requested reviews:
> Linaro Infrastructure (linaro-
>
>
> Hi,
>
> Here's the skeleton of hwpack creation. It's a couple of classes that you can
> instantiate and have them co-operate to produce a perfectly valid, if useless,
> hardware pack.
>
> I wanted to push this up, and then I'll followup with methods to actually add
> packages etc. once I know what API we want for that.
>
> Thanks,
>
> James
> differences between files attachment (review-diff.txt)
> === added file 'hwpack/
> --- hwpack/
> +++ hwpack/
> @@ -0,0 +1,63 @@
> +from hwpack.
> +
> +
> +class Metadata(object):
> +
> + def __init__(self, name, version, origin=None, maintainer=None,
> + support=None):
> + self.name = name
> + self.version = version
> + self.origin = origin
> + self.maintainer = maintainer
> + self.support = support
> +
> + def __str__(self):
> + metadata = "NAME=%s\n" % self.name
> + metadata += "VERSION=%s\n" % self.version
> + if self.origin is not None:
> + metadata += "ORIGIN=%s\n" % self.origin
> + if self.maintainer is not None:
> + metadata += "MAINTAINER=%s\n" % self.maintainer
> + if self.support is not None:
> + metadata += "SUPPORT=%s\n" % self.support
> + return metadata
> +
> +
> +class HardwarePack(
> +
> + FORMAT = "1.0"
> + FORMAT_FILENAME = "FORMAT"
> + METADATA_FILENAME = "metadata"
> + MANIFEST_FILENAME = "manifest"
> + PACKAGES_DIRNAME = "pkgs"
> + PACKAGES_FILENAME = "%s/Packages" % PACKAGES_DIRNAME
> + SOURCES_
> + SOURCES_
> +
> + def __init__(self, metadata):
> + self.metadata = metadata
> +
> + def filename(self):
> + if self.metadata.
> + support_suffix = ""
> + else:
> + support_suffix = "_%s" % self.metadata.
> + return "hwpack_
> + self.metadata.name, self.metadata.
> +
> + def to_f(self, fileobj):
Why not to_file()?
> + kwargs = {} "default_ uid"] = 1000 "default_ gid"] = 1000 "default_ uname"] = "user" "default_ gname"] = "group" tarfile( fileobj, mode="w:gz", **kwargs) as tf: file_from_ string( FILENAME, self.FORMAT + "\n") file_from_ string( FILENAME, str(self.metadata)) file_from_ string( self.MANIFEST_ FILENAME, "") dir(self. PAC...
> + kwargs[
> + kwargs[
> + kwargs[
> + kwargs[
> + with writeable_
> + tf.create_
> + self.FORMAT_
> + tf.create_
> + self.METADATA_
> + tf.create_
> + tf.create_