From a184f6e4fb7e66de096020ba57a2d5af93c3a193 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Tue, 7 Aug 2007 08:42:41 +0000 Subject: [PATCH] test gz metadata download --- tests/repo/susetags/Downloader_test.cc | 55 +++++++++++++++++++++++++++++++++- zypp/repo/susetags/Downloader.cc | 7 +++-- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/tests/repo/susetags/Downloader_test.cc b/tests/repo/susetags/Downloader_test.cc index 5ecea4e..e0377ca 100644 --- a/tests/repo/susetags/Downloader_test.cc +++ b/tests/repo/susetags/Downloader_test.cc @@ -42,7 +42,7 @@ void susetags_download_test(const string &dir) "/suse/setup/descr/packages", "/suse/setup/descr/packages.DU", "/suse/setup/descr/packages.en", - "/suse/setup/descr/packages.es", +// "/suse/setup/descr/packages.es", "/suse/setup/descr/patterns", "/content", "/gpg-pubkey-7e2e3b05-44748aba.asc", @@ -72,6 +72,57 @@ void susetags_download_test(const string &dir) } +void susetags_gz_download_test(const string &dir) +{ + Pathname p = dir + "/stable-x86-subset-gz"; + Url url("dir:" + p.asString()); + MediaSetAccess media(url); + susetags::Downloader downloader("/"); + filesystem::TmpDir tmp; + + Pathname localdir(tmp.path()); + + downloader.download(media,localdir); + + const char* files[] = + { + "/suse", + "/suse/setup", + "/suse/setup/descr", + "/suse/setup/descr/kde-10.3-71.i586.pat.gz", + "/suse/setup/descr/packages.gz", + "/suse/setup/descr/packages.DU.gz", + "/suse/setup/descr/packages.en.gz", +// "/suse/setup/descr/packages.es", + "/suse/setup/descr/patterns.gz", + "/content", + "/gpg-pubkey-7e2e3b05-44748aba.asc", + "/media.1", +// "/media.1/products.asc", +// "/media.1/products.key", + "/media.1/media", +// "/media.1/products", +// "/media.1/info.txt", +// "/media.1/license.zip", + "/gpg-pubkey-a1912208-446a0899.asc", + "/gpg-pubkey-307e3d54-44201d5d.asc", + "/gpg-pubkey-9c800aca-40d8063e.asc", + "/content.asc", + "/content.key", + "/gpg-pubkey-3d25d3d9-36e12d04.asc", + "/gpg-pubkey-0dfb3188-41ed929b.asc", + NULL + }; + + int i=0; + while ( files[i] != NULL ) + { + BOOST_CHECK_MESSAGE( PathInfo(localdir + files[i] ).isExist(), string(files[i]).c_str() ); + i++; + } + +} + test_suite* init_unit_test_suite( int argc, char *argv[] ) { @@ -95,6 +146,8 @@ init_unit_test_suite( int argc, char *argv[] ) std::string const params[] = { datadir }; test->add(BOOST_PARAM_TEST_CASE(&susetags_download_test, (std::string const*)params, params+1)); + test->add(BOOST_PARAM_TEST_CASE(&susetags_gz_download_test, + (std::string const*)params, params+1)); return test; } diff --git a/zypp/repo/susetags/Downloader.cc b/zypp/repo/susetags/Downloader.cc index e1b437b..831c736 100644 --- a/zypp/repo/susetags/Downloader.cc +++ b/zypp/repo/susetags/Downloader.cc @@ -100,13 +100,16 @@ void Downloader::download( MediaSetAccess &media, std::string rest( str::stripPrefix( words[3], "packages" ) ); if ( ! ( rest.empty() || rest == ".DU" - || rest == ".en" ) ) + || rest == ".en" + || rest == ".gz" + || rest == ".DU.gz" + || rest == ".en.gz" ) ) { // Not 100% correct as we take each fallback of textLocale Locale toParse( ZConfig::instance().textLocale() ); while ( toParse != Locale::noCode ) { - if ( rest == ("."+toParse.code()) ) + if ( rest == ("."+toParse.code()) || (rest == ("."+toParse.code()+".gz")) ) break; toParse = toParse.fallback(); } -- 2.7.4