Hello community,
here is the log from the commit of package libzypp-zmd-backend
checked in at Sun Apr 2 12:42:11 CEST 2006.
--------
--- libzypp-zmd-backend/libzypp-zmd-backend.changes 2006-03-30 22:06:44.000000000 +0200
+++ libzypp-zmd-backend/libzypp-zmd-backend.changes 2006-04-02 12:00:49.000000000 +0200
@@ -1,0 +2,6 @@
+Sun Apr 2 11:23:17 CEST 2006 - kkaempf(a)suse.de
+
+- create dummy source for local packages (#147765)
+- rev 2881
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libzypp-zmd-backend.spec ++++++
--- /var/tmp/diff_new_pack.gsiIMZ/_old 2006-04-02 12:42:02.000000000 +0200
+++ /var/tmp/diff_new_pack.gsiIMZ/_new 2006-04-02 12:42:02.000000000 +0200
@@ -22,7 +22,7 @@
Obsoletes: zmd-librc-backend
Summary: ZMD backend for Package, Patch, Pattern, and Product Management
Version: 7.1.1
-Release: 26
+Release: 27
Source: zmd-backend-%{version}.tar.bz2
Prefix: /usr
@@ -68,6 +68,9 @@
/etc/logrotate.d/zmd-backend
%changelog -n libzypp-zmd-backend
+* Sun Apr 02 2006 - kkaempf(a)suse.de
+- create dummy source for local packages (#147765)
+- rev 2881
* Thu Mar 30 2006 - kkaempf(a)suse.de
- fix 'update-status', the 'status' attribute was moved to the
resolvables table
++++++ zmd-backend-7.1.1.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/dbsource/DbAccess.cc new/zmd-backend-7.1.1/src/dbsource/DbAccess.cc
--- old/zmd-backend-7.1.1/src/dbsource/DbAccess.cc 2006-03-29 18:28:35.000000000 +0200
+++ new/zmd-backend-7.1.1/src/dbsource/DbAccess.cc 2006-04-02 11:49:08.000000000 +0200
@@ -564,27 +564,20 @@
sqlite3_bind_text( handle, 2, pkg->group().c_str(), -1, SQLITE_STATIC );
sqlite3_bind_text( handle, 3, pkg->summary().c_str(), -1, SQLITE_STATIC );
sqlite3_bind_text( handle, 4, desc2str(pkg->description()).c_str(), -1, SQLITE_STATIC );
- const char *plainrpm = pkg->plainRpm().asString().c_str();
- if (plainrpm[0] == '.' && plainrpm[1] == '/') plainrpm += 2; // strip leading "./"
- sqlite3_bind_text( handle, 5, plainrpm, -1, SQLITE_STATIC ); // package_url
-
Source_Ref src( pkg->source() );
-#if 1 // set to 0 once Source::remote() is fixed (#157469)
- if (source_is_local( src ))
- {
- sqlite3_bind_text( handle, 6, plainrpm, -1, SQLITE_STATIC ); // so zypp knows how to get the package
- }
- else {
- sqlite3_bind_text( handle, 6, NULL, -1, SQLITE_STATIC ); // else zmd knows how to get the package
- }
-#else
+
+ sqlite3_bind_text( handle, 5, src.url().asString().c_str(), -1, SQLITE_STATIC ); // package_url
+
if (src.remote()) {
- sqlite3_bind_text( handle, 6, NULL, -1, SQLITE_STATIC ); // zmd knows how to get the package
+ DBG << "Source " << src << " is remote";
+ sqlite3_bind_text( handle, 6, NULL, -1, SQLITE_STATIC ); // zmd knows how to get the package
}
else {
- sqlite3_bind_text( handle, 6, pkg->plainRpm().asString().c_str(), -1, SQLITE_STATIC ); // zypp knows how to get the package
+ const char *plainrpm = pkg->plainRpm().asString().c_str();
+ if (plainrpm[0] == '.' && plainrpm[1] == '/') plainrpm += 2; // strip leading "./"
+ DBG << "Source " << src << " is local, plainrpm " << plainrpm << endl;
+ sqlite3_bind_text( handle, 6, plainrpm, -1, SQLITE_STATIC ); // zypp knows how to get the package
}
-#endif
sqlite3_bind_text( handle, 7, NULL, -1, SQLITE_STATIC ); // signature_filename
sqlite3_bind_int( handle, 8, pkg->size() );
sqlite3_bind_int( handle, 9, pkg->installOnly() ? 1 : 0 );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/dbsource/DbSources.cc new/zmd-backend-7.1.1/src/dbsource/DbSources.cc
--- old/zmd-backend-7.1.1/src/dbsource/DbSources.cc 2006-03-30 09:52:59.000000000 +0200
+++ new/zmd-backend-7.1.1/src/dbsource/DbSources.cc 2006-04-02 11:22:54.000000000 +0200
@@ -61,6 +61,34 @@
}
+Source_Ref
+DbSources::createDummy( const Url & url, const string & catalog )
+{
+ media::MediaManager mmgr;
+ media::MediaId mediaid = mmgr.open( url );
+ SourceFactory factory;
+
+ try {
+
+ DbSourceImpl *impl = new DbSourceImpl ();
+ impl->factoryCtor( mediaid, Pathname(), catalog );
+ impl->setId( catalog );
+ impl->setZmdName( catalog );
+ impl->setZmdDescription ( catalog );
+ impl->setPriority( 0 );
+ impl->setSubscribed( true );
+
+ Source_Ref src( factory.createFrom( impl ) );
+ return src;
+ }
+ catch (Exception & excpt_r) {
+ ZYPP_CAUGHT(excpt_r);
+ }
+
+ return Source_Ref();
+}
+
+
const SourcesList &
DbSources::sources (bool refresh)
{
@@ -122,13 +150,6 @@
<< ", subs " << subscribed
<< endl;
- if (id != "@system"
- && subscribed == 0)
- {
- MIL << "Not subscribed, skipping" << endl;
- continue;
- }
-
if (alias.empty()) alias = name;
if (desc.empty()) desc = alias;
@@ -140,6 +161,7 @@
impl->setZmdName( name );
impl->setZmdDescription ( desc );
impl->setPriority( priority );
+ impl->setSubscribed( subscribed != 0 );
impl->attachDatabase( _db );
impl->attachIdMap( &_idmap );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/dbsource/DbSources.h new/zmd-backend-7.1.1/src/dbsource/DbSources.h
--- old/zmd-backend-7.1.1/src/dbsource/DbSources.h 2006-03-19 00:25:11.000000000 +0100
+++ new/zmd-backend-7.1.1/src/dbsource/DbSources.h 2006-04-02 11:22:43.000000000 +0200
@@ -29,6 +29,7 @@
#include <sqlite3.h>
#include <zypp/Source.h>
+#include <zypp/Url.h>
#include <zypp/PoolItem.h>
#include "DbAccess.h"
@@ -53,6 +54,8 @@
const SourcesList & sources (bool refresh = false);
zypp::ResObject::constPtr getById (sqlite_int64 id) const;
+
+ static zypp::Source_Ref createDummy( const zypp::Url & url, const std::string & catalog );
};
#endif // ZMD_BACKEND_DBSOURCES_H
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/find-file.cc new/zmd-backend-7.1.1/src/find-file.cc
--- old/zmd-backend-7.1.1/src/find-file.cc 2006-03-28 22:25:06.000000000 +0200
+++ new/zmd-backend-7.1.1/src/find-file.cc 2006-03-31 16:23:17.000000000 +0200
@@ -39,7 +39,7 @@
MIL << "-------------------------------------" << endl;
MIL << "START find-file " << argv[1] << " " << argv[2] << endl;
- ZYpp::Ptr God = backend::getZYpp();
+ ZYpp::Ptr God = backend::getZYpp( true );
Target_Ptr target = backend::initTarget( God );
string name = target->rpmDb().whoOwnsFile( argv[2] );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/package-files.cc new/zmd-backend-7.1.1/src/package-files.cc
--- old/zmd-backend-7.1.1/src/package-files.cc 2006-03-28 22:25:11.000000000 +0200
+++ new/zmd-backend-7.1.1/src/package-files.cc 2006-03-31 16:23:22.000000000 +0200
@@ -233,7 +233,7 @@
if (!db.openDb( true )) // open for writing
return 1;
- ZYpp::Ptr God = backend::getZYpp();
+ ZYpp::Ptr God = backend::getZYpp( true );
Target_Ptr target = backend::initTarget( God );
int result = package_files( db.db(), str::strtonum<long long>( argv[2] ), target );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/parse-metadata.cc new/zmd-backend-7.1.1/src/parse-metadata.cc
--- old/zmd-backend-7.1.1/src/parse-metadata.cc 2006-03-28 22:25:14.000000000 +0200
+++ new/zmd-backend-7.1.1/src/parse-metadata.cc 2006-03-31 16:24:41.000000000 +0200
@@ -222,7 +222,7 @@
// database type path/uri catalog/alias
MIL << "START parse-metadata " << argv[1] << " " << argv[2] << " " << argv[3] << " " << argv[4] << endl;
- ZYpp::Ptr God = backend::getZYpp();
+ ZYpp::Ptr God = backend::getZYpp( );
manager = SourceManager::sourceManager();
if (! restore_sources ())
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/query-files.cc new/zmd-backend-7.1.1/src/query-files.cc
--- old/zmd-backend-7.1.1/src/query-files.cc 2006-03-28 22:28:46.000000000 +0200
+++ new/zmd-backend-7.1.1/src/query-files.cc 2006-04-02 11:53:16.000000000 +0200
@@ -10,6 +10,7 @@
#include <zypp/ZYpp.h>
#include <zypp/ZYppFactory.h>
+
#include <zypp/SourceManager.h>
#include <zypp/Source.h>
#include <zypp/base/Logger.h>
@@ -28,6 +29,7 @@
#include <sys/stat.h>
#include "dbsource/DbAccess.h"
+#include "dbsource/DbSources.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "query-files"
@@ -35,17 +37,18 @@
//-----------------------------------------------------------------------------
static ResStore
-query_file (const Pathname & path)
+query_file (const Pathname & path, Source_Ref source)
{
ResStore store;
- MIL << "query_file(" << path << ")" << endl;
+ MIL << "query_file(" << path << "), source " << source << endl;
target::rpm::RpmHeader::constPtr header = target::rpm::RpmHeader::readPackage( path );
- Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, path );
+ Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, path, source );
if (package != NULL) {
+ DBG << "package source " << package->source() << endl;
store.insert( package );
}
@@ -101,14 +104,14 @@
int
extract_packages_from_directory (ResStore & store,
const Pathname & path,
- const string & alias,
+ Source_Ref source,
bool recursive)
{
Pathname filename;
PathInfo magic;
bool distro_magic, pkginfo_magic;
-DBG << "extract_packages_from_directory(.., " << path << ", " << alias << ", " << recursive << ")" << endl;
+DBG << "extract_packages_from_directory(.., " << path << ", " << source.alias() << ", " << recursive << ")" << endl;
/*
Check for magic files that indicate how to treat the
@@ -222,7 +225,7 @@
PathInfo file_info( file_path );
if (recursive && file_info.isDir()) {
- extract_packages_from_directory( store, file_path, alias, recursive );
+ extract_packages_from_directory( store, file_path, source, recursive );
} else if (file_info.isFile()) {
@@ -232,7 +235,7 @@
if (string(*it, ++dotpos) != "rpm")
continue;
target::rpm::RpmHeader::constPtr header = target::rpm::RpmHeader::readPackage( file_path );
- Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, file_path );
+ Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, file_path, source );
if (package != NULL) {
DBG << "Adding package " << *package << endl;
@@ -245,11 +248,11 @@
static ResStore
-query_directory (const Pathname & path, bool recursive)
+query_directory (const Pathname & path, bool recursive, Source_Ref source)
{
ResStore store;
MIL << "query_directory( " << path << (recursive?", recursive":"") << ")" << endl;
- extract_packages_from_directory( store, path, "@local", recursive );
+ extract_packages_from_directory( store, path, source, recursive );
return store;
}
@@ -257,10 +260,12 @@
//----------------------------------------------------------------------------
static ResStore
-query (const string & uri, const string & channel_id)
+query (const string & uri, Source_Ref source)
{
ResStore store;
+ MIL << "query(" << uri << ", " << source << ")" << endl;
+
/* The magic 7 is strlen ("file://") */
if (uri.size() < 7
@@ -284,12 +289,7 @@
path = p;
}
- MIL << "query(" << uri << ") path '" << path << "'" << endl;
-
-#if 0
- channel = rc_channel_new (channel_id != NULL ? channel_id : "@local",
- "foo", "foo", "foo");
-#endif
+ MIL << "query path '" << path << "'" << endl;
struct stat buf;
@@ -300,7 +300,7 @@
}
else if (S_ISREG( buf.st_mode )) { /* Single file */
- store = query_file( path );
+ store = query_file( path, source );
}
else if (S_ISDIR( buf.st_mode )) { /* Directory */
@@ -312,7 +312,7 @@
string p( uri, query_part + 1 );
parse_query( p, &recursive );
}
- store = query_directory( path, recursive );
+ store = query_directory( path, recursive, source );
}
return store;
@@ -402,7 +402,7 @@
MIL << "-------------------------------------" << endl;
MIL << "START query-files " << argv[1] << " " << argv[2] << " " << ((argc>3)?argv[3]:"") << endl;
- ZYpp::Ptr God = backend::getZYpp();
+ ZYpp::Ptr God = backend::getZYpp( true );
DbAccess db(argv[1]);
@@ -417,7 +417,10 @@
}
else {
MIL << "Doing a file/directory query" << endl;
- ResStore store = query( argv[2], argc == 4 ? argv[3] : "@local" );
+
+ Source_Ref source = DbSources::createDummy( Url("file:///"), argc == 4 ? argv[3] : "@local" );
+
+ ResStore store = query( argv[2], source );
if (!store.empty()) {
db.writeStore( store, ResStatus::uninstalled );
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/query-pool.cc new/zmd-backend-7.1.1/src/query-pool.cc
--- old/zmd-backend-7.1.1/src/query-pool.cc 2006-03-30 14:58:53.000000000 +0200
+++ new/zmd-backend-7.1.1/src/query-pool.cc 2006-03-31 16:22:01.000000000 +0200
@@ -143,7 +143,7 @@
MIL << "START query-pool " << filter << " " << catalog << endl;
- ZYpp::Ptr Z = backend::getZYpp();
+ ZYpp::Ptr Z = backend::getZYpp( true );
Target_Ptr target = backend::initTarget( Z, false );
query_pool( Z, filter, catalog );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/query-system.cc new/zmd-backend-7.1.1/src/query-system.cc
--- old/zmd-backend-7.1.1/src/query-system.cc 2006-03-30 14:45:03.000000000 +0200
+++ new/zmd-backend-7.1.1/src/query-system.cc 2006-03-31 16:22:06.000000000 +0200
@@ -155,7 +155,7 @@
MIL << "-------------------------------------" << endl;
MIL << "START query-system " << argv[1] << endl;
- ZYpp::Ptr God = backend::getZYpp();
+ ZYpp::Ptr God = backend::getZYpp( true );
Target_Ptr target = backend::initTarget( God, false );
DbAccess db( argv[1] );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/resolve-dependencies.cc new/zmd-backend-7.1.1/src/resolve-dependencies.cc
--- old/zmd-backend-7.1.1/src/resolve-dependencies.cc 2006-03-29 13:06:29.000000000 +0200
+++ new/zmd-backend-7.1.1/src/resolve-dependencies.cc 2006-03-31 16:22:14.000000000 +0200
@@ -75,7 +75,7 @@
if (!db.openDb(false))
return 1;
- ZYpp::Ptr God = backend::getZYpp();
+ ZYpp::Ptr God = backend::getZYpp( true );
// load the catalogs and resolvables from sqlite db
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/transact.cc new/zmd-backend-7.1.1/src/transact.cc
--- old/zmd-backend-7.1.1/src/transact.cc 2006-03-30 18:50:32.000000000 +0200
+++ new/zmd-backend-7.1.1/src/transact.cc 2006-03-31 12:45:21.000000000 +0200
@@ -134,9 +134,12 @@
PoolItemList x,y,z;
::setenv( "YAST_IS_RUNNING", "1", 1 );
-
+#if 0
+#warning dry_run disabled
+ God->target()->commit( God->pool(), 0, x, y, z );
+#else
God->target()->commit( God->pool(), 0, x, y, z, dry_run );
-
+#endif
ExternalProgram suseconfig( "/sbin/SuSEconfig", ExternalProgram::Discard_Stderr ); // should redirect stderr to logfile
suseconfig.close(); // discard exit code
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/zmd-backend.cc new/zmd-backend-7.1.1/src/zmd-backend.cc
--- old/zmd-backend-7.1.1/src/zmd-backend.cc 2006-03-30 14:44:22.000000000 +0200
+++ new/zmd-backend-7.1.1/src/zmd-backend.cc 2006-03-31 16:21:18.000000000 +0200
@@ -4,14 +4,19 @@
#include "zmd-backend.h"
+#include <zypp/zypp_detail/ZYppReadOnlyHack.h>
+
using namespace zypp;
using namespace std;
namespace backend {
ZYpp::Ptr
-getZYpp()
+getZYpp( bool readonly )
{
+ if (readonly)
+ zypp::zypp_readonly_hack::IWantIt();
+
ZYpp::Ptr Z = NULL;
try {
Z = zypp::getZYpp();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zmd-backend-7.1.1/src/zmd-backend.h new/zmd-backend-7.1.1/src/zmd-backend.h
--- old/zmd-backend-7.1.1/src/zmd-backend.h 2006-03-30 14:44:31.000000000 +0200
+++ new/zmd-backend-7.1.1/src/zmd-backend.h 2006-03-31 16:21:49.000000000 +0200
@@ -12,7 +12,7 @@
namespace backend {
// get ZYpp pointer, exit(1) if locked
-zypp::ZYpp::Ptr getZYpp();
+zypp::ZYpp::Ptr getZYpp( bool readonly = false );
// init Target (root="/", commit_only=true), exit(1) on error
zypp::Target_Ptr initTarget( zypp::ZYpp::Ptr Z, bool commit_only = true );
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...