fixed setting autorefresh flag for installation sources
authorJiri Srain <jsrain@suse.cz>
Thu, 6 Apr 2006 14:56:30 +0000 (14:56 +0000)
committerJiri Srain <jsrain@suse.cz>
Thu, 6 Apr 2006 14:56:30 +0000 (14:56 +0000)
package/libzypp.changes
zypp/media/MediaAccess.cc
zypp/media/MediaAccess.h
zypp/source/SourceImpl.cc
zypp/source/susetags/ProductMetadataParser.cc
zypp/source/susetags/ProductMetadataParser.h
zypp/source/susetags/SuseTagsImpl.cc

index a96d733..dac53e3 100644 (file)
@@ -1,4 +1,9 @@
 -------------------------------------------------------------------
+Thu Apr  6 16:37:49 CEST 2006 - jsrain@suse.de
+
+- fixed setting autorefresh flag for installation sources
+
+-------------------------------------------------------------------
 Thu Apr  6 15:53:02 CEST 2006 - kkaempf@suse.de
 
 - drop patches with incompatible architecture.
index dc3d1ca..7a033e2 100644 (file)
@@ -150,6 +150,14 @@ MediaAccess::downloads(const Url &url)
     return (scheme == "ftp" || scheme == "http" || scheme == "https");
 }
 
+// STATIC
+bool
+MediaAccess::canBeVolatile(const Url &url)
+{
+    std::string scheme( url.getScheme());
+    return ! (scheme == "cd" || scheme == "dvd");
+}
+
 // Type of media if open, otherwise NONE.
 std::string
 MediaAccess::protocol() const
index 2ddd059..ec4f8d1 100644 (file)
@@ -119,6 +119,17 @@ namespace zypp {
         */
        static
        bool        downloads(const Url &url);
+       /**
+        * Hint whether the media can provide volatile contents
+        *
+        * @note This hint is based on the \p url scheme
+        * only and does not imply, that the URL is valid.
+        *
+        * @param url The media URL to check.
+        * @return True, if the files are downloaded.
+        */
+       static
+       bool        canBeVolatile(const Url &url);
 
        /**
         * Used Protocol if media is opened, otherwise 'unknown'.
index 4da11fa..5048c68 100644 (file)
@@ -65,8 +65,8 @@ namespace zypp
       _cache_dir = cache_dir_r;
       _subscribed = true;
 
-      // for remote sources we enable autorefresh by default
-      _autorefresh = media::MediaAccess::downloads( _url );
+      // for sources which are neither CD nor DVD we enable autorefresh by default
+      _autorefresh = media::MediaAccess::canBeVolatile( _url );
 
       try
         {
index 36d4a2c..5d33b65 100644 (file)
@@ -64,6 +64,7 @@ namespace zypp
         }
 
         std::string buffer;
+       volatile_content = false;
         while(file && !file.eof())
         {
           getline(file, buffer);
@@ -148,6 +149,8 @@ namespace zypp
               parseFileCheckSum( key, value, prodImpl->_descr_files_checksums);
             else if(key == "KEY")
               parseFileCheckSum( key, value, prodImpl->_signing_keys);
+           else if(key == "VOLATILE_CONTENT")
+             volatile_content = true;
             else
               DBG << "Unknown key [" << key << "] with value [" << value << "]" << std::endl;
           }
index ea53a56..7d8510a 100644 (file)
@@ -74,6 +74,9 @@ namespace zypp
          */
         void parseFileCheckSum( const std::string &key, const std::string &value, std::map<std::string, CheckSum> &container);
 
+
+       bool volatile_content;
+
       };
       ///////////////////////////////////////////////////////////////////
 
index 3464804..f5aa072 100644 (file)
@@ -428,6 +428,7 @@ namespace zypp
           MIL << "Product: " << product->summary() << endl;
           store.insert( product );
           _prodImpl = p.prodImpl;
+         _autorefresh = p.volatile_content && media::MediaAccess::canBeVolatile( _url );
         }
         catch (Exception & excpt_r) {
           ERR << "cannot parse content file" << endl;