Mailinglist Archive: opensuse-commit (2092 mails)

< Previous Next >
commit yast2-pkg-bindings
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Thu, 09 Aug 2007 23:18:28 +0200
  • Message-id: <20070809211828.A06E6678331@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package yast2-pkg-bindings
checked in at Thu Aug 9 23:18:28 CEST 2007.

--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes       2007-08-06 16:54:33.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings.changes  2007-08-09 10:27:20.295952000 +0200
@@ -1,0 +2,10 @@
+Thu Aug  9 10:20:08 CEST 2007 - lslezak@xxxxxxx
+
+- Pkg::SourceScan(), Pkg::SourceCreate() - use product name or URL
+  as alias and name, don't use timestamp (#298723)
+- create a shorter version of the URL if it is used as alias or
+  name (avoid too long aliases/names)
+- Pkg::SourceLoad() - do not load already loaded resolvables
+- 2.15.42
+
+-------------------------------------------------------------------

Old:
----
  yast2-pkg-bindings-2.15.41.tar.bz2

New:
----
  yast2-pkg-bindings-2.15.42.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
--- /var/tmp/diff_new_pack.X28541/_old  2007-08-09 23:16:07.000000000 +0200
+++ /var/tmp/diff_new_pack.X28541/_new  2007-08-09 23:16:07.000000000 +0200
@@ -1,5 +1,5 @@
 #
-# spec file for package yast2-pkg-bindings-devel-doc (Version 2.15.41)
+# spec file for package yast2-pkg-bindings-devel-doc (Version 2.15.42)
 #
 # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
 # This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
 # norootforbuild
 
 Name:           yast2-pkg-bindings-devel-doc
-Version:        2.15.41
+Version:        2.15.42
 Release:        1
 License:        GPL v2 or later
 Group:          Documentation/HTML
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Source0:        yast2-pkg-bindings-2.15.41.tar.bz2
+Source0:        yast2-pkg-bindings-2.15.42.tar.bz2
 prefix:                /usr
 # same as in the main package (because we use the same configure.in.in)
 BuildRequires:  blocxx-devel boost boost-devel dbus-1-devel docbook-xsl-stylesheets doxygen gcc-c++ hal-devel libgcrypt-devel libxcrypt-devel libxslt libzypp libzypp-devel perl-XML-Writer rpm-devel sgml-skel yast2-core-devel yast2-devtools
@@ -37,7 +37,7 @@
     Ladislav SlezŠk <lslezak@xxxxxxxxxx>
 
 %prep
-%setup -n yast2-pkg-bindings-2.15.41
+%setup -n yast2-pkg-bindings-2.15.42
 # build only documentation, ignore all other directories
 echo "doc" > SUBDIRS
 

++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.X28541/_old  2007-08-09 23:16:07.000000000 +0200
+++ /var/tmp/diff_new_pack.X28541/_new  2007-08-09 23:16:07.000000000 +0200
@@ -1,5 +1,5 @@
 #
-# spec file for package yast2-pkg-bindings (Version 2.15.41)
+# spec file for package yast2-pkg-bindings (Version 2.15.42)
 #
 # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
 # This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
 # norootforbuild
 
 Name:           yast2-pkg-bindings
-Version:        2.15.41
+Version:        2.15.42
 Release:        1
 License:        GPL v2 or later
 Group:          System/YaST
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Source0:        yast2-pkg-bindings-2.15.41.tar.bz2
+Source0:        yast2-pkg-bindings-2.15.42.tar.bz2
 prefix:                /usr
 BuildRequires:  blocxx-devel boost boost-devel dbus-1-devel docbook-xsl-stylesheets doxygen gcc-c++ hal-devel libgcrypt-devel libxcrypt-devel libxslt perl-XML-Writer rpm-devel sgml-skel yast2-core-devel yast2-devtools
 BuildRequires:  libzypp-devel >= 3.13.11
@@ -40,7 +40,7 @@
     Stanislav Visnovsky <visnov@xxxxxxx>
 
 %prep
-%setup -n yast2-pkg-bindings-2.15.41
+%setup -n yast2-pkg-bindings-2.15.42
 # build only the library, ignore documentation (it is in devel-doc package)
 echo "src" > SUBDIRS
 
@@ -73,6 +73,13 @@
 %doc %{prefix}/share/doc/packages/yast2-pkg-bindings
 
 %changelog
+* Thu Aug 09 2007 - lslezak@xxxxxxx
+- Pkg::SourceScan(), Pkg::SourceCreate() - use product name or URL
+  as alias and name, don't use timestamp (#298723)
+- create a shorter version of the URL if it is used as alias or
+  name (avoid too long aliases/names)
+- Pkg::SourceLoad() - do not load already loaded resolvables
+- 2.15.42
 * Mon Aug 06 2007 - lslezak@xxxxxxx
 - mount repositories in readonly mode (FATE #302347)
 - fixed Pkg::RepositoryProbe() - now it accepts two arguments

++++++ yast2-pkg-bindings-2.15.41.tar.bz2 -> yast2-pkg-bindings-2.15.42.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.41/configure new/yast2-pkg-bindings-2.15.42/configure
--- old/yast2-pkg-bindings-2.15.41/configure    2007-08-06 16:53:04.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.42/configure    2007-08-09 10:22:08.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for yast2-pkg-bindings 2.15.41.
+# Generated by GNU Autoconf 2.60 for yast2-pkg-bindings 2.15.42.
 #
 # Report bugs to <http://bugs.opensuse.org/>.
 #
@@ -713,8 +713,8 @@
 # Identity of this package.
 PACKAGE_NAME='yast2-pkg-bindings'
 PACKAGE_TARNAME='yast2-pkg-bindings'
-PACKAGE_VERSION='2.15.41'
-PACKAGE_STRING='yast2-pkg-bindings 2.15.41'
+PACKAGE_VERSION='2.15.42'
+PACKAGE_STRING='yast2-pkg-bindings 2.15.42'
 PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
 
 ac_unique_file="RPMNAME"
@@ -1429,7 +1429,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures yast2-pkg-bindings 2.15.41 to adapt to many kinds of systems.
+\`configure' configures yast2-pkg-bindings 2.15.42 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1500,7 +1500,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of yast2-pkg-bindings 2.15.41:";;
+     short | recursive ) echo "Configuration of yast2-pkg-bindings 2.15.42:";;
    esac
   cat <<\_ACEOF
 
@@ -1608,7 +1608,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-yast2-pkg-bindings configure 2.15.41
+yast2-pkg-bindings configure 2.15.42
 generated by GNU Autoconf 2.60
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1622,7 +1622,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by yast2-pkg-bindings $as_me 2.15.41, which was
+It was created by yast2-pkg-bindings $as_me 2.15.42, which was
 generated by GNU Autoconf 2.60.  Invocation command line was
 
   $ $0 $@
@@ -2423,7 +2423,7 @@
 
 # Define the identity of the package.
  PACKAGE='yast2-pkg-bindings'
- VERSION='2.15.41'
+ VERSION='2.15.42'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2650,7 +2650,7 @@
 
 
 
-VERSION="2.15.41"
+VERSION="2.15.42"
 RPMNAME="yast2-pkg-bindings"
 MAINTAINER="Ladislav Slez√°k <lslezak@xxxxxxx>"
 
@@ -21612,7 +21612,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by yast2-pkg-bindings $as_me 2.15.41, which was
+This file was extended by yast2-pkg-bindings $as_me 2.15.42, which was
 generated by GNU Autoconf 2.60.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21665,7 +21665,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-yast2-pkg-bindings config.status 2.15.41
+yast2-pkg-bindings config.status 2.15.42
 configured by $0, generated by GNU Autoconf 2.60,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.41/configure.in new/yast2-pkg-bindings-2.15.42/configure.in
--- old/yast2-pkg-bindings-2.15.41/configure.in 2007-08-06 16:52:47.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.42/configure.in 2007-08-09 10:21:34.000000000 +0200
@@ -3,7 +3,7 @@
 dnl -- This file is generated by y2autoconf 2.14.0 - DO NOT EDIT! --
 dnl    (edit configure.in.in instead)
 
-AC_INIT(yast2-pkg-bindings, 2.15.41, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.15.42, http://bugs.opensuse.org/, yast2-pkg-bindings)
 dnl Check for presence of file 'RPMNAME'
 AC_CONFIG_SRCDIR([RPMNAME])
 
@@ -17,7 +17,7 @@
 AM_INIT_AUTOMAKE(tar-ustar) dnl searches for some needed programs
 
 dnl Important YaST2 variables
-VERSION="2.15.41"
+VERSION="2.15.42"
 RPMNAME="yast2-pkg-bindings"
 MAINTAINER="Ladislav Slez√°k <lslezak@xxxxxxx>"
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.41/src/PkgModuleFunctions.cc new/yast2-pkg-bindings-2.15.42/src/PkgModuleFunctions.cc
--- old/yast2-pkg-bindings-2.15.41/src/PkgModuleFunctions.cc    2007-07-31 16:20:03.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.42/src/PkgModuleFunctions.cc    2007-08-08 16:52:10.000000000 +0200
@@ -192,7 +192,10 @@
     if (_maccess)
     {
         try { _maccess->release(); }
-        catch (const zypp::media::MediaException & ex) {}
+        catch (const zypp::media::MediaException & ex)
+       {
+           y2error("Error in ~Yrepo(): %s", ex.asString().c_str());
+       }
     }
 }
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.41/src/PkgModuleFunctions.h new/yast2-pkg-bindings-2.15.42/src/PkgModuleFunctions.h
--- old/yast2-pkg-bindings-2.15.41/src/PkgModuleFunctions.h     2007-08-06 13:24:32.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.42/src/PkgModuleFunctions.h     2007-08-08 16:32:45.000000000 +0200
@@ -176,6 +176,8 @@
       // convert MountPointSet to YCP Map
       YCPMap MPS2YCPMap(const zypp::DiskUsageCounter::MountPointSet &mps);
 
+      zypp::Url shortenUrl(const zypp::Url &url);
+
     private:
 
       /**
@@ -194,7 +196,8 @@
        YRepo_Ptr logFindRepository(std::vector<YRepo_Ptr>::size_type id);
        
        std::vector<YRepo_Ptr>::size_type createManagedSource(const zypp::Url & url_r,
-           const zypp::Pathname & path_r, const bool base_source, const std::string& type);
+           const zypp::Pathname & path_r, const bool base_source, const std::string& type,
+           const std::string &alias_r);
 
       /**
        * provides SourceProvideFile and SourceProvideFileCommon
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.41/src/Source.cc new/yast2-pkg-bindings-2.15.42/src/Source.cc
--- old/yast2-pkg-bindings-2.15.41/src/Source.cc        2007-08-06 15:02:26.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.42/src/Source.cc        2007-08-08 17:38:42.000000000 +0200
@@ -427,7 +427,14 @@
                }
            }
 
-           success = success && LoadResolvablesFrom((*it)->repoInfo());
+           if (AnyResolvableFrom((*it)->repoInfo().alias()))
+           {
+               y2milestone("Resolvables from '%s' are already present, not loading", (*it)->repoInfo().alias().c_str());
+           }
+           else
+           {
+               success = success && LoadResolvablesFrom((*it)->repoInfo());
+           }
        }
     }
 
@@ -1383,6 +1390,66 @@
     return ret;
 }
 
+// helper function
+zypp::Url PkgModuleFunctions::shortenUrl(const zypp::Url &url)
+{
+    std::string url_path = url.getPathName();
+    std::string begin_path;
+    std::string end_path;
+
+    // try to convert 'http://server/dir1/dir2/dir3/dir4' -> 'http://server/dir1/.../dir4'
+    unsigned int pos_first = url_path.find("/");
+    if (pos_first == 0)
+    {
+       pos_first = url_path.find("/", 1);
+    }
+
+    if (pos_first == std::string::npos)
+    {
+       const int num = 5;
+
+       // "/" not found use the beginning and the end part
+       // 'http://server/very_long_directory_name' -> 'http://server/very_..._name'
+       begin_path = std::string(url_path, 0, num);
+       end_path = std::string(url_path, url_path.size() - num - 1, num);
+    }
+    else
+    {
+       unsigned int pos_last = url_path.rfind("/");
+       if (pos_last == url_path.size() - 1)
+       {
+           pos_last = url_path.rfind("/", url_path.size() - 1);
+       }
+
+       if (pos_last == pos_first || pos_last < pos_first)
+       {
+           const int num = 5;
+
+           // "/" not found use the beginning and the end part
+           begin_path = std::string(url_path, 0, num);
+           end_path = std::string(url_path, url_path.size() - num - 1, num);
+       }
+       else
+       {
+           begin_path = std::string(url_path, 0, pos_first + 1);
+           end_path = std::string(url_path, pos_last);
+       }
+    }
+
+    std::string new_path = begin_path + "..." + end_path;
+    zypp::Url ret(url);
+
+    // use the shorter path
+    ret.setPathName(new_path);
+    // remove query parameters
+    ret.setQueryString("");
+    // remove fragmet
+    ret.setFragment("");
+
+    y2milestone("Using shortened URL: '%s' -> '%s'", url.asString().c_str(), ret.asString().c_str());
+    return ret;
+}
+
 /** Create a Source and immediately put it into the SourceManager.
  * \return the SourceId
  * \throws Exception if Source creation fails
@@ -1391,7 +1458,8 @@
 PkgModuleFunctions::createManagedSource( const zypp::Url & url_r,
                     const zypp::Pathname & path_r,
                     const bool base_source,
-                    const std::string& type )
+                    const std::string& type,
+                    const std::string &alias_r )
 {
     // parse URL
     y2milestone ("Original URL: %s", url_r.asString().c_str());
@@ -1439,11 +1507,31 @@
 
     std::string name;
 
-    // set url and name
+    // set alias and name
     if (alias.empty())
     {
-       alias = timestamp();
-       name = url.asString();
+       // alias not set via URL, use the passed alias or the URL
+       if (alias_r.empty())
+       {
+           // use URL
+           std::string url_path = url.getPathName();
+
+           // the URL is too long, extract only the most interesting parts
+           if (url_path.size() > 15)
+           {
+               alias = shortenUrl(url).asString();
+           }
+           else
+           {
+               alias = url.asString();
+           }
+       }
+       else
+       {
+           alias = alias_r;
+       }
+
+       name = alias;
     }
     else
     {
@@ -1453,6 +1541,7 @@
 
     y2milestone("Name of the repository: '%s'", name.c_str());
 
+    // alias must be unique, add a suffix if it's already used
     alias = UniqueAlias(alias);
 
     // add read only mount option to the URL if needed
@@ -1735,7 +1824,7 @@
        try
        {
            y2milestone("Using product %s in directory %s", it->_name.c_str(), it->_dir.c_str());
-           id = createManagedSource(url, it->_dir, false, "");
+           id = createManagedSource(url, it->_dir, false, "", it->_name);
            ids->add( YCPInteger(id) );
        }
        catch ( const zypp::Exception& excpt)
@@ -1750,7 +1839,7 @@
 
     try
     {
-       id = createManagedSource(url, pn, false, "");
+       id = createManagedSource(url, pn, false, "", "");
        ids->add( YCPInteger(id) );
     }
     catch ( const zypp::Exception& excpt)
@@ -1866,7 +1955,7 @@
     {
        try
        {
-           std::vector<zypp::RepoInfo>::size_type id = createManagedSource(url, it->_dir, base, type);
+           std::vector<zypp::RepoInfo>::size_type id = createManagedSource(url, it->_dir, base, type, it->_name);
            YRepo_Ptr repo = logFindRepository(id);
 
            LoadResolvablesFrom(repo->repoInfo());
@@ -1888,7 +1977,7 @@
 
     try
     {
-       ret = createManagedSource(url, pn, base, type);
+       ret = createManagedSource(url, pn, base, type, "");
 
        YRepo_Ptr repo = logFindRepository(ret);
        repo->repoInfo().setEnabled(true);
@@ -2336,9 +2425,6 @@
  */
 bool PkgModuleFunctions::AnyResolvableFrom(const std::string &alias)
 {
-    // FIXME: can be implemented better? we need a ResStore object for removing,
-    // which means search for a resolvable in the pool and get the Repository
-    // object which can be asked for all resolvables in it
     for (zypp::ResPool::const_iterator it = zypp_ptr()->pool().begin()
        ; it != zypp_ptr()->pool().end()
        ; ++it)
@@ -2354,10 +2440,13 @@
 
 /*
  * A helper function - load resolvable from the repository into the pool
+ * Warning: Use AnyResolvableFrom() method for checing if the resolvables might be already loaded
  */
 bool PkgModuleFunctions::LoadResolvablesFrom(const zypp::RepoInfo &repoinfo)
 {
     bool success = true;
+    unsigned int size_start = zypp_ptr()->pool().size();
+    y2milestone("Loading resolvables from '%s', pool size at start: %d", repoinfo.alias().c_str(), size_start);
 
     try 
     {
@@ -2405,6 +2494,8 @@
        success = false;
     }
 
+    unsigned int size_end = zypp_ptr()->pool().size();
+    y2milestone("Pool size at end: %d (loaded %d resolvables)", size_end, size_start - size_end);
     return success;
 }
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.41/VERSION new/yast2-pkg-bindings-2.15.42/VERSION
--- old/yast2-pkg-bindings-2.15.41/VERSION      2007-08-06 16:51:53.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.42/VERSION      2007-08-09 10:18:28.000000000 +0200
@@ -1 +1 @@
-2.15.41
+2.15.42


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >