Author: dmacvicar
Date: Wed Nov 26 17:11:57 2008
New Revision: 11807
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11807&view=rev
Log:
bnc #446170 - path and url in add_on_products.xml is evaluated wrong
Modified:
trunk/libzypp/tests/zypp/RepoManager_test.cc
trunk/libzypp/zypp/RepoManager.cc
trunk/libzypp/zypp/repo/susetags/Downloader.cc
Modified: trunk/libzypp/tests/zypp/RepoManager_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/RepoManager_test.cc?rev=11807&r1=11806&r2=11807&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/RepoManager_test.cc (original)
+++ trunk/libzypp/tests/zypp/RepoManager_test.cc Wed Nov 26 17:11:57 2008
@@ -14,6 +14,8 @@
#include "zypp/RepoManager.h"
+#include "TestSetup.h"
+
#include
@@ -29,6 +31,30 @@
#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/RepoManager")
+#define REPODATADIR (Pathname(TESTS_SRC_DIR) + "/repo/susetags/data/addon_in_subdir")
+
+
+BOOST_AUTO_TEST_CASE(refresh_addon_in_subdir)
+{
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
+
+ // disable sgnature checking
+ keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
+ keyring_callbacks.answerAcceptVerFailed(true);
+ keyring_callbacks.answerAcceptUnknownKey(true);
+
+ // make sure we can refresh an addon which is in a subpath in a media url
+ TestSetup test( Arch_x86_64 );
+ RepoInfo info;
+ info.setBaseUrl(Url(string("dir:") + REPODATADIR.asString()));
+ info.setPath("/updates");
+ info.setType(RepoType::YAST2);
+ info.setAlias("boooh");
+
+ test.loadRepo(info);
+}
+
BOOST_AUTO_TEST_CASE(repomanager_test)
{
TmpDir tmpCachePath;
Modified: trunk/libzypp/zypp/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=11807&r1=11806&r2=11807&view=diff
==============================================================================
--- trunk/libzypp/zypp/RepoManager.cc (original)
+++ trunk/libzypp/zypp/RepoManager.cc Wed Nov 26 17:11:57 2008
@@ -271,7 +271,8 @@
////////////////////////////////////////////////////////////////////////////
/**
- * \short Calculates the raw cache path for a repository
+ * \short Calculates the raw cache path for a repository, this is usually
+ * /var/cache/zypp/alias
*/
inline Pathname rawcache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
{
@@ -280,6 +281,21 @@
}
/**
+ * \short Calculates the raw metadata cache path for a repository, this is
+ * inside the raw cache dir, plus the path where the metadata is.
+ *
+ * It should be different only for repositories that are not in the root of
+ * the media.
+ * for example /var/cache/zypp/alias/addondir
+ */
+ inline Pathname rawmetadata_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
+ {
+ assert_alias(info);
+ return opt.repoRawCachePath / info.escaped_alias() / info.path();
+ }
+
+
+ /**
* \short Calculates the packages cache path for a repository
*/
inline Pathname packagescache_path_for_repoinfo( const RepoManagerOptions &opt, const RepoInfo &info )
@@ -484,7 +500,7 @@
++it )
{
// set the metadata path for the repo
- Pathname metadata_path = rawcache_path_for_repoinfo(options, (*it));
+ Pathname metadata_path = rawmetadata_path_for_repoinfo(options, (*it));
(*it).setMetadataPath(metadata_path);
// set the downloaded packages path for the repo
@@ -547,7 +563,7 @@
Pathname RepoManager::metadataPath( const RepoInfo &info ) const
{
- return rawcache_path_for_repoinfo(_pimpl->options, info );
+ return rawmetadata_path_for_repoinfo(_pimpl->options, info );
}
Pathname RepoManager::packagesPath( const RepoInfo &info ) const
@@ -559,7 +575,8 @@
RepoStatus RepoManager::metadataStatus( const RepoInfo &info ) const
{
- Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
+ Pathname rawpath = rawmetadata_path_for_repoinfo( _pimpl->options, info );
+ Pathname mediarootpath = rawcache_path_for_repoinfo( _pimpl->options, info );
RepoType repokind = info.type();
RepoStatus status;
@@ -583,7 +600,7 @@
case RepoType::YAST2_e :
{
- status = RepoStatus( rawpath + "/content") && (RepoStatus( rawpath + "/media.1/media"));
+ status = RepoStatus( rawpath + "/content") && (RepoStatus( mediarootpath + "/media.1/media"));
}
break;
@@ -605,7 +622,7 @@
void RepoManager::touchIndexFile(const RepoInfo & info)
{
- Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
+ Pathname rawpath = rawmetadata_path_for_repoinfo( _pimpl->options, info );
RepoType repokind = info.type();
if ( repokind.toEnum() == RepoType::NONE_e )
@@ -666,7 +683,7 @@
break;
}
- Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
+ Pathname rawpath = rawmetadata_path_for_repoinfo( _pimpl->options, info );
filesystem::assert_dir(rawpath);
oldstatus = metadataStatus(info);
@@ -821,7 +838,7 @@
break;
}
- Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
+ Pathname rawpath = rawmetadata_path_for_repoinfo( _pimpl->options, info );
filesystem::assert_dir(rawpath);
// create temp dir as sibling of rawpath
@@ -848,7 +865,7 @@
*/
for_( it, repoBegin(), repoEnd() )
{
- Pathname cachepath(rawcache_path_for_repoinfo( _pimpl->options, *it ));
+ Pathname cachepath(rawmetadata_path_for_repoinfo( _pimpl->options, *it ));
if ( PathInfo(cachepath).isExist() )
downloader_ptr->addCachePath(cachepath);
}
@@ -927,7 +944,7 @@
const ProgressData::ReceiverFnc & progressrcv )
{
assert_alias(info);
- Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
+ Pathname rawpath = rawmetadata_path_for_repoinfo(_pimpl->options, info);
filesystem::assert_dir(_pimpl->options.repoCachePath);
RepoStatus raw_metadata_status = metadataStatus(info);
Modified: trunk/libzypp/zypp/repo/susetags/Downloader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/susetags/Downloader.cc?rev=11807&r1=11806&r2=11807&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/susetags/Downloader.cc (original)
+++ trunk/libzypp/zypp/repo/susetags/Downloader.cc Wed Nov 26 17:11:57 2008
@@ -35,7 +35,9 @@
RepoStatus Downloader::status( MediaSetAccess &media )
{
Pathname content = media.provideFile( repoInfo().path() + "/content");
- Pathname mediafile = media.provideFile( repoInfo().path() + "/media.1/media" );
+ // the media.1 is always in the root of the media, not like the content
+ // file which is in the path() location
+ Pathname mediafile = media.provideFile( "/media.1/media" );
return RepoStatus(content) && RepoStatus(mediafile);
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org