Skip to content

Commit

Permalink
Always ask user confirmation if self.cache.get_changes() is not null.
Browse files Browse the repository at this point in the history
Printing Metalink takes place after the confirmation like apt-get --print-uris.
  • Loading branch information
tatsuhiro-t committed Sep 19, 2010
1 parent c0e5fe0 commit 42a5e9d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apt-metalink
Expand Up @@ -55,16 +55,15 @@ class AptMetalink:
pkgs = self.cache.get_changes()
if pkgs:
print_update_summary(self.cache)
pkgs = [pkg for pkg in pkgs if self._need_download(pkg)]
if self.opts.print_metalink:
make_metalink(sys.stdout, pkgs)
return
if pkgs:
sys.stdout.write("Do you want to continue [Y/n]?")
ans = sys.stdin.readline().strip()
if ans and ans.lower() != 'y':
print "Abort."
return
pkgs = [pkg for pkg in pkgs if self._need_download(pkg)]
if self.opts.print_metalink:
make_metalink(sys.stdout, pkgs)
return
if not self._download(pkgs, num_concurrent=guess_concurrent(pkgs)):
print "Some download fails. apt_pkg will take care of them."
if self.opts.download_only:
Expand All @@ -73,6 +72,8 @@ class AptMetalink:
self.cache.commit()

def _download(self, pkgs, num_concurrent=1):
if not pkgs:
return True
proc = subprocess.Popen(
[self.opts.aria2c,
'--metalink-file=-',
Expand Down

0 comments on commit 42a5e9d

Please sign in to comment.