Merge lp://qastaging/~dooferlad/linaro-image-tools/fetch_image_cli into lp://qastaging/linaro-image-tools/11.11
Proposed by
James Tunnicliffe
Status: | Merged |
---|---|
Approved by: | James Westby |
Approved revision: | 358 |
Merged at revision: | 359 |
Proposed branch: | lp://qastaging/~dooferlad/linaro-image-tools/fetch_image_cli |
Merge into: | lp://qastaging/linaro-image-tools/11.11 |
Prerequisite: | lp://qastaging/~dooferlad/linaro-image-tools/fetch_image_server_indexer |
Diff against target: |
83 lines (+79/-0) 1 file modified
fetch_image.py (+79/-0) |
To merge this branch: | bzr merge lp://qastaging/~dooferlad/linaro-image-tools/fetch_image_cli |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby (community) | Approve | ||
Review via email:
|
Description of the change
A simple CLI tool that drives the FetchImage library.
To post a comment you must log in.
some comments from the other reviews apply ;-)
On Wed, Jun 15, 2011, James Tunnicliffe wrote: image_tools. FetchImage as FetchImage
> +import linaro_
> +import logging
> +
> +if __name__ == '__main__':
From there, I would only call into a
def main():
function as to help testing and code reuse
> + file_handler = FetchImage. FileHandler( ) update_ files_from_ server( force_download) read_config( file_handler. settings_ file) parse_args( sys.argv[ 1:]) args['platform' ] == "snapshot": args['release_ or_snapshot' ] = "snapshot" args['release_ or_snapshot' ] = "release"
> + config = FetchImage.Config()
> +
> + # Unfortunately we need to do a bit of a hack here and look for some options before performing
> + # a full options parse.
> + clean_cache = ( "--clean-cache" in sys.argv[1:]
> + or "-x" in sys.argv[1:])
> +
> + force_download = ( "--force-download" in sys.argv[1:]
> + or "-d" in sys.argv[1:])
> +
> + # If the settings file and server index need updating, grab them
> + file_handler.
> +
> + # Load settings YAML, which defines the parameters we ask for and acceptable responses from the user
> + config.
> +
> + # Using the settings that the YAML defines as what we need for a build, generate a command line parser
> + # and parse the command line
> + config.
> +
> + if config.
> + config.
> + else:
> + config.
Instead of release_ or_snapshot, "archive"? or "source"?
> + # Using the config we have, look up URLs to download data from in the server index DB(file_ handler. index_file) image_and_ hwpack_ urls(config. args) create_ media(image_ url, hwpack_url, config.args) error(" Unable to find files that match the parameters specified")
> + db = FetchImage.
> +
> + image_url, hwpack_url = db.get_
> +
> + if(image_url and hwpack_url):
> + file_handler.
> + else:
> + logging.
>
--
Loïc Minier