Permalink
Browse files

Always ask user confirmation if self.cache.get_changes() is not null.

Printing Metalink takes place after the confirmation like apt-get --print-uris.
  • Loading branch information...
1 parent c0e5fe0 commit 42a5e9d1b3bbdc0b619deebf9290f88e891c7945 @tatsuhiro-t committed Sep 19, 2010
Showing with 6 additions and 5 deletions.
  1. +6 −5 apt-metalink
View
@@ -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:
@@ -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=-',

0 comments on commit 42a5e9d

Please sign in to comment.