示例#1
0
文件: _deb.py 项目: ycliuhw/snapcraft
    def _mark_install(cls, apt_cache: apt.Cache,
                      package_names: List[str]) -> None:
        for name in package_names:
            if name.endswith(":any"):
                name = name[:-4]
            if apt_cache.is_virtual_package(name):
                name = apt_cache.get_providing_packages(name)[0].name
            logger.debug(
                "Marking {!r} (and its dependencies) to be fetched".format(
                    name))
            name_arch, version = repo.get_pkg_name_parts(name)
            try:
                if version:
                    _set_pkg_version(apt_cache[name_arch], version)
                # Disable automatic resolving of broken packages here
                # because if that fails it raises a SystemError and the
                # API doesn't expose enough information about he problem.
                # Instead we let apt-get show a verbose error message later.
                # Also, make sure this package is marked as auto-installed,
                # which will propagate to its dependencies.
                apt_cache[name_arch].mark_install(auto_fix=False,
                                                  from_user=False)

                # Now mark this package as NOT automatically installed, which
                # will leave its dependencies marked as auto-installed, which
                # allows us to clean them up if necessary.
                apt_cache[name_arch].mark_auto(False)

                cls._verify_marked_install(apt_cache[name_arch])
            except KeyError:
                raise errors.PackageNotFoundError(name)
示例#2
0
文件: _deb.py 项目: songzcn/snapcraft
 def _mark_install(cls, apt_cache: apt.Cache,
                   package_names: List[str]) -> None:
     for name in package_names:
         if name.endswith(':any'):
             name = name[:-4]
         if apt_cache.is_virtual_package(name):
             name = apt_cache.get_providing_packages(name)[0].name
         logger.debug('Marking {!r} (and its dependencies) to be '
                      'fetched'.format(name))
         name_arch, version = repo.get_pkg_name_parts(name)
         try:
             if version:
                 _set_pkg_version(apt_cache[name_arch], version)
             # Disable automatic resolving of broken packages here
             # because if that fails it raises a SystemError and the
             # API doesn't expose enough information about he problem.
             # Instead we let apt-get show a verbose error message later.
             apt_cache[name_arch].mark_install(auto_fix=False)
             cls._verify_marked_install(apt_cache[name_arch])
         except KeyError:
             raise errors.PackageNotFoundError(name)