Author: mlandres
Date: Thu Apr 3 12:10:48 2008
New Revision: 9347
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9347&view=rev
Log:
- Allow to store a media label in MediaSetAccess. This label is
passed to a media change requests to describe which CD is
requested.
Modified:
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/MediaSetAccess.cc
trunk/libzypp/zypp/MediaSetAccess.h
trunk/libzypp/zypp/repo/RepoProvideFile.cc
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=9347&r1=9346&r2=9347&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Thu Apr 3 12:10:48 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Thu Apr 3 11:59:13 CEST 2008 - ma@suse.de
+
+- Allow to store a media label in MediaSetAccess. This label is
+ passed to a media change requests to describe which CD is
+ requested. (bnc #330094)
+- revision 9347
+
+-------------------------------------------------------------------
Wed Apr 2 13:48:52 CEST 2008 - schubi@suse.de
- Moved poolItem.status().isSatisfied(),.... to poolItem.isSatisfied()
Modified: trunk/libzypp/zypp/MediaSetAccess.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/MediaSetAccess.cc?rev=9347&r1=9346&r2=9347&view=diff
==============================================================================
--- trunk/libzypp/zypp/MediaSetAccess.cc (original)
+++ trunk/libzypp/zypp/MediaSetAccess.cc Thu Apr 3 12:10:48 2008
@@ -30,15 +30,17 @@
MediaSetAccess::MediaSetAccess(const Url &url,
const Pathname & prefered_attach_point)
- : _url(url),
- _prefAttachPoint(prefered_attach_point)
- {
- MIL << "initializing.." << std::endl;
- //std::vectormedia::MediaVerifierRef single_media;
- //single_media[0] = media::MediaVerifierRef(new media::NoVerifier());
- //_verifiers = single_media;
- }
+ : _url(url)
+ , _prefAttachPoint(prefered_attach_point)
+ {}
+ MediaSetAccess::MediaSetAccess(const std::string & label_r,
+ const Url &url,
+ const Pathname & prefered_attach_point)
+ : _url(url)
+ , _prefAttachPoint(prefered_attach_point)
+ , _label( label_r )
+ {}
MediaSetAccess::~MediaSetAccess()
{
@@ -141,7 +143,7 @@
{
reason = media::MediaChangeReport::WRONG;
}
- else if( typeid(excp) == typeid( media::MediaTimeoutException))
+ else if( typeid(excp) == typeid( media::MediaTimeoutException))
{
reason = media::MediaChangeReport::IO_SOFT;
}
@@ -156,7 +158,7 @@
user = report->requestMedia (
_url,
media_nr,
- string(), //! \todo label
+ _label,
reason,
excp.asUserString(),
devices, devindex
@@ -282,7 +284,7 @@
user = report->requestMedia (
_url,
media_nr,
- string(), //! \todo label
+ _label,
reason,
excp.asUserString(),
devices,
@@ -425,7 +427,7 @@
user = report->requestMedia(_url,
media_nr,
- string(), //! \todo label
+ _label,
reason,
excp.asUserString(),
devices,
Modified: trunk/libzypp/zypp/MediaSetAccess.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/MediaSetAccess.h?rev=9347&r1=9346&r2=9347&view=diff
==============================================================================
--- trunk/libzypp/zypp/MediaSetAccess.h (original)
+++ trunk/libzypp/zypp/MediaSetAccess.h Thu Apr 3 12:10:48 2008
@@ -42,30 +42,30 @@
* \ref MediaManager for info on different implemented media backends).
* Currently it handles URLs containing cdN, CDN, dvdN, and DVDN strings,
* where N is the number of particular media in the set.
- *
+ *
* Examples:
* \code
* "iso:/?iso=/path/to/iso/images/openSUSE-10.3-Alpha2plus-DVD-x86_64-DVD1.iso"
* "dir:/path/to/cdset/sources/openSUSE-10.3/Alpha2plus/CD1"
* \endcode
- *
+ *
* MediaSetAccess accesses files on desired media by rewriting
* the original URL, replacing the digit (usually) 1 with requested media
* number and uses \ref MediaManager to get the files from the new URL.
- *
+ *
* Additionaly, each media number can be assined a media verifier which
* checks if the media we are trying to access is the desired one. See
* \ref MediaVerifierBase for more info.
- *
+ *
* Code example:
* \code
* Url url("dir:/path/to/cdset/sources/openSUSE-10.3/Alpha2plus/CD1");
- *
+ *
* MediaSetAccess access(url);
- *
+ *
* access.setVerifier(1, media1VerifierRef);
* access.setVerifier(2, media2VerifierRef);
- *
+ *
* Pathname file1 = "/some/file/on/media1";
* access.provideFile(1, file1);
* Pathname file2 = "/some/file/on/media2";
@@ -81,11 +81,13 @@
/**
* Creates a callback enabled media access for specified \a url.
*
- * \param url
+ * \param url
* \param prefered_attach_point Prefered attach (mount) point. Use, if
* you want to mount the media to a specific directory.
*/
- MediaSetAccess(const Url &url, const Pathname & prefered_attach_point = "");
+ MediaSetAccess( const Url &url, const Pathname & prefered_attach_point = "" );
+ /** \overload Also taking a \ref label. */
+ MediaSetAccess( const std::string & label_r, const Url &url, const Pathname & prefered_attach_point = "" );
~MediaSetAccess();
/**
@@ -94,11 +96,23 @@
void setVerifier( unsigned media_nr, media::MediaVerifierRef verifier );
/**
+ * The label identifing this media set and to be sent in a media change request.
+ */
+ const std::string & label() const
+ { return _label; }
+
+ /**
+ * Set the label identifing this media set and to be sent in a media change request.
+ */
+ void setLabel( const std::string & label_r )
+ { _label = label_r; }
+
+ /**
* Provides a file from a media location.
- *
+ *
* \param on_media_file location of the file on media
* \return local pathname of the requested file
- *
+ *
* \throws MediaException if a problem occurs,
* see \ref media::MediaManager::provideFile()
*/
@@ -106,19 +120,19 @@
/**
* Provides \a file from media \a media_nr.
- *
+ *
* \param file path to the file relative to media URL
* \param media_nr the media number in the media set
* \return local pathname of the requested file
- *
+ *
* \throws MediaException if a problem occurs,
* see \ref media::MediaManager::provideFile()
*/
Pathname provideFile(const Pathname & file, unsigned media_nr = 1 );
-
+
/**
* Provides direcotry \a dir from media number \a media_nr.
- *
+ *
* \param dir path to the directory relative to media URL
* \param recursive whether to provide the whole directory subtree
* \param media_nr the media number in the media set
@@ -126,7 +140,7 @@
*
* \throws MediaException if a problem occurs,
* see \ref media::MediaManager::provideDir()
- * and \ref media::MediaManager::provideDirTree()
+ * and \ref media::MediaManager::provideDirTree()
*/
Pathname provideDir(const Pathname & dir, bool recursive, unsigned media_nr = 1);
@@ -147,7 +161,7 @@
/**
* Replaces media number in specified url with given \a medianr.
- *
+ *
* Media number in the URL is searched for with regex
* <tt> "^(.*(cd|dvd))([0-9]+)(\\.iso)$" </tt> for iso scheme and
* with <tt> "^(.*(cd|dvd))([0-9]+)(/?)$" </tt> for other schemes.
@@ -178,6 +192,8 @@
*/
Pathname _prefAttachPoint;
+ std::string _label;
+
typedef std::map