• Chandan Singh's avatar
    _artifactcache/pushreceive.py: Add Click type for CLI argument 'repo' · 1d694b28
    Chandan Singh authored
    The CLI for `bst-artifact-receive` expects a `repo` argument, which is
    supposed to be a directory, but Click currently expects it to be just
    any string. This results in stack traces like the one below when the
    argument provided is not a directory:
    
            $ ~/.local/bin/bst-artifact-receive --pull-url http://foo foobaz
            Traceback (most recent call last):
              File "/root/.local/bin/bst-artifact-receive", line 8, in <module>
                sys.exit(receive_main())
              ...
              File "/src/buildstream/buildstream/_artifactcache/pushreceive.py", line 581, in __init__
                self.repo.open(None)
            GLib.Error: g-io-error-quark: /src/buildstream/43fref: opendir(/src/buildstream/foobaz): No such file or directory (1)
    
    Add types for this argument such that it throws better error messages
    when it receives bad arguments. With the Click types added, it will
    instead fail with messages like these:
    
            $ ~/.local/bin/bst-artifact-receive --pull-url http://foo foobaz
            Usage: bst-artifact-receive [OPTIONS] REPO
    
            Error: Invalid value for "repo": Directory "foobaz" does not exist.
    
            $ ~/.local/bin/bst-artifact-receive --pull-url http://foo setup.py
            Usage: bst-artifact-receive [OPTIONS] REPO
    
            Error: Invalid value for "repo": Directory "setup.py" is a file.
    
    Fixes #409.
    1d694b28
Name
Last commit
Last update
..
_artifactcache Loading commit data...
_frontend Loading commit data...
_fuse Loading commit data...
_loader Loading commit data...
_options Loading commit data...
_platform Loading commit data...
_scheduler Loading commit data...
data Loading commit data...
plugins Loading commit data...
sandbox Loading commit data...
__init__.py Loading commit data...
_cachekey.py Loading commit data...
_context.py Loading commit data...
_elementfactory.py Loading commit data...
_exceptions.py Loading commit data...
_message.py Loading commit data...
_ostree.py Loading commit data...
_pipeline.py Loading commit data...
_plugincontext.py Loading commit data...
_profile.py Loading commit data...
_project.py Loading commit data...
_projectrefs.py Loading commit data...
_signals.py Loading commit data...
_site.py Loading commit data...
_sourcefactory.py Loading commit data...
_stream.py Loading commit data...
_variables.py Loading commit data...
_version.py Loading commit data...
_versions.py Loading commit data...
_workspaces.py Loading commit data...
_yaml.py Loading commit data...
buildelement.py Loading commit data...
element.py Loading commit data...
plugin.py Loading commit data...
scriptelement.py Loading commit data...
source.py Loading commit data...
utils.py Loading commit data...