Merge branch 'master' of gitorious.org:opensuse/libzypp
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 6 Dec 2010 10:08:47 +0000 (11:08 +0100)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 6 Dec 2010 10:08:47 +0000 (11:08 +0100)
24 files changed:
VERSION.cmake
doc/autodoc/CMakeLists.txt
doc/autodoc/Doxyfile.cmake
doc/autoinclude/Testcases.doc
libzypp.spec.cmake
package/libzypp.changes
tests/repo/RepoVariables_test.cc
tests/zypp/RepoManager_test.cc
tools/package-manager/CMakeLists.txt
tools/package-manager/package-manager-icon.16x16.png [deleted file]
tools/package-manager/package-manager-icon.22x22.png [deleted file]
tools/package-manager/package-manager-icon.24x24.png [deleted file]
tools/package-manager/package-manager-icon.32x32.png [deleted file]
tools/package-manager/package-manager-icon.48x48.png [deleted file]
tools/package-manager/package-manager-icon.svg [deleted file]
tools/package-manager/package-manager.desktop
zypp/RepoInfo.cc
zypp/RepoManager.cc
zypp/media/MediaCurl.cc
zypp/repo/RepoMirrorList.cc
zypp/repo/RepoMirrorList.h
zypp/repo/RepoVariables.cc
zypp/repo/RepoVariables.h
zypp/repo/ServiceRepos.cc

index 66056b2..9989da5 100644 (file)
 #   changes file. See './mkChangelog -h' for help.
 #
 SET(LIBZYPP_MAJOR "8")
-SET(LIBZYPP_COMPATMINOR "7")
-SET(LIBZYPP_MINOR "8")
+SET(LIBZYPP_COMPATMINOR "10")
+SET(LIBZYPP_MINOR "10")
 SET(LIBZYPP_PATCH "0")
 #
-# LAST RELEASED: 8.8.0 (7)
+# LAST RELEASED: 8.10.0 (10)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index 668f760..696df97 100644 (file)
@@ -9,6 +9,7 @@ ELSE ( NOT DOT )
 ENDIF ( NOT DOT )
 
 SET( ZYPP_SOURCE_DIR     ${LIBZYPP_SOURCE_DIR}/zypp )
+SET( ZYPP_TESTUTILS_DIR     ${LIBZYPP_SOURCE_DIR}/test/lib )
 SET( ZYPP_DOCINCLUDE_DIR ${LIBZYPP_SOURCE_DIR}/doc/autoinclude )
 SET( ZYPP_EXAMPLE_DIR    ${LIBZYPP_SOURCE_DIR}/examples )
 
index 6c44ead..84e73d4 100644 (file)
@@ -70,7 +70,7 @@ WARN_LOGFILE           =
 #---------------------------------------------------------------------------
 # configuration options related to the input files
 #---------------------------------------------------------------------------
-INPUT                  = @ZYPP_DOCINCLUDE_DIR@ @ZYPP_SOURCE_DIR@
+INPUT                  = @ZYPP_DOCINCLUDE_DIR@ @ZYPP_SOURCE_DIR@ @ZYPP_TESTUTILS_DIR@
 FILE_PATTERNS          = *.h *.hh *.hxx *.hpp *.h++ *.c *.cc *.cxx *.cpp *.c++ *.tcc *.hcc *.doc
 RECURSIVE              = YES
 EXCLUDE                =
index 29d5e7f..da545d0 100644 (file)
@@ -1,4 +1,71 @@
-/** \page Testcases Writing Testcases
+/** \page Testcases Writing and tunning testcases
+
+\section Introduction
+
+ZYpp has a suite of tests located in under test/ directory of the source tree.
+
+Right now, tests are grouped into
+
+- media : tests related to downloading and the http/ftp/nfs/iso abstraction layer
+- parser : tests related to classes that offer file format parsing
+- repo : tests related to repository handling
+- sat : tests related to the sat-solver integration
+- zypp : tests related to the main libzypp classes and APIs
+
+Tests are written using boost test library.
+
+- <a href="http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/index.html">Boost Test Library</a>
+- <a href="http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/utf.html">The Unit Test Framework</a>
+- <a href="http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/utf/testing-tools/reference.html">The UTF testing tools reference</a>
+
+\section Anatomy of a ZYpp testcase
+
+The file should be in one of the described groups, and by general rule it is named ClassName_test.cc where ClassName is the name of the class or module the test covers.
+
+Data and fixtures are stored in data/ directories in each test group. However groups may use and reference data from other test groups. The macro \ref TESTS_SRC_DIR is defined as the tests/ directory located in libzypp source directory. You can build the paths to the data/fixtures using that macro.
+
+A simple testcase:
+
+\code
+#include "zypp/Date.h"
+#include <boost/test/auto_unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(date_test)
+{
+  std::string format = "%Y-%m-%d %H:%M:%S";
+  std::string date = "2009-02-14 00:31:30";
+  BOOST_CHECK_EQUAL(zypp::Date(date,format).form(format), date);
+}
+\endcode
+
+\section Building and running the testsuite
+
+- Build the testsuite
+
+\verbatim
+$ cd build
+$ cmake -DCMAKE_INSTALL_PREFIX=/prefix ..
+$ cd tests
+$ make
+\endverbatim
+
+- Run a simple test
+
+\verbatim
+$ zypp/Date_test
+Running 1 test case...
+
+*** No errors detected
+\endverbatim
+
+- Run all tests
+
+\verbatim
+$ ctest .
+\endverbatim
+
+\section
+
 
 \verbatim
   - added tests/data/openSUSE-11.1 containing raw susetags metadata.
 \endverbatim
 
 \verbatim
-  - Added support for loading helix files e.g. from testcases. This is what 
+  - Added support for loading helix files e.g. from testcases. This is what
     you need to load all repos from a solver testcase into the pool:
 
        #include "TestSetup.h"
-       
+
        BOOST_AUTO_TEST_CASE(test)
-        { 
+        {
                TestSetup test( Arch_x86_64 );
                test.loadTestcaseRepos( "/suse/ma/BUGS/153548/YaST2/solverTestcase" );
 
 \endverbatim
 
-\verbatim
-Boost Test Library
-http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/index.html
-
-  The Unit Test Framework
-  http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/utf.html
+\section References
 
-  The UTF testing tools reference
-  http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/utf/testing-tools/reference.html
-\endverbatim
 */
index 565cb88..b424db4 100644 (file)
@@ -296,12 +296,6 @@ rm -rf "$RPM_BUILD_ROOT"
 %{_prefix}/lib/zypp
 %{_datadir}/zypp
 %{_datadir}/applications/package-manager.desktop
-%{_datadir}/icons/hicolor/scalable/apps/package-manager-icon.svg
-%{_datadir}/icons/hicolor/16x16/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/22x22/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/24x24/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/32x32/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/48x48/apps/package-manager-icon.png
 %{_bindir}/*
 %{_libdir}/libzypp*so.*
 %doc %{_mandir}/man5/locks.5.*
index 47a7d06..2ec6c01 100644 (file)
@@ -1,4 +1,29 @@
 -------------------------------------------------------------------
+Wed Dec  1 17:39:16 CET 2010 - dheidler@suse.de
+
+- Added ReplacerVar caching in RepoInfo
+- Automaticly remove empty mirrorlist-files
+- version 8.10.0 (10)
+
+-------------------------------------------------------------------
+Tue Nov 30 17:11:32 CET 2010 - dheidler@suse.de
+
+- Added MirrorList caching
+- version 8.9.0 (7)
+
+-------------------------------------------------------------------
+Mon Nov 29 12:31:37 CET 2010 - ma@suse.de
+
+- Icons for libzypp should go into desktop-data. (bnc#329635)
+- version 8.8.2 (7)
+
+-------------------------------------------------------------------
+Wed Nov 24 11:55:59 CET 2010 - ma@suse.de
+
+- Properly handle FTP response 550. (bnc#645747)
+- version 8.8.1 (7)
+
+-------------------------------------------------------------------
 Fri Nov 19 11:24:39 CET 2010 - mls@suse.de
 
 - fix access of freed memory in MultiCurl (bnc#654600)
index b906183..18fd302 100644 (file)
@@ -30,6 +30,8 @@ BOOST_AUTO_TEST_CASE(replace_text)
   BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar"),
                     "http://foo/"+ ZConfig::instance().systemArchitecture().asString() + "/bar");
 
+  replacer1.resetVarCache();
+
   ZConfig::instance().setSystemArchitecture(Arch("i686"));
   BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar/$basearch"),
                     "http://foo/i686/bar/i386");
@@ -63,6 +65,7 @@ BOOST_AUTO_TEST_CASE(replace_text)
   // make it the base product
   BOOST_CHECK( symlink(tmp.path() / "/etc/products.d/product.prod", tmp.path() / "/etc/products.d/baseproduct" ) == 0 );
 
+  replacer2.resetVarCache();
 
   z->initializeTarget( tmp.path() );
   // target activated, there should be replacement of
index 72f28c7..ef225ea 100644 (file)
@@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(pluginservices_test)
     //  insert_iterator<std::list<RepoInfo> >(infos,infos.begin()));
     //BOOST_CHECK_EQUAL(infos.size(), 2); // 2 from new repoindex
   }
-  
+
   // Now simulate the service changed
   opts.pluginsPath = DATADIR + "/plugin-service-lib-2";
   {
@@ -141,6 +141,7 @@ BOOST_AUTO_TEST_CASE(repomanager_test)
 {
   TmpDir tmpCachePath;
   RepoManagerOptions opts( RepoManagerOptions::makeTestSetup( tmpCachePath ) ) ;
+  opts.servicesTargetDistro = "sles-10-i586"; // usually determined by the Target
 
   filesystem::mkdir( opts.knownReposPath );
   filesystem::mkdir( opts.knownServicesPath );
@@ -262,7 +263,6 @@ BOOST_AUTO_TEST_CASE(repomanager_test)
 
   BOOST_CHECK_MESSAGE( !manager.isCached(repo),
                        "Repo cache was just deleted, should not be cached now" );
-
   // now cache should build normally
   manager.buildCache(repo);
 
@@ -275,6 +275,12 @@ BOOST_AUTO_TEST_CASE(repomanager_test)
   }
   MIL << "Parsing repository metadata..." << endl;
   manager.buildCache(repo);
+
+
+  // now test that loading twice a repo updates
+  // it instead of duplicating the solv file
+
+
 }
 
 BOOST_AUTO_TEST_CASE(repo_seting_test)
index ba0c188..1a340c7 100644 (file)
@@ -3,12 +3,3 @@
 
 INSTALL(PROGRAMS package-manager package-manager-su DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
 INSTALL( FILES package-manager.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications" )
-# for D in 16 32 48; do
-#   rsvg -w $D -h $D package-manager-icon.svg package-manager-icon.${D}x${D}.png;
-# done
-INSTALL( FILES  package-manager-icon.svg       DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps" )
-INSTALL( FILES  package-manager-icon.16x16.png DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/16x16/apps" RENAME package-manager-icon.png )
-INSTALL( FILES  package-manager-icon.22x22.png DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/22x22/apps" RENAME package-manager-icon.png )
-INSTALL( FILES  package-manager-icon.24x24.png DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/24x24/apps" RENAME package-manager-icon.png )
-INSTALL( FILES  package-manager-icon.32x32.png DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/32x32/apps" RENAME package-manager-icon.png )
-INSTALL( FILES  package-manager-icon.48x48.png DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps" RENAME package-manager-icon.png )
diff --git a/tools/package-manager/package-manager-icon.16x16.png b/tools/package-manager/package-manager-icon.16x16.png
deleted file mode 100644 (file)
index 51dfce8..0000000
Binary files a/tools/package-manager/package-manager-icon.16x16.png and /dev/null differ
diff --git a/tools/package-manager/package-manager-icon.22x22.png b/tools/package-manager/package-manager-icon.22x22.png
deleted file mode 100644 (file)
index b7a28c5..0000000
Binary files a/tools/package-manager/package-manager-icon.22x22.png and /dev/null differ
diff --git a/tools/package-manager/package-manager-icon.24x24.png b/tools/package-manager/package-manager-icon.24x24.png
deleted file mode 100644 (file)
index b1ecd67..0000000
Binary files a/tools/package-manager/package-manager-icon.24x24.png and /dev/null differ
diff --git a/tools/package-manager/package-manager-icon.32x32.png b/tools/package-manager/package-manager-icon.32x32.png
deleted file mode 100644 (file)
index 479261c..0000000
Binary files a/tools/package-manager/package-manager-icon.32x32.png and /dev/null differ
diff --git a/tools/package-manager/package-manager-icon.48x48.png b/tools/package-manager/package-manager-icon.48x48.png
deleted file mode 100644 (file)
index ef723d6..0000000
Binary files a/tools/package-manager/package-manager-icon.48x48.png and /dev/null differ
diff --git a/tools/package-manager/package-manager-icon.svg b/tools/package-manager/package-manager-icon.svg
deleted file mode 100644 (file)
index 96903b8..0000000
+++ /dev/null
@@ -1,495 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="48.000000px"
-   height="48.000000px"
-   id="svg14603"
-   sodipodi:version="0.32"
-   inkscape:version="0.43+devel"
-   sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/apps"
-   sodipodi:docname="system-installer.svg">
-  <defs
-     id="defs3">
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient5060"
-       id="radialGradient5031"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
-       cx="605.71429"
-       cy="486.64789"
-       fx="605.71429"
-       fy="486.64789"
-       r="117.14286" />
-    <linearGradient
-       inkscape:collect="always"
-       id="linearGradient5060">
-      <stop
-         style="stop-color:black;stop-opacity:1;"
-         offset="0"
-         id="stop5062" />
-      <stop
-         style="stop-color:black;stop-opacity:0;"
-         offset="1"
-         id="stop5064" />
-    </linearGradient>
-    <radialGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient5060"
-       id="radialGradient5029"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
-       cx="605.71429"
-       cy="486.64789"
-       fx="605.71429"
-       fy="486.64789"
-       r="117.14286" />
-    <linearGradient
-       id="linearGradient5048">
-      <stop
-         style="stop-color:black;stop-opacity:0;"
-         offset="0"
-         id="stop5050" />
-      <stop
-         id="stop5056"
-         offset="0.5"
-         style="stop-color:black;stop-opacity:1;" />
-      <stop
-         style="stop-color:black;stop-opacity:0;"
-         offset="1"
-         id="stop5052" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient5048"
-       id="linearGradient5027"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
-       x1="302.85715"
-       y1="366.64789"
-       x2="302.85715"
-       y2="609.50507" />
-    <linearGradient
-       id="linearGradient7844"
-       inkscape:collect="always">
-      <stop
-         id="stop7846"
-         offset="0"
-         style="stop-color:#000000;stop-opacity:1;" />
-      <stop
-         id="stop7848"
-         offset="1"
-         style="stop-color:#000000;stop-opacity:0;" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient7834"
-       inkscape:collect="always">
-      <stop
-         id="stop7836"
-         offset="0"
-         style="stop-color:#ffffff;stop-opacity:1;" />
-      <stop
-         id="stop7838"
-         offset="1"
-         style="stop-color:#ffffff;stop-opacity:0;" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient7670">
-      <stop
-         id="stop7672"
-         offset="0"
-         style="stop-color:#dfdfdf;stop-opacity:1;" />
-      <stop
-         id="stop7674"
-         offset="1.0000000"
-         style="stop-color:#c0c0c0;stop-opacity:1.0000000;" />
-    </linearGradient>
-    <linearGradient
-       gradientTransform="matrix(1.008511,0.000000,0.000000,1.000000,-47.59576,-0.285714)"
-       gradientUnits="userSpaceOnUse"
-       y2="40.857143"
-       x2="72.857140"
-       y1="9.7142859"
-       x1="64.571426"
-       id="linearGradient7676"
-       xlink:href="#linearGradient7670"
-       inkscape:collect="always" />
-    <linearGradient
-       gradientTransform="translate(-2.000000,0.000000)"
-       gradientUnits="userSpaceOnUse"
-       y2="0.50379461"
-       x2="19.323767"
-       y1="11.312428"
-       x1="19.362535"
-       id="linearGradient7840"
-       xlink:href="#linearGradient7834"
-       inkscape:collect="always" />
-    <radialGradient
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(1.000000,0.000000,0.000000,0.333333,1.298874e-16,25.06362)"
-       r="22.728432"
-       fy="37.595428"
-       fx="24.546707"
-       cy="37.595428"
-       cx="24.546707"
-       id="radialGradient7850"
-       xlink:href="#linearGradient7844"
-       inkscape:collect="always" />
-    <linearGradient
-       id="aigrd1"
-       gradientUnits="userSpaceOnUse"
-       x1="14.9966"
-       y1="11.1885"
-       x2="32.511"
-       y2="34.3075">
-      <stop
-         offset="0"
-         style="stop-color:#EBEBEB"
-         id="stop3034" />
-      <stop
-         offset="0.5"
-         style="stop-color:#FFFFFF"
-         id="stop3036" />
-      <stop
-         offset="1"
-         style="stop-color:#EBEBEB"
-         id="stop3038" />
-    </linearGradient>
-    <linearGradient
-       id="aigrd2"
-       gradientUnits="userSpaceOnUse"
-       x1="12.2744"
-       y1="32.4165"
-       x2="35.3912"
-       y2="14.2033">
-      <stop
-         offset="0"
-         style="stop-color:#FBFBFB"
-         id="stop3043" />
-      <stop
-         offset="0.5"
-         style="stop-color:#B6B6B6"
-         id="stop3045" />
-      <stop
-         offset="1"
-         style="stop-color:#E4E4E4"
-         id="stop3047" />
-    </linearGradient>
-    <linearGradient
-       id="linearGradient4236">
-      <stop
-         style="stop-color:#ffffff;stop-opacity:0.32673267;"
-         offset="0.0000000"
-         id="stop4238" />
-      <stop
-         style="stop-color:#ffffff;stop-opacity:0.60396039;"
-         offset="1.0000000"
-         id="stop4240" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       id="linearGradient6028">
-      <stop
-         style="stop-color:#ffffff;stop-opacity:1;"
-         offset="0"
-         id="stop6030" />
-      <stop
-         style="stop-color:#ffffff;stop-opacity:0;"
-         offset="1"
-         id="stop6032" />
-    </linearGradient>
-    <linearGradient
-       inkscape:collect="always"
-       id="linearGradient6036">
-      <stop
-         style="stop-color:#ffffff;stop-opacity:1;"
-         offset="0"
-         id="stop6038" />
-      <stop
-         style="stop-color:#ffffff;stop-opacity:0;"
-         offset="1"
-         id="stop6040" />
-    </linearGradient>
-    <linearGradient
-       y2="14.2033"
-       x2="35.3912"
-       y1="32.4165"
-       x1="12.2744"
-       gradientUnits="userSpaceOnUse"
-       id="linearGradient3394">
-      <stop
-         id="stop3396"
-         style="stop-color:#fff307;stop-opacity:1.0000000;"
-         offset="0.0000000" />
-      <stop
-         id="stop3398"
-         style="stop-color:#166eff;stop-opacity:1.0000000;"
-         offset="0.50000000" />
-      <stop
-         id="stop3400"
-         style="stop-color:#ffffff;stop-opacity:0.0000000;"
-         offset="1.0000000" />
-    </linearGradient>
-    <radialGradient
-       r="22.728432"
-       fy="37.595428"
-       fx="24.546707"
-       cy="37.595428"
-       cx="24.546707"
-       gradientTransform="matrix(1.000000,0.000000,0.000000,0.333333,1.121564e-14,25.06362)"
-       gradientUnits="userSpaceOnUse"
-       id="radialGradient10566"
-       xlink:href="#linearGradient7844"
-       inkscape:collect="always" />
-    <linearGradient
-       y2="34.3075"
-       x2="32.511"
-       y1="11.1885"
-       x1="14.9966"
-       gradientTransform="matrix(0.683145,0.000000,0.000000,0.683145,18.55581,18.12886)"
-       gradientUnits="userSpaceOnUse"
-       id="linearGradient10568"
-       xlink:href="#aigrd1"
-       inkscape:collect="always" />
-    <linearGradient
-       y2="14.2033"
-       x2="35.3912"
-       y1="32.4165"
-       x1="12.2744"
-       gradientTransform="matrix(0.705308,0.000000,0.000000,0.705308,18.02392,17.61692)"
-       gradientUnits="userSpaceOnUse"
-       id="linearGradient10570"
-       xlink:href="#aigrd2"
-       inkscape:collect="always" />
-    <linearGradient
-       y2="28.000000"
-       x2="29.000000"
-       y1="14.625000"
-       x1="21.125000"
-       gradientTransform="matrix(0.717302,0.000000,0.000000,0.717302,17.73603,18.06909)"
-       gradientUnits="userSpaceOnUse"
-       id="linearGradient10572"
-       xlink:href="#linearGradient4236"
-       inkscape:collect="always" />
-    <linearGradient
-       y2="28.000000"
-       x2="29.000000"
-       y1="14.625000"
-       x1="21.125000"
-       gradientTransform="matrix(0.717302,0.000000,0.000000,0.717302,17.73603,18.06909)"
-       gradientUnits="userSpaceOnUse"
-       id="linearGradient10574"
-       xlink:href="#linearGradient4236"
-       inkscape:collect="always" />
-    <linearGradient
-       y2="54.698483"
-       x2="48.798885"
-       y1="3.6100161"
-       x1="10.501720"
-       gradientTransform="matrix(0.573842,0.000000,0.000000,0.573842,20.97995,19.56347)"
-       gradientUnits="userSpaceOnUse"
-       id="linearGradient10576"
-       xlink:href="#linearGradient6036"
-       inkscape:collect="always" />
-    <linearGradient
-       y2="18.366575"
-       x2="17.742729"
-       y1="31.494707"
-       x1="28.702885"
-       gradientUnits="userSpaceOnUse"
-       id="linearGradient10578"
-       xlink:href="#linearGradient6028"
-       inkscape:collect="always" />
-    <radialGradient
-       r="21.333334"
-       fy="27.569166"
-       fx="37.751469"
-       cy="27.569166"
-       cx="37.751469"
-       gradientTransform="matrix(0.441746,0.498655,-0.407098,0.360624,32.00755,10.21308)"
-       gradientUnits="userSpaceOnUse"
-       id="radialGradient10580"
-       xlink:href="#linearGradient3394"
-       inkscape:collect="always" />
-  </defs>
-  <sodipodi:namedview
-     fill="#a40000"
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="0.26666667"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="1"
-     inkscape:cx="34.663875"
-     inkscape:cy="17.441956"
-     inkscape:current-layer="layer1"
-     showgrid="false"
-     inkscape:grid-bbox="true"
-     inkscape:document-units="px"
-     inkscape:showpageshadow="false"
-     inkscape:window-width="872"
-     inkscape:window-height="684"
-     inkscape:window-x="213"
-     inkscape:window-y="252" />
-  <metadata
-     id="metadata4">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title>System - Installer</dc:title>
-        <dc:creator>
-          <cc:Agent>
-            <dc:title>jakub Steiner</dc:title>
-          </cc:Agent>
-        </dc:creator>
-        <dc:source>http://jimmac.musichall.cz</dc:source>
-        <cc:license
-           rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
-      </cc:Work>
-      <cc:License
-         rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
-        <cc:permits
-           rdf:resource="http://web.resource.org/cc/Reproduction" />
-        <cc:permits
-           rdf:resource="http://web.resource.org/cc/Distribution" />
-        <cc:requires
-           rdf:resource="http://web.resource.org/cc/Notice" />
-        <cc:requires
-           rdf:resource="http://web.resource.org/cc/Attribution" />
-        <cc:permits
-           rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
-        <cc:requires
-           rdf:resource="http://web.resource.org/cc/ShareAlike" />
-      </cc:License>
-    </rdf:RDF>
-  </metadata>
-  <g
-     id="layer1"
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer">
-    <path
-       sodipodi:nodetypes="ccccc"
-       id="path7822"
-       d="M 7.0663522,9.8326324 L 11.142857,5.5714286 L 34.714286,5.5714286 L 39.034663,9.9336477 L 7.0663522,9.8326324 z "
-       style="opacity:1.0000000;color:#000000;fill:#6b6c69;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#606060;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
-    <g
-       id="g5022"
-       transform="matrix(2.01828e-2,0,0,2.086758e-2,41.09416,37.29644)">
-      <rect
-         y="-150.69685"
-         x="-1559.2523"
-         height="478.35718"
-         width="1339.6335"
-         id="rect4173"
-         style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
-      <path
-         sodipodi:nodetypes="cccc"
-         id="path5058"
-         d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
-         style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
-      <path
-         style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
-         d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
-         id="path5018"
-         sodipodi:nodetypes="cccc" />
-    </g>
-    <rect
-       ry="1.4285715"
-       rx="1.4285721"
-       y="9.4285717"
-       x="6.5756874"
-       height="31.142857"
-       width="32.848644"
-       id="rect6910"
-       style="opacity:1.0000000;color:#000000;fill:url(#linearGradient7676);fill-opacity:1.0000000;fill-rule:evenodd;stroke:#606060;stroke-width:1.0000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
-    <path
-       sodipodi:nodetypes="cccccc"
-       id="rect7826"
-       d="M 38.857143,22.756128 L 38.857143,39.184701 C 38.857143,39.659558 38.494011,40.041844 38.042945,40.041844 L 15.874474,40.041844 L 15.923863,22.756128 C 15.923863,22.756128 38.857143,22.756128 38.857143,22.756128 z "
-       style="color:#000000;fill:#a40000;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:1.0000000 1.0000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
-    <path
-       sodipodi:nodetypes="cc"
-       id="path7824"
-       d="M 15.379549,11.285714 L 15.379549,39.285714"
-       style="opacity:1.0000000;color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#606060;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:1.0000000 1.0000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
-    <path
-       style="color:#000000;fill:#f0f0f0;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:1.0000000 1.0000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
-       d="M 38.857143,22.613273 L 38.857143,11.470414 C 38.857143,10.995557 38.494011,10.613271 38.042945,10.613271 L 15.874474,10.613271 L 15.923863,22.613273 C 15.923863,22.613273 38.857143,22.613273 38.857143,22.613273 z "
-       id="path10582"
-       sodipodi:nodetypes="cccccc" />
-    <path
-       sodipodi:nodetypes="ccccccccs"
-       id="rect7829"
-       d="M 11.512932,6.5274685 C 11.512932,6.5274685 34.285047,6.5274685 34.285047,6.5274685 C 34.285047,6.5274685 38.542046,10.784467 38.542046,10.784467 L 38.542046,39.215524 C 38.542046,39.503290 38.310378,39.734958 38.022612,39.734958 L 7.9773979,39.734958 C 7.6896315,39.734958 7.4579639,39.503290 7.4579639,39.215524 L 7.4579639,10.784467 C 7.4579639,10.784467 11.512932,6.5274685 11.512932,6.5274685 z "
-       style="opacity:0.62566847;color:#000000;fill:none;fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient7840);stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
-    <g
-       transform="translate(-0.999997,-0.285714)"
-       id="g10554">
-      <path
-         transform="matrix(0.550240,0.000000,0.000000,0.550240,19.89726,20.62321)"
-         d="M 47.275139 37.595428 A 22.728432 7.5761442 0 1 1  1.8182755,37.595428 A 22.728432 7.5761442 0 1 1  47.275139 37.595428 z"
-         sodipodi:ry="7.5761442"
-         sodipodi:rx="22.728432"
-         sodipodi:cy="37.595428"
-         sodipodi:cx="24.546707"
-         id="path10170"
-         style="opacity:0.62566847;color:#000000;fill:url(#radialGradient10566);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dasharray:1.0000000 1.0000000 ;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
-         sodipodi:type="arc" />
-      <g
-         id="g10156"
-         transform="translate(-1.642857,-2.642857)">
-        <path
-           style="fill:url(#linearGradient10568);fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000"
-           d="M 34.951289,21.954475 C 28.324780,21.954475 22.996247,27.283008 22.996247,33.909517 C 22.996247,40.536026 28.324780,45.864559 34.951289,45.864559 C 41.577799,45.864559 46.906332,40.536026 46.906332,33.909517 C 46.906332,27.283008 41.577799,21.954475 34.951289,21.954475 L 34.951289,21.954475 z M 34.951289,36.778727 C 33.380055,36.778727 32.082079,35.480751 32.082079,33.909517 C 32.082079,32.338283 33.380055,31.040307 34.951289,31.040307 C 36.522523,31.040307 37.820499,32.338283 37.820499,33.909517 C 37.820499,35.480751 36.522523,36.778727 34.951289,36.778727 z "
-           id="path3040" />
-        <path
-           style="fill:url(#linearGradient10570);fill-rule:nonzero;stroke:#808080;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
-           d="M 34.951305,21.566644 C 28.109819,21.566644 22.608417,27.068045 22.608417,33.909532 C 22.608417,40.751018 28.109819,46.252419 34.951305,46.252419 C 41.792792,46.252419 47.294193,40.751018 47.294193,33.909532 C 47.294193,27.068045 41.792792,21.566644 34.951305,21.566644 L 34.951305,21.566644 z M 34.951305,36.871824 C 33.329097,36.871824 31.989012,35.531740 31.989012,33.909532 C 31.989012,32.287324 33.329097,30.947239 34.951305,30.947239 C 36.573513,30.947239 37.913598,32.287324 37.913598,33.909532 C 37.913598,35.531740 36.573513,36.871824 34.951305,36.871824 z "
-           id="path3049" />
-        <path
-           style="opacity:0.10999996;fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000"
-           d="M 34.951289,28.111323 C 31.713337,28.111323 29.153095,30.746866 29.153095,33.909517 C 29.153095,37.147471 31.788638,39.707712 34.951289,39.707712 C 38.189242,39.707712 40.749484,37.072169 40.749484,33.909517 C 40.749484,30.671564 38.113940,28.111323 34.951289,28.111323 L 34.951289,28.111323 z M 34.951289,37.072169 C 33.219361,37.072169 31.788638,35.641446 31.788638,33.909517 C 31.788638,32.177589 33.219361,30.746866 34.951289,30.746866 C 36.683217,30.746866 38.113940,32.177589 38.113940,33.909517 C 38.113940,35.641446 36.683217,37.072169 34.951289,37.072169 z "
-           id="path3051" />
-        <path
-           id="path3916"
-           d="M 38.150519,22.816711 L 36.086643,30.847436 C 36.732045,31.019312 37.248181,31.418679 37.598790,31.971330 L 44.709966,27.639233 C 43.255134,25.269429 40.920193,23.525895 38.150519,22.816711 z "
-           style="fill:url(#linearGradient10572);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
-        <path
-           style="fill:url(#linearGradient10574);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
-           d="M 30.911911,44.678269 L 33.629199,36.844465 C 33.000117,36.620097 32.518571,36.179639 32.214597,35.600027 L 24.771257,39.332667 C 26.026282,41.814082 28.209936,43.743724 30.911911,44.678269 z "
-           id="path4214" />
-        <path
-           sodipodi:nodetypes="cccccc"
-           id="path5264"
-           d="M 34.951287,22.548803 C 28.654207,22.548803 23.590575,27.612435 23.590575,33.909515 C 23.590575,40.206596 28.654207,45.270227 34.951287,45.270227 C 41.248368,45.270227 46.311999,40.206596 46.311999,33.909515 C 46.311999,27.612435 41.248368,22.548803 34.951287,22.548803 L 34.951287,22.548803 z "
-           style="opacity:0.54644811;fill:none;fill-rule:nonzero;stroke:url(#linearGradient10576);stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
-        <path
-           transform="matrix(0.573842,0.000000,0.000000,0.573842,21.03068,19.61419)"
-           d="M 30.405591 24.930641 A 6.0987959 6.0987959 0 1 1  18.207999,24.930641 A 6.0987959 6.0987959 0 1 1  30.405591 24.930641 z"
-           sodipodi:ry="6.0987959"
-           sodipodi:rx="6.0987959"
-           sodipodi:cy="24.930641"
-           sodipodi:cx="24.306795"
-           id="path6026"
-           style="opacity:0.67213112;color:#000000;fill:none;fill-opacity:0.31638417;fill-rule:nonzero;stroke:url(#linearGradient10578);stroke-width:1.6215941;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
-           sodipodi:type="arc" />
-        <path
-           id="path3390"
-           d="M 34.951289,23.065643 C 28.940684,23.065643 24.107415,27.898912 24.107415,33.909517 C 24.107415,39.920122 28.940684,44.753391 34.951289,44.753391 C 40.961895,44.753391 45.795164,39.920122 45.795164,33.909517 C 45.795164,27.898912 40.961895,23.065643 34.951289,23.065643 L 34.951289,23.065643 z M 34.951289,36.512047 C 33.526094,36.512047 32.348759,35.334712 32.348759,33.909517 C 32.348759,32.484322 33.526094,31.306987 34.951289,31.306987 C 36.376484,31.306987 37.553819,32.484322 37.553819,33.909517 C 37.553819,35.334712 36.376484,36.512047 34.951289,36.512047 z "
-           style="opacity:0.11428566;fill:url(#radialGradient10580);fill-opacity:1.0000000;fill-rule:nonzero;stroke:none;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
-      </g>
-    </g>
-  </g>
-</svg>
index 1e50f38..403eb26 100644 (file)
@@ -2,7 +2,7 @@
 Encoding=UTF-8
 Name=Install/Remove Software
 Exec=package-manager --install %F
-Icon=package-manager-icon
+#Icon=package-manager-icon
 Terminal=false
 Type=Application
 Categories=PackageManager;X-SuSE-ControlCenter-System;
index c86b19f..04ef684 100644 (file)
@@ -66,7 +66,6 @@ namespace zypp
 
     Url getmirrorListUrl() const
     {
-      repo::RepoVariablesUrlReplacer replacer;
       return replacer(mirrorlist_url);
     }
 
@@ -80,8 +79,16 @@ namespace zypp
       if ( _baseUrls.empty() && ! (getmirrorListUrl().asString().empty()) )
       {
         emptybaseurls = true;
-        repo::RepoMirrorList rmirrorlist (getmirrorListUrl());
-        std::vector<Url> rmurls = rmirrorlist.getUrls();
+        repo::RepoMirrorList *rmirrorlist = NULL;
+
+        if( metadatapath.empty() )
+          rmirrorlist = new repo::RepoMirrorList (getmirrorListUrl() );
+        else
+          rmirrorlist = new repo::RepoMirrorList (getmirrorListUrl(), metadatapath );
+
+        std::vector<Url> rmurls = rmirrorlist->getUrls();
+        delete rmirrorlist;
+        rmirrorlist = NULL;
         _baseUrls.insert(rmurls.begin(), rmurls.end());
       }
       return _baseUrls;
@@ -110,6 +117,7 @@ namespace zypp
     Pathname packagespath;
     DefaultIntegral<unsigned,defaultPriority> priority;
     mutable bool emptybaseurls;
+    repo::RepoVariablesUrlReplacer replacer;
 
   private:
     Url mirrorlist_url;
@@ -253,12 +261,11 @@ namespace zypp
   std::set<Url> RepoInfo::baseUrls() const
   {
     RepoInfo::url_set replaced_urls;
-    repo::RepoVariablesUrlReplacer replacer;
     for ( url_set::const_iterator it = _pimpl->baseUrls().begin();
           it != _pimpl->baseUrls().end();
           ++it )
     {
-      replaced_urls.insert(replacer(*it));
+      replaced_urls.insert(_pimpl->replacer(*it));
     }
     return replaced_urls;
   }
@@ -275,7 +282,7 @@ namespace zypp
   RepoInfo::urls_const_iterator RepoInfo::baseUrlsBegin() const
   {
     return make_transform_iterator( _pimpl->baseUrls().begin(),
-                                    repo::RepoVariablesUrlReplacer() );
+                                    _pimpl->replacer );
     //return _pimpl->baseUrls.begin();
   }
 
@@ -283,7 +290,7 @@ namespace zypp
   {
     //return _pimpl->baseUrls.end();
     return make_transform_iterator( _pimpl->baseUrls().end(),
-                                    repo::RepoVariablesUrlReplacer() );
+                                    _pimpl->replacer );
   }
 
   RepoInfo::urls_size_type RepoInfo::baseUrlsSize() const
index 3e43817..aef69da 100644 (file)
@@ -160,7 +160,7 @@ namespace zypp
     ret.repoPackagesCachePath = root_r/"packages";
     ret.knownReposPath        = root_r/"repos.d";
     ret.knownServicesPath     = root_r/"services.d";
-    ret.pluginsPath     = root_r/"plugins";
+    ret.pluginsPath           = root_r/"plugins";
     ret.rootDir = root_r;
     return ret;
   }
@@ -407,7 +407,7 @@ namespace zypp
       init_knownRepositories();
     }
 
-    
+
     RepoManagerOptions options;
 
     RepoSet repos;
@@ -544,7 +544,7 @@ namespace zypp
       }
     }
 
-    repo::PluginServices(options.pluginsPath/"services", ServiceCollector(services));    
+    repo::PluginServices(options.pluginsPath/"services", ServiceCollector(services));
   }
 
   void RepoManager::Impl::init_knownRepositories()
@@ -1562,7 +1562,7 @@ namespace zypp
         continue;
 
       // TODO match by url
+
       // we have a matcing repository, now we need to know
       // where it does come from.
       RepoInfo todelete = *it;
@@ -1893,14 +1893,16 @@ namespace zypp
 
     // get target distro identifier
     std::string servicesTargetDistro = _pimpl->options.servicesTargetDistro;
-    if ( servicesTargetDistro.empty() && getZYpp()->getTarget() )
-      servicesTargetDistro = getZYpp()->target()->targetDistribution();
+    if ( servicesTargetDistro.empty() )
+    {
+      servicesTargetDistro = Target::targetDistribution( Pathname() );
+    }
     DBG << "ServicesTargetDistro: " << servicesTargetDistro << endl;
 
     // parse it
     RepoCollector collector(servicesTargetDistro);
     ServiceRepos repos(service, bind( &RepoCollector::collect, &collector, _1 ));
-    
+
     // set service alias and base url for all collected repositories
     for_( it, collector.repos.begin(), collector.repos.end() )
     {
@@ -1966,14 +1968,14 @@ namespace zypp
       // Service explicitly requests the repo being enabled?
       // Service explicitly requests the repo being disabled?
       // And hopefully not both ;) If so, enable wins.
-      bool beEnabled = service.repoToEnableFind( it->alias() );        
+      bool beEnabled = service.repoToEnableFind( it->alias() );
       bool beDisabled = service.repoToDisableFind( it->alias() );
 
       // Make sure the service repo is created with the
       // appropriate enable
       if ( beEnabled ) it->setEnabled(true);
       if ( beDisabled ) it->setEnabled(false);
-      
+
       if ( beEnabled )
       {
         // Remove from enable request list.
@@ -1986,8 +1988,8 @@ namespace zypp
       RepoInfoList::iterator oldRepo( findAlias( it->alias(), oldRepos ) );
       if ( oldRepo == oldRepos.end() )
       {
-        // Not found in oldRepos ==> a new repo to add        
-        
+        // Not found in oldRepos ==> a new repo to add
+
         // At that point check whether a repo with the same alias
         // exists outside this service. Maybe forcefully re-alias
         // the existing repo?
@@ -2075,14 +2077,14 @@ namespace zypp
 
     // we need a writable copy to link it to the file where
     // it is saved if we modify it
-    ServiceInfo service(newService);    
+    ServiceInfo service(newService);
 
     if ( service.type() == ServiceType::PLUGIN )
     {
         MIL << "Not modifying plugin service '" << oldAlias << "'" << endl;
         return;
     }
-    
+
     const ServiceInfo & oldService = getService(oldAlias);
 
     Pathname location = oldService.filepath();
@@ -2104,10 +2106,10 @@ namespace zypp
     }
     service.dumpAsIniOn(file);
     file.close();
-    service.setFilepath(location);    
+    service.setFilepath(location);
 
     _pimpl->services.erase(oldAlias);
-    _pimpl->services.insert(service);    
+    _pimpl->services.insert(service);
 
     // changed properties affecting also repositories
     if( oldAlias != service.alias()                    // changed alias
index 0699e59..e6a8643 100644 (file)
@@ -946,6 +946,7 @@ void MediaCurl::evaluateCurlCode( const Pathname &filename,
       }
       break;
       case CURLE_FTP_COULDNT_RETR_FILE:
+      case CURLE_REMOTE_FILE_NOT_FOUND:
       case CURLE_FTP_ACCESS_DENIED:
         err = "File not found";
         ZYPP_THROW(MediaFileNotFoundException(_url, filename));
index 750b607..965e1d8 100644 (file)
 
 #include <iostream>
 #include <vector>
+#include <time.h>
 #include "zypp/repo/RepoMirrorList.h"
 #include "zypp/media/MetaLinkParser.h"
 #include "zypp/MediaSetAccess.h"
 #include "zypp/base/LogTools.h"
+#include "zypp/ZConfig.h"
+#include "zypp/PathInfo.h"
 
 using namespace std;
 
@@ -26,11 +29,56 @@ namespace zypp
   namespace repo
   { /////////////////////////////////////////////////////////////////
 
+    RepoMirrorList::RepoMirrorList( const Url &url, const Pathname &metadatapath )
+    {
+      std::vector<Url> my_urls;
+      Pathname tmpfile, cachefile;
+
+      if ( url.asString().find("/metalink") != string::npos )
+        cachefile = metadatapath / "mirrorlist.xml";
+      else
+        cachefile = metadatapath / "mirrorlist.txt";
+        //cachefile = ZConfig::instance().repoMetadataPath() / Pathname(escaped_alias) / "mirrorlist.txt";
+
+      zypp::filesystem::PathInfo cacheinfo (cachefile);
+
+      if ( !cacheinfo.isFile() || cacheinfo.mtime() < time(NULL) - (long) ZConfig::instance().repo_refresh_delay() * 60 )
+      {
+        Pathname filepath (url.getPathName());
+        Url abs_url (url);
+
+        DBG << "Getting MirrorList from URL: " << abs_url << endl;
+
+        abs_url.setPathName("");
+        abs_url.setQueryParam("mediahandler", "curl");
+
+        MediaSetAccess access (abs_url);
+        tmpfile = access.provideFile(filepath);
+
+        zypp::filesystem::copy(tmpfile, cachefile);
+      }
+
+      if ( url.asString().find("/metalink") != string::npos )
+      {
+        my_urls = parseXML(cachefile);
+      }
+      else
+      {
+        my_urls = parseTXT(cachefile);
+      }
+
+      setUrls( my_urls );
+      if( urls.empty() )
+        zypp::filesystem::unlink(cachefile);
+    }
+
     RepoMirrorList::RepoMirrorList( const Url &url )
     {
+      std::vector<Url> my_urls;
+      Pathname tmpfile;
+
       Pathname filepath (url.getPathName());
       Url abs_url (url);
-      std::vector<Url> my_urls;
 
       DBG << "Getting MirrorList from URL: " << abs_url << endl;
 
@@ -38,25 +86,22 @@ namespace zypp
       abs_url.setQueryParam("mediahandler", "curl");
 
       MediaSetAccess access (abs_url);
-      Pathname tmpfile = access.provideFile(filepath);
-
-      InputStream tmpfstream (tmpfile);
+      tmpfile = access.provideFile(filepath);
 
       if ( url.asString().find("/metalink") != string::npos )
       {
-        media::MetaLinkParser metalink;
-        metalink.parse(tmpfstream);
-        my_urls = metalink.getUrls();
+        my_urls = parseXML(tmpfile);
       }
       else
       {
-        string tmpurl;
-        while (getline(tmpfstream.stream(), tmpurl))
-        {
-          my_urls.push_back(Url(tmpurl));
-        }
+        my_urls = parseTXT(tmpfile);
       }
 
+      setUrls( my_urls );
+    }
+
+    void RepoMirrorList::setUrls( std::vector<Url> my_urls )
+    {
       int valid_urls = 0;
       for (std::vector<Url>::iterator it = my_urls.begin() ; it != my_urls.end() and valid_urls < 4 ; ++it)
       {
@@ -72,6 +117,26 @@ namespace zypp
         }
       }
     }
+
+    std::vector<Url> RepoMirrorList::parseXML( const Pathname &tmpfile ) const
+    {
+      InputStream tmpfstream (tmpfile);
+      media::MetaLinkParser metalink;
+      metalink.parse(tmpfstream);
+      return metalink.getUrls();
+    }
+
+    std::vector<Url> RepoMirrorList::parseTXT( const Pathname &tmpfile ) const
+    {
+      InputStream tmpfstream (tmpfile);
+      std::vector<Url> my_urls;
+      string tmpurl;
+      while (getline(tmpfstream.stream(), tmpurl))
+      {
+        my_urls.push_back(Url(tmpurl));
+      }
+      return my_urls;
+    }
     
     std::vector<Url> RepoMirrorList::getUrls() const
     {
index 49a0efd..dfc2ca6 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <vector>
 #include "zypp/Url.h"
+#include "zypp/Pathname.h"
 
 namespace zypp
 {
@@ -21,12 +22,16 @@ namespace zypp
     {
       public:
         RepoMirrorList( const Url &url );
+        RepoMirrorList( const Url &url, const Pathname &metadatapath );
         virtual ~RepoMirrorList();
         
         std::vector<Url> getUrls() const;
 
       private:
         std::vector<Url> urls;
+        void setUrls( std::vector<Url> my_urls );
+        std::vector<Url> parseXML( const Pathname &tmpfile ) const;
+        std::vector<Url> parseTXT( const Pathname &tmpfile ) const;
     };
 
   } // ns repo
index 3108b2f..7f33b81 100644 (file)
@@ -24,26 +24,42 @@ namespace repo
 {
 
 RepoVariablesStringReplacer::RepoVariablesStringReplacer()
-{}
+{
+  sysarch = Arch_empty;
+  basearch = Arch_empty;
+}
 
 RepoVariablesStringReplacer::~RepoVariablesStringReplacer()
 {}
 
+void RepoVariablesStringReplacer::resetVarCache( void )
+{
+  sysarch = Arch_empty;
+  basearch = Arch_empty;
+  releasever = "";
+}
+
 std::string RepoVariablesStringReplacer::operator()( const std::string &value ) const
 {
   string newvalue(value);
 
   // $arch
-  Arch sysarch( ZConfig::instance().systemArchitecture() );
+  if( sysarch.empty() )
+    sysarch = ZConfig::instance().systemArchitecture();
+
   newvalue = str::gsub( newvalue, "$arch", sysarch.asString() );
 
   // $basearch
-  Arch basearch( sysarch.baseArch( ) );
+  if( basearch.empty() )
+    basearch = sysarch.baseArch();
 
   newvalue = str::gsub( newvalue, "$basearch", basearch.asString() );
 
   // $releasever (Target::distributionVersion assumes root=/ if target not initialized)
-  newvalue = str::gsub( newvalue, "$releasever", Target::distributionVersion(Pathname()/*guess*/) );
+  if( releasever.empty() )
+    releasever = Target::distributionVersion(Pathname()/*guess*/);
+
+  newvalue = str::gsub( newvalue, "$releasever", releasever );
 
   return newvalue;
 }
@@ -56,6 +72,11 @@ RepoVariablesUrlReplacer::RepoVariablesUrlReplacer()
 RepoVariablesUrlReplacer::~RepoVariablesUrlReplacer()
 {}
 
+void RepoVariablesUrlReplacer::resetVarCache( void )
+{
+  replacer.resetVarCache();
+}
+
 /*
  * Replaces '$arch' and '$basearch' in the path and query part of the URL
  * with the global ZYpp values. Examples:
@@ -66,7 +87,6 @@ RepoVariablesUrlReplacer::~RepoVariablesUrlReplacer()
 Url RepoVariablesUrlReplacer::operator()( const Url &value ) const
 {
   Url newurl = value;
-  RepoVariablesStringReplacer replacer;
   newurl.setPathData(replacer(value.getPathData()));
   newurl.setQueryString(replacer(value.getQueryString()));
 
index 0775f07..012ba73 100644 (file)
@@ -14,6 +14,7 @@
 #include <string>
 
 #include "zypp/Url.h"
+#include "zypp/Arch.h"
 
 namespace zypp
 {
@@ -32,6 +33,13 @@ namespace zypp
     std::string operator()( const std::string &value ) const;
 
     ~RepoVariablesStringReplacer();
+
+    void resetVarCache( void );
+
+    private:
+      mutable Arch sysarch;
+      mutable Arch basearch;
+      mutable std::string releasever;
   };
 
   /**
@@ -46,6 +54,11 @@ namespace zypp
     Url operator()( const Url &url ) const;
 
     ~RepoVariablesUrlReplacer();
+
+    void resetVarCache( void );
+
+    private:
+      RepoVariablesStringReplacer replacer;
   };
 
   } // ns repo
index b7e2dab..7be0a71 100644 (file)
@@ -9,6 +9,7 @@
 #include "zypp/ExternalProgram.h"
 
 using std::stringstream;
+using std::endl;
 
 namespace zypp
 {
@@ -21,7 +22,7 @@ public:
     Impl()
     {
     }
-    
+
     virtual ~Impl()
     {
     }
@@ -31,7 +32,7 @@ class RIMServiceRepos : public ServiceRepos::Impl
 {
 public:
     ServiceRepos::ProcessRepo _callback;
-    
+
     RIMServiceRepos(const ServiceInfo &service,
                     const ServiceRepos::ProcessRepo & callback,
                     const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() )
@@ -40,7 +41,7 @@ public:
       // repoindex.xml must be fetched always without using cookies (bnc #573897)
       Url serviceUrl( service.url() );
       serviceUrl.setQueryParam( "cookies", "0" );
-      
+
       // download the repo index file
       media::MediaManager mediamanager;
       media::MediaAccessId mid = mediamanager.open( serviceUrl );
@@ -51,7 +52,7 @@ public:
       mediamanager.release( mid );
       mediamanager.close( mid );
     }
-    
+
     ~RIMServiceRepos()
     {
 
@@ -62,7 +63,7 @@ class PluginServiceRepos : public ServiceRepos::Impl
 {
 public:
     ServiceRepos::ProcessRepo _callback;
-    
+
     PluginServiceRepos(const ServiceInfo &service,
                       const ServiceRepos::ProcessRepo & callback,
                       const ProgressData::ReceiverFnc &progress = ProgressData::ReceiverFnc() )
@@ -70,36 +71,40 @@ public:
     {
       Url serviceUrl( service.url() );
       stringstream buffer;
-     
-      ExternalProgram prog(serviceUrl.getPathName(), ExternalProgram::Stderr_To_Stdout, false, -1, true);
+
+      // FIXME: Actually we want Stderr to an fd in order to report errors.
+      ExternalProgram prog(serviceUrl.getPathName(), ExternalProgram::Discard_Stderr, false, -1, true);
       prog >> buffer;
 
       // Services code in zypper is not ready to handle other
       // types of exceptions yet
       if ( prog.close() != 0 )
-          ZYPP_THROW(media::MediaException(buffer.str()));
-
+      {
+       // ignore error but we'd like to report it somehow.
+       // ZYPP_THROW(media::MediaException(buffer.str()));
+       ERR << "Cpture plugin error: TBI" << endl;
+      }
       parser::RepoFileReader parser(buffer, _callback);
     }
-    
+
     ~PluginServiceRepos()
     {
 
     }
 };
 
-    
+
 ServiceRepos::ServiceRepos(const ServiceInfo &service,
                            const ServiceRepos::ProcessRepo & callback,
                            const ProgressData::ReceiverFnc &progress)
     : _impl( (service.type() == ServiceType::PLUGIN) ? (ServiceRepos::Impl *)(new PluginServiceRepos(service, callback, progress)) : (ServiceRepos::Impl *)(new RIMServiceRepos(service, callback, progress)))
 {
 }
-    
+
 ServiceRepos::~ServiceRepos()
 {
 }
-    
+
 
 }
 }