Hello community,
here is the log from the commit of package yast2-pkg-bindings
checked in at Wed Jul 18 22:55:01 CEST 2007.
--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes 2007-07-16 16:59:45.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings.changes 2007-07-18 16:18:54.551410000 +0200
@@ -1,0 +2,10 @@
+Wed Jul 18 16:11:08 CEST 2007 - lslezak@suse.cz
+
+- SourceLoad(), SourceRefreshNow() - rebuild cache after
+ refreshing metadata
+- SourceEditGet/Set() - do not change alias, use name instead
+ (alias cannot be changed from yast now)
+- SourceGeneralData() - return also "name" key
+- 2.15.31
+
+-------------------------------------------------------------------
Old:
----
yast2-pkg-bindings-2.15.30.tar.bz2
New:
----
yast2-pkg-bindings-2.15.31.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.Qj1329/_old 2007-07-18 22:53:40.000000000 +0200
+++ /var/tmp/diff_new_pack.Qj1329/_new 2007-07-18 22:53:40.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings (Version 2.15.30)
+# spec file for package yast2-pkg-bindings (Version 2.15.31)
#
# 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.30
+Version: 2.15.31
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.15.30.tar.bz2
+Source0: yast2-pkg-bindings-2.15.31.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.11.8
@@ -40,7 +40,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-pkg-bindings-2.15.30
+%setup -n yast2-pkg-bindings-2.15.31
%build
%{prefix}/bin/y2tool y2autoconf
@@ -71,6 +71,13 @@
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings
%changelog
+* Wed Jul 18 2007 - lslezak@suse.cz
+- SourceLoad(), SourceRefreshNow() - rebuild cache after
+ refreshing metadata
+- SourceEditGet/Set() - do not change alias, use name instead
+ (alias cannot be changed from yast now)
+- SourceGeneralData() - return also "name" key
+- 2.15.31
* Mon Jul 16 2007 - lslezak@suse.cz
- SourceMediaData() - report all base urls (key "base_urls" in the
result)
++++++ yast2-pkg-bindings-2.15.30.tar.bz2 -> yast2-pkg-bindings-2.15.31.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.30/configure new/yast2-pkg-bindings-2.15.31/configure
--- old/yast2-pkg-bindings-2.15.30/configure 2007-07-16 16:58:15.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.31/configure 2007-07-18 16:17:17.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.30.
+# Generated by GNU Autoconf 2.60 for yast2-pkg-bindings 2.15.31.
#
# 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.30'
-PACKAGE_STRING='yast2-pkg-bindings 2.15.30'
+PACKAGE_VERSION='2.15.31'
+PACKAGE_STRING='yast2-pkg-bindings 2.15.31'
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.30 to adapt to many kinds of systems.
+\`configure' configures yast2-pkg-bindings 2.15.31 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.30:";;
+ short | recursive ) echo "Configuration of yast2-pkg-bindings 2.15.31:";;
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.30
+yast2-pkg-bindings configure 2.15.31
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.30, which was
+It was created by yast2-pkg-bindings $as_me 2.15.31, 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.30'
+ VERSION='2.15.31'
cat >>confdefs.h <<_ACEOF
@@ -2650,7 +2650,7 @@
-VERSION="2.15.30"
+VERSION="2.15.31"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
@@ -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.30, which was
+This file was extended by yast2-pkg-bindings $as_me 2.15.31, 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.30
+yast2-pkg-bindings config.status 2.15.31
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.30/configure.in new/yast2-pkg-bindings-2.15.31/configure.in
--- old/yast2-pkg-bindings-2.15.30/configure.in 2007-07-16 16:58:03.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.31/configure.in 2007-07-18 16:17:04.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.30, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.15.31, 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.30"
+VERSION="2.15.31"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.30/src/PkgModuleFunctions.cc new/yast2-pkg-bindings-2.15.31/src/PkgModuleFunctions.cc
--- old/yast2-pkg-bindings-2.15.30/src/PkgModuleFunctions.cc 2007-07-16 14:39:51.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.31/src/PkgModuleFunctions.cc 2007-07-18 13:08:39.000000000 +0200
@@ -175,7 +175,7 @@
IMPL_PTR_TYPE(YRepo);
YRepo::YRepo(zypp::RepoInfo & repo)
- : _repo(repo), _repo_orig_alias(repo.alias()), _deleted(false)
+ : _repo(repo), _deleted(false)
{}
YRepo::~YRepo()
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.30/src/PkgModuleFunctions.h new/yast2-pkg-bindings-2.15.31/src/PkgModuleFunctions.h
--- old/yast2-pkg-bindings-2.15.30/src/PkgModuleFunctions.h 2007-07-16 14:39:51.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.31/src/PkgModuleFunctions.h 2007-07-18 13:08:01.000000000 +0200
@@ -69,7 +69,6 @@
{
private:
zypp::RepoInfo _repo;
- std::string _repo_orig_alias;
zypp::MediaSetAccess_Ptr _maccess;
bool _deleted;
@@ -81,7 +80,6 @@
const zypp::RepoInfo & repoInfo() const { return _repo; }
zypp::RepoInfo & repoInfo() { return _repo; }
- const std::string & origRepoAlias() const { return _repo_orig_alias; }
zypp::MediaSetAccess_Ptr & mediaAccess();
bool isDeleted() {return _deleted;}
@@ -142,6 +140,8 @@
YCPValue GetPkgLocation(const YCPString& p, bool full_path);
YCPValue PkgProp( zypp::PoolItem_Ref item );
YCPValue PkgMediaSizesOrCount (bool sizes);
+
+ bool aliasExists(const std::string &alias) const;
zypp::RepoManager CreateRepoManager();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.30/src/Source.cc new/yast2-pkg-bindings-2.15.31/src/Source.cc
--- old/yast2-pkg-bindings-2.15.30/src/Source.cc 2007-07-16 16:12:46.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.31/src/Source.cc 2007-07-18 14:39:36.000000000 +0200
@@ -47,7 +47,7 @@
#include
-#include // snprintf
+#include <sstream> // ostringstream
/*
@@ -169,6 +169,16 @@
return -1;
}
+bool PkgModuleFunctions::aliasExists(const std::string &alias) const
+{
+ for(std::vector::const_iterator it = repos.begin(); it != repos.end() ; ++it)
+ {
+ if (!(*it)->isDeleted() && (*it)->repoInfo().alias() == alias)
+ return true;
+ }
+
+ return false;
+}
/****************************************************************************************
* @builtin SourceSetRamCache
@@ -270,7 +280,10 @@
{
y2milestone("Autorefreshing source: %s", (*it)->repoInfo().alias().c_str());
repomanager.refreshMetadata((*it)->repoInfo());
- # warning TODO?: Do we need to rebuild the cache after refresh??
+
+ // rebuild cache (the default policy is "if needed")
+ y2milestone("Rebuilding cache for '%s'...", (*it)->repoInfo().alias().c_str());
+ repomanager.buildCache((*it)->repoInfo());
}
success = LoadResolvablesFrom((*it)->repoInfo());
@@ -463,34 +476,30 @@
zypp::RepoManager repomanager = CreateRepoManager();
- // TODO: can it be better?
- // Note: we have to be very careful here, user could do _very_ strange actions
- // e.g. rename repo A to B, add a new repo with alias A, remove it and
- // then rename C to A...
-
- // remove deleted repos (the old configuration)
+ // remove deleted repos (the old configurations) at first
for (std::vector::iterator it = repos.begin();
it != repos.end(); ++it)
{
- // the repo has been removed or has been renamed
- if ((*it)->isDeleted() || (*it)->repoInfo().alias() != (*it)->origRepoAlias())
+ // the repo has been removed
+ if ((*it)->isDeleted())
{
+ std::string repo_alias = (*it)->repoInfo().alias();
// remove the cache
if (repomanager.isCached((*it)->repoInfo()))
{
- y2milestone("Removing cache for '%s'...", (*it)->repoInfo().alias().c_str());
+ y2milestone("Removing cache for '%s'...", repo_alias.c_str());
repomanager.cleanCache((*it)->repoInfo());
}
try
{
- repomanager.getRepositoryInfo((*it)->origRepoAlias());
- y2milestone("Removing repository '%s'", (*it)->repoInfo().alias().c_str());
- repomanager.removeRepository(zypp::RepoInfo().setAlias((*it)->origRepoAlias()));
+ repomanager.getRepositoryInfo(repo_alias);
+ y2milestone("Removing repository '%s'", repo_alias.c_str());
+ repomanager.removeRepository((*it)->repoInfo());
}
catch (const zypp::repo::RepoNotFoundException &ex)
{
- y2warning("No such repository: %s", (*it)->origRepoAlias().c_str());
+ y2warning("No such repository: %s", repo_alias.c_str());
}
catch (const zypp::Exception & excpt)
{
@@ -611,6 +620,7 @@
* "type" : YCPString,
* "url" : YCPString (without password, but see SourceURL),
* "alias" : YCPString,
+ * "name" : YCPString,
* ];
*
* </code>
@@ -658,6 +668,7 @@
}
data->add( YCPString("alias"), YCPString(repo->repoInfo().alias()));
+ data->add( YCPString("name"), YCPString(repo->repoInfo().name()));
YCPList base_urls;
for( zypp::RepoInfo::urls_const_iterator it = repo->repoInfo().baseUrlsBegin(); it != repo->repoInfo().baseUrlsEnd(); ++it)
@@ -1214,37 +1225,49 @@
// create source definition object
zypp::RepoInfo repo;
- repo.setAlias(alias.empty() ? timestamp() : alias);
- repo.setType(repotype);
- repo.addBaseUrl(url);
- repo.setEnabled(true);
- repo.setAutorefresh(true);
-
- y2milestone("Adding source '%s' (%s)", repo.alias().c_str(), url.asString().c_str());
+ std::string name;
-/* try
- {*/
-
-// repomanager.addRepository(repo);
-
- repomanager.refreshMetadata(repo);
-
- // TODO FIXME handle existing alias better
-
-/* }
- catch (const zypp::MediaException &e)
+ // set url and name
+ if (alias.empty())
{
- y2error("Cannot read source data");
+ alias = timestamp();
+ name = url.asString();
}
- catch (const ParseException &e)
+ else
{
- y2error("Cannot parse source data");
+ name = alias;
}
- catch (const RepoAlreadyExistsException &e)
+
+ y2milestone("Name of the repository: '%s'", name.c_str());
+
+ // make a copy
+ std::string alias_copy = alias;
+
+ unsigned int id = 0;
+ while(aliasExists(alias))
{
- y2error("Source '%s' already exists", repo.alias().c_str());
+ y2milestone("Alias %s already found: %d", alias.c_str(), logFindAlias(alias));
+
+ // the alias already exists - add a counter
+ std::ostringstream ostr;
+ ostr << alias_copy << "_" << id;
+
+ alias = ostr.str();
+
+ y2milestone("Using alias %s", alias.c_str());
+ ++id;
}
-*/
+
+ repo.setAlias(alias);
+ repo.setName(name);
+ repo.setType(repotype);
+ repo.addBaseUrl(url);
+ repo.setEnabled(true);
+ repo.setAutorefresh(true);
+
+ y2milestone("Adding source '%s' (%s)", repo.alias().c_str(), url.asString().c_str());
+ // note: exceptions should be caught by the calling code
+ repomanager.refreshMetadata(repo);
// build cache if needed
if (!repomanager.isCached(repo))
@@ -1262,32 +1285,6 @@
repo.autorefresh() ? "true" : "false"
);
-/*
- // if the source has empty alias use a time stamp
- if (newsrc.alias().empty())
- {
- // use product name+edition as the alias
- // (URL is not enough for different sources in the same DVD drive)
- // alias must be unique, add timestamp
- zypp::ResStore products = newsrc.resolvables (zypp::Product::TraitsType::kind);
- zypp::ResStore::iterator
- b = products.begin (),
- e = products.end ();
- if (b != e)
- {
- zypp::ResObject::Ptr p = *b;
- alias = p->name () + '-' + p->edition ().asString () + '-';
- }
- alias += timestamp ();
-
- newsrc.setAlias( alias );
- y2milestone("Using string '%s' as the alias", alias.c_str());
- }
-
- zypp::SourceManager::SourceId id = zypp::SourceManager::sourceManager()->addSource( newsrc );
- y2milestone("Added source %lu: %s %s (alias %s)", id, new_url.asString().c_str(), path_r.asString().c_str(), alias.c_str() );
-*/
-
// the source is at the end of the list
return repos.size() - 1;
}
@@ -1541,6 +1538,7 @@
y2error("SourceCreate for '%s' product '%s' has failed"
, url.asString().c_str(), pn.asString().c_str());
_last_error.setLastError(excpt.asUserString());
+ return YCPInteger(-1);
}
}
} else {
@@ -1687,7 +1685,11 @@
try
{
zypp::RepoManager repomanager = CreateRepoManager();
+ y2milestone("Refreshing metadata '%s'", repo->repoInfo().alias().c_str());
repomanager.refreshMetadata(repo->repoInfo());
+
+ y2milestone("Caching source '%s'...", repo->repoInfo().alias().c_str());
+ repomanager.buildCache(repo->repoInfo());
}
catch ( const zypp::Exception & expt )
{
@@ -1771,7 +1773,7 @@
src_map->add(YCPString("enabled"), YCPBoolean((*it)->repoInfo().enabled()));
// Note: autorefresh() is tribool
src_map->add(YCPString("autorefresh"), YCPBoolean((*it)->repoInfo().autorefresh()));
- src_map->add(YCPString("alias"), YCPString((*it)->repoInfo().alias()));
+ src_map->add(YCPString("name"), YCPString((*it)->repoInfo().name()));
ret->add(src_map);
}
@@ -1848,11 +1850,11 @@
repo->repoInfo().setAutorefresh( autorefresh );
}
- if( !descr->value(YCPString("alias")).isNull() && descr->value(YCPString("alias"))->isString())
+ if( !descr->value(YCPString("name")).isNull() && descr->value(YCPString("name"))->isString())
{
// rename the source
- y2debug("set alias: %s", descr->value(YCPString("alias"))->asString()->value().c_str());
- repo->repoInfo().setAlias(descr->value(YCPString("alias"))->asString()->value());
+ y2debug("set name: %s", descr->value(YCPString("name"))->asString()->value().c_str());
+ repo->repoInfo().setName(descr->value(YCPString("name"))->asString()->value());
}
#warning SourceEditSet ordering not implemented yet
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.30/VERSION new/yast2-pkg-bindings-2.15.31/VERSION
--- old/yast2-pkg-bindings-2.15.30/VERSION 2007-07-16 15:04:24.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.31/VERSION 2007-07-18 16:15:11.000000000 +0200
@@ -1 +1 @@
-2.15.30
+2.15.31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org