]> git.saurik.com Git - apt.git/commitdiff
merged from the mvo branch
authorMichael Vogt <mvo@debian.org>
Fri, 8 Apr 2011 12:36:08 +0000 (14:36 +0200)
committerMichael Vogt <mvo@debian.org>
Fri, 8 Apr 2011 12:36:08 +0000 (14:36 +0200)
apt-pkg/aptconfiguration.cc
debian/apt.cron.daily
debian/changelog
methods/mirror.cc

index 14ee09e0d2ea7c5c34e6d5b6af02f5465a011edc..ca602d4bfd1df5fa17938e32c0aee7b1eb28332f 100644 (file)
@@ -337,7 +337,7 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
                                char* arch = strtok(buf, " ");
                                while (arch != NULL) {
                                        for (; isspace(*arch) != 0; ++arch);
-                                       if (arch != '\0') {
+                                       if (arch[0] != '\0') {
                                                char const* archend = arch;
                                                for (; isspace(*archend) == 0 && *archend != '\0'; ++archend);
                                                archs.push_back(string(arch, (archend - arch)));
index c61bfb9bb3cd0f7c885f6eca09f13b002d694be2..75986f5f5f52c6f60e61e44e1f09e080abadafc8 100644 (file)
@@ -466,7 +466,7 @@ fi
 
 # auto upgrade all upgradeable packages
 UPGRADE_STAMP=/var/lib/apt/periodic/upgrade-stamp
-if [ $UPDATED -eq 1 ] && which unattended-upgrade >/dev/null && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
+if which unattended-upgrade >/dev/null && check_stamp $UPGRADE_STAMP $UnattendedUpgradeInterval; then
     if unattended-upgrade $XUUPOPT; then
        update_stamp $UPGRADE_STAMP
        debug_echo "unattended-upgrade (success)"
index 486a4de8c044d77ae0f976623cf4481b52e02908..6878debc5e2e91ebda871945ffbd10755b11f141 100644 (file)
@@ -1,10 +1,20 @@
 apt (0.8.13.3) UNRELEASED; urgency=low
 
+  [ Julian Andres Klode ]
   * apt-pkg/indexcopy.cc:
     - Use RealFileExists() instead of FileExists(), allows amongst other
       things a directory named Sources to exist on a CD-ROM (LP: #750694).
   * apt-pkg/acquire-item.cc:
     - Use Release files even if they cannot be verified (LP: #704595)
+  
+  [ Michael Vogt ]
+  * mirror method:
+    - do not crash if the mirror file fails to download
+  * apt-pkg/aptconfiguration.cc:
+    - fix comparing for a empty string
+  * debian/apt.cron.daily:
+    - run unattended-upgrades even if there was a error during
+      the apt-get update (LP: #676295)
 
  -- Julian Andres Klode <jak@debian.org>  Thu, 07 Apr 2011 11:48:46 +0200
 
index e499b054b15edb0e36a62bf08417a6867e6aeba4..2cf5c9ce1110a9d7f9b259cf9913451b89126d94 100644 (file)
@@ -141,8 +141,10 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
    pkgAcquire Fetcher;
    new pkgAcqFile(&Fetcher, fetch, "", 0, "", "", "", MirrorFile);
    bool res = (Fetcher.Run() == pkgAcquire::Continue);
-   if(res)
+   if(res) {
       DownloadedMirrorFile = true;
+      chmod(MirrorFile.c_str(), 0644);
+   }
    Fetcher.Shutdown();
 
    if(Debug)
@@ -158,6 +160,9 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file)
    vector<string> content;
    string line;
 
+   if (!FileExists(mirror_file))
+      return false;
+
    // read 
    ifstream in(mirror_file.c_str());
    while ( !in.eof() ) {
@@ -251,6 +256,13 @@ bool MirrorMethod::InitMirrors()
       return _error->Error(_("No mirror file '%s' found "), MirrorFile.c_str());
    }
 
+   if (access(MirrorFile.c_str(), R_OK) != 0)
+   {
+      // FIXME: fallback to a default mirror here instead 
+      //        and provide a config option to define that default
+      return _error->Error(_("Can not read mirror file '%s'"), MirrorFile.c_str());
+   }  
+
    // FIXME: make the mirror selection more clever, do not 
    //        just use the first one!
    // BUT: we can not make this random, the mirror has to be
@@ -354,8 +366,8 @@ bool MirrorMethod::Fetch(FetchItem *Itm)
    if(Itm->IndexFile && !DownloadedMirrorFile)
    {
       Clean(_config->FindDir("Dir::State::mirrors"));
-      DownloadMirrorFile(Itm->Uri);
-      RandomizeMirrorFile(MirrorFile);
+      if (DownloadMirrorFile(Itm->Uri))
+         RandomizeMirrorFile(MirrorFile);
    }
 
    if(AllMirrors.empty()) {