Allow installing unsigned binary packages (#11107)
This commit introduces a `--no-check-signature` option for `spack install` so that unsigned packages can be installed. It is off by default (signatures required).
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							458c9a22bf
						
					
				
				
					commit
					22c9f5cbd8
				
			@@ -42,7 +42,8 @@ def update_kwargs_from_args(args, kwargs):
 | 
				
			|||||||
        'use_cache': args.use_cache,
 | 
					        'use_cache': args.use_cache,
 | 
				
			||||||
        'cache_only': args.cache_only,
 | 
					        'cache_only': args.cache_only,
 | 
				
			||||||
        'explicit': True,  # Always true for install command
 | 
					        'explicit': True,  # Always true for install command
 | 
				
			||||||
        'stop_at': args.until
 | 
					        'stop_at': args.until,
 | 
				
			||||||
 | 
					        'unsigned': args.unsigned,
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    kwargs.update({
 | 
					    kwargs.update({
 | 
				
			||||||
@@ -98,6 +99,10 @@ def setup_parser(subparser):
 | 
				
			|||||||
        '--cache-only', action='store_true', dest='cache_only', default=False,
 | 
					        '--cache-only', action='store_true', dest='cache_only', default=False,
 | 
				
			||||||
        help="only install package from binary mirrors")
 | 
					        help="only install package from binary mirrors")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subparser.add_argument(
 | 
				
			||||||
 | 
					        '--no-check-signature', action='store_true',
 | 
				
			||||||
 | 
					        dest='unsigned', default=False,
 | 
				
			||||||
 | 
					        help="do not check signatures of binary packages")
 | 
				
			||||||
    subparser.add_argument(
 | 
					    subparser.add_argument(
 | 
				
			||||||
        '--show-log-on-error', action='store_true',
 | 
					        '--show-log-on-error', action='store_true',
 | 
				
			||||||
        help="print full build log to stderr if build fails")
 | 
					        help="print full build log to stderr if build fails")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1508,7 +1508,7 @@ def _update_explicit_entry_in_db(self, rec, explicit):
 | 
				
			|||||||
                message = '{s.name}@{s.version} : marking the package explicit'
 | 
					                message = '{s.name}@{s.version} : marking the package explicit'
 | 
				
			||||||
                tty.msg(message.format(s=self))
 | 
					                tty.msg(message.format(s=self))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def try_install_from_binary_cache(self, explicit):
 | 
					    def try_install_from_binary_cache(self, explicit, unsigned=False):
 | 
				
			||||||
        tty.msg('Searching for binary cache of %s' % self.name)
 | 
					        tty.msg('Searching for binary cache of %s' % self.name)
 | 
				
			||||||
        specs = binary_distribution.get_spec(spec=self.spec,
 | 
					        specs = binary_distribution.get_spec(spec=self.spec,
 | 
				
			||||||
                                             force=False)
 | 
					                                             force=False)
 | 
				
			||||||
@@ -1525,7 +1525,7 @@ def try_install_from_binary_cache(self, explicit):
 | 
				
			|||||||
        tty.msg('Installing %s from binary cache' % self.name)
 | 
					        tty.msg('Installing %s from binary cache' % self.name)
 | 
				
			||||||
        binary_distribution.extract_tarball(
 | 
					        binary_distribution.extract_tarball(
 | 
				
			||||||
            binary_spec, tarball, allow_root=False,
 | 
					            binary_spec, tarball, allow_root=False,
 | 
				
			||||||
            unsigned=False, force=False)
 | 
					            unsigned=unsigned, force=False)
 | 
				
			||||||
        self.installed_from_binary_cache = True
 | 
					        self.installed_from_binary_cache = True
 | 
				
			||||||
        spack.store.db.add(
 | 
					        spack.store.db.add(
 | 
				
			||||||
            self.spec, spack.store.layout, explicit=explicit)
 | 
					            self.spec, spack.store.layout, explicit=explicit)
 | 
				
			||||||
@@ -1666,7 +1666,8 @@ def do_install(self, **kwargs):
 | 
				
			|||||||
        tty.msg(colorize('@*{Installing} @*g{%s}' % self.name))
 | 
					        tty.msg(colorize('@*{Installing} @*g{%s}' % self.name))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if kwargs.get('use_cache', True):
 | 
					        if kwargs.get('use_cache', True):
 | 
				
			||||||
            if self.try_install_from_binary_cache(explicit):
 | 
					            if self.try_install_from_binary_cache(
 | 
				
			||||||
 | 
					                    explicit, unsigned=kwargs.get('unsigned', False)):
 | 
				
			||||||
                tty.msg('Successfully installed %s from binary cache'
 | 
					                tty.msg('Successfully installed %s from binary cache'
 | 
				
			||||||
                        % self.name)
 | 
					                        % self.name)
 | 
				
			||||||
                print_pkg(self.prefix)
 | 
					                print_pkg(self.prefix)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -945,7 +945,7 @@ _spack_info() {
 | 
				
			|||||||
_spack_install() {
 | 
					_spack_install() {
 | 
				
			||||||
    if $list_options
 | 
					    if $list_options
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
        SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --overwrite --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --show-log-on-error --source -n --no-checksum -v --verbose --fake --only-concrete -f --file --clean --dirty --test --run-tests --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all"
 | 
					        SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --overwrite --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --no-check-signature --show-log-on-error --source -n --no-checksum -v --verbose --fake --only-concrete -f --file --clean --dirty --test --run-tests --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        _all_packages
 | 
					        _all_packages
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user