Ubuntu Pastebin

Paste from Daniel Holbach at Thu, 4 Feb 2016 13:23:24 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
snapcraft/repo.py:import apt
snapcraft/repo.py:    with apt.Cache() as apt_cache:
snapcraft/repo.py:                if not apt_cache[pkg].installed:
snapcraft/repo.py:        subprocess.check_call(['sudo', 'apt-get', '-o',
snapcraft/repo.py:        self.apt_cache, self.apt_progress = _setup_apt_cache(
snapcraft/repo.py:                self.apt_cache[name].mark_install()
snapcraft/repo.py:        # note that this will break the consistency check inside apt_cache
snapcraft/repo.py:        # (self.apt_cache.broken_count will be > 0)
snapcraft/repo.py:        for pkg in self.apt_cache:
snapcraft/repo.py:        apt.apt_pkg.config.set("Dir::Cache::Archives", self.downloaddir)
snapcraft/repo.py:        self.apt_cache.fetch_archives(progress=self.apt_progress)
snapcraft/repo.py:                if pkg in self.apt_cache:
snapcraft/repo.py:    sources_list = glob.glob('/etc/apt/sources.list.d/*.list')
snapcraft/repo.py:    sources_list.append('/etc/apt/sources.list')
snapcraft/repo.py:def _setup_apt_cache(rootdir, sources, local=False):
snapcraft/repo.py:    os.makedirs(os.path.join(rootdir, 'etc', 'apt'), exist_ok=True)
snapcraft/repo.py:    srcfile = os.path.join(rootdir, 'etc', 'apt', 'sources.list')
snapcraft/repo.py:    apt.apt_pkg.config.set('Apt::Install-Recommends', 'False')
snapcraft/repo.py:    # apt.Cache(rootdir).
snapcraft/repo.py:        apt.apt_pkg.config.set(key, apt.apt_pkg.config.find_file(key))
snapcraft/repo.py:    progress = apt.progress.text.AcquireProgress()
snapcraft/repo.py:    apt_cache = apt.Cache(rootdir=rootdir, memonly=True)
snapcraft/repo.py:    apt_cache.update(fetch_progress=progress, sources_list=srcfile)
snapcraft/repo.py:    apt_cache.open()
snapcraft/repo.py:    return apt_cache, progress
Download as text