Author: mlandres
Date: Fri Oct 24 18:18:47 2008
New Revision: 11487
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11487&view=rev
Log:
Remove error prone methods from OnMediaLocation API to prevent
accidental missuse. (bnc #437328)
Modified:
trunk/libzypp/VERSION.cmake
trunk/libzypp/package/libzypp.changes
trunk/libzypp/tests/zypp/Fetcher_test.cc
trunk/libzypp/zypp/Fetcher.cc
trunk/libzypp/zypp/OnMediaLocation.h
trunk/libzypp/zypp/repo/yum/Downloader.cc
Modified: trunk/libzypp/VERSION.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=11487&r1=11486&r2=11487&view=diff
==============================================================================
--- trunk/libzypp/VERSION.cmake (original)
+++ trunk/libzypp/VERSION.cmake Fri Oct 24 18:18:47 2008
@@ -59,10 +59,10 @@
# changes file. See './mkChangelog -h' for help.
#
SET(LIBZYPP_MAJOR "5")
-SET(LIBZYPP_COMPATMINOR "17")
-SET(LIBZYPP_MINOR "18")
+SET(LIBZYPP_COMPATMINOR "19")
+SET(LIBZYPP_MINOR "19")
SET(LIBZYPP_PATCH "0")
#
-# LAST RELEASED: 5.18.0 (17)
+# LAST RELEASED: 5.19.0 (19)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=11487&r1=11486&r2=11487&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Fri Oct 24 18:18:47 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Fri Oct 24 18:12:34 CEST 2008 - ma@suse.de
+
+- Remove error prone methods from OnMediaLocation API to prevent
+ accidental missuse. (bnc #437328)
+- revision 11487
+- version 5.19.0 (19)
+
+-------------------------------------------------------------------
Fri Oct 24 16:07:45 CEST 2008 - ma@suse.de
- Provide the /etc/products.d enties filename as Product::referenceFilename.
Modified: trunk/libzypp/tests/zypp/Fetcher_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/Fetcher_test.cc?rev=11487&r1=11486&r2=11487&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/Fetcher_test.cc (original)
+++ trunk/libzypp/tests/zypp/Fetcher_test.cc Fri Oct 24 18:18:47 2008
@@ -33,7 +33,7 @@
{
filesystem::TmpDir dest;
- fetcher.enqueueDir(OnMediaLocation().setFilename("/complexdir"), true);
+ fetcher.enqueueDir(OnMediaLocation("/complexdir"), true);
BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception);
fetcher.reset();
}
@@ -44,14 +44,14 @@
// add the key as trusted
getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir/subdir1/SHA1SUMS.key"), true);
- fetcher.enqueueDir(OnMediaLocation().setFilename("/complexdir"), true);
+ fetcher.enqueueDir(OnMediaLocation("/complexdir"), true);
fetcher.start( dest.path(), media );
BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2").isExist() );
BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir2/subdir2-file1.txt").isExist() );
BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file1.txt").isExist() );
BOOST_CHECK( PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file2.txt").isExist() );
-
+
fetcher.reset();
}
@@ -61,20 +61,20 @@
// add the key as trusted
getZYpp()->keyRing()->importKey(PublicKey(DATADIR + "/complexdir-broken/subdir1/SHA1SUMS.key"), true);
- fetcher.enqueueDir(OnMediaLocation().setFilename("/complexdir-broken"), true);
- BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception);
+ fetcher.enqueueDir(OnMediaLocation("/complexdir-broken"), true);
+ BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception);
fetcher.reset();
}
- {
+ {
filesystem::TmpDir dest;
- fetcher.enqueue(OnMediaLocation().setFilename("/file-1.txt"));
- fetcher.start( dest.path(), media );
+ fetcher.enqueue(OnMediaLocation("/file-1.txt"));
+ fetcher.start( dest.path(), media );
BOOST_CHECK( PathInfo(dest.path() + "/file-1.txt").isExist() );
}
-
+
//MIL << fetcher;
}
@@ -92,13 +92,13 @@
Fetcher fetcher;
filesystem::TmpDir dest;
- fetcher.enqueueDir(OnMediaLocation().setFilename("/complexdir"), true);
+ fetcher.enqueueDir(OnMediaLocation("/complexdir"), true);
fetcher.start( dest.path(), media );
fetcher.reset();
- fetcher.enqueueDir(OnMediaLocation().setFilename("/complexdir-broken"), true);
- BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception);
+ fetcher.enqueueDir(OnMediaLocation("/complexdir-broken"), true);
+ BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception);
fetcher.reset();
Modified: trunk/libzypp/zypp/Fetcher.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Fetcher.cc?rev=11487&r1=11486&r2=11487&view=diff
==============================================================================
--- trunk/libzypp/zypp/Fetcher.cc (original)
+++ trunk/libzypp/zypp/Fetcher.cc Fri Oct 24 18:18:47 2008
@@ -35,7 +35,7 @@
*/
struct FetcherJob
{
-
+
FetcherJob( const OnMediaLocation &loc )
: location(loc)
, directory(false)
@@ -53,7 +53,7 @@
//CompositeFileChecker checkers;
list<FileChecker> checkers;
bool directory;
- bool recursive;
+ bool recursive;
};
typedef shared_ptr<FetcherJob> FetcherJob_Ptr;
@@ -77,7 +77,7 @@
~Impl() {
MIL << endl;
}
-
+
void enqueue( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
void enqueueDir( const OnMediaLocation &resource, bool recursive, const FileChecker &checker = FileChecker() );
void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
@@ -106,7 +106,7 @@
* \throws Exception
*/
void validate( const OnMediaLocation &resource, const Pathname &dest_dir, const list<FileChecker> &checkers );
-
+
/**
* scan the directory and adds the individual jobs
*/
@@ -138,8 +138,8 @@
job->checkers.push_back(checker);
_resources.push_back(job);
}
-
- void Fetcher::Impl::enqueueDir( const OnMediaLocation &resource,
+
+ void Fetcher::Impl::enqueueDir( const OnMediaLocation &resource,
bool recursive,
const FileChecker &checker )
{
@@ -150,7 +150,7 @@
job->directory = true;
job->recursive = recursive;
_resources.push_back(job);
- }
+ }
void Fetcher::Impl::enqueue( const OnMediaLocation &resource, const FileChecker &checker )
{
@@ -186,13 +186,13 @@
{
ERR << "Not adding cache '" << cache_dir << "'. Path does not exists." << endl;
}
-
+
}
bool Fetcher::Impl::provideFromCache( const OnMediaLocation &resource, const Pathname &dest_dir )
{
Pathname dest_full_path = dest_dir + resource.filename();
-
+
// first check in the destination directory
if ( PathInfo(dest_full_path).isExist() )
{
@@ -200,7 +200,7 @@
&& (! resource.checksum().empty() ) )
return true;
}
-
+
MIL << "start fetcher with " << _caches.size() << " cache directories." << endl;
for_ ( it_cache, _caches.begin(), _caches.end() )
{
@@ -240,7 +240,7 @@
} // iterate over caches
return false;
}
-
+
void Fetcher::Impl::validate( const OnMediaLocation &resource, const Pathname &dest_dir, const list<FileChecker> &checkers )
{
// no matter where did we got the file, try to validate it:
@@ -261,7 +261,7 @@
ERR << "Invalid checker for '" << localfile << "'" << endl;
}
}
-
+
}
catch ( const FileCheckException &e )
{
@@ -278,7 +278,7 @@
}
void Fetcher::Impl::addDirJobs( MediaSetAccess &media,
- const OnMediaLocation &resource,
+ const OnMediaLocation &resource,
const Pathname &dest_dir, bool recursive )
{
// first get the content of the directory so we can add
@@ -286,12 +286,12 @@
MIL << "Adding directory " << resource.filename() << endl;
filesystem::DirContent content;
media.dirInfo( content, resource.filename(), false /* dots */, resource.medianr());
-
+
filesystem::DirEntry shafile, shasig, shakey;
shafile.name = "SHA1SUMS"; shafile.type = filesystem::FT_FILE;
shasig.name = "SHA1SUMS.asc"; shasig.type = filesystem::FT_FILE;
shakey.name = "SHA1SUMS.key"; shakey.type = filesystem::FT_FILE;
-
+
// create a new fetcher with a different state to transfer the
// file containing checksums and its signature
Fetcher fetcher;
@@ -300,7 +300,7 @@
SignatureFileChecker sigchecker;
// now try to find the SHA1SUMS signature
- if ( find(content.begin(), content.end(), shasig)
+ if ( find(content.begin(), content.end(), shasig)
!= content.end() )
{
MIL << "found checksums signature file: " << shasig.name << endl;
@@ -317,7 +317,7 @@
MIL << "no signature for " << shafile.name << endl;
// look for the SHA1SUMS.key file
- if ( find(content.begin(), content.end(), shakey)
+ if ( find(content.begin(), content.end(), shakey)
!= content.end() )
{
MIL << "found public key file: " << shakey.name << endl;
@@ -330,19 +330,19 @@
}
// look for the SHA1SUMS public key file
- if ( find(content.begin(), content.end(), shafile)
+ if ( find(content.begin(), content.end(), shafile)
!= content.end() )
{
MIL << "found checksums file: " << shafile.name << endl;
fetcher.enqueue( OnMediaLocation(resource.filename() + shafile.name, resource.medianr()).setOptional(true) );
- assert_dir(dest_dir + resource.filename());
+ assert_dir(dest_dir + resource.filename());
fetcher.start( dest_dir, media );
fetcher.reset();
}
// hash table to store checksums
map