Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Commit

Permalink
fix many issues to reduce apt-get update calls
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhalter committed Dec 11, 2013
1 parent 49c6ea1 commit 854f9ba
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions depl/deploy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def load(name, settings):
def install_packages():
# only working for apt
with hide('stdout'):
apt_txt = run('cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list')
# Need a new line after sources.list, which sometimes doesn't end
# with one, easiest option: awk.
apt_txt = run('awk \'FNR==1{print ""}1\' '
'/etc/apt/sources.list /etc/apt/sources.list.d/*')

force_update = False
for package in packages:
Expand Down Expand Up @@ -93,12 +96,12 @@ def needs_additional_repo(self, sources_txt):
if 'repo' not in self._properties:
return False

# only working for apt
repo_search = self._properties['repo']
if repo_search.startswith('ppa:'):
repo_search = 'http://ppa.launchpad.net/' + repo_search[4:]
repo_search = 'deb http://ppa.launchpad.net/' + repo_search[4:]
repo_search = re.escape(repo_search)
# only working for apt
return re.match('^deb %s\s*$' % repo_search, sources_txt) is None
return re.search('^%s' % repo_search, sources_txt, re.MULTILINE) is None

def install_additional_repo(self):
if package_manager.system() == 'apt':
Expand Down

0 comments on commit 854f9ba

Please sign in to comment.