Mailinglist Archive: zypp-commit (266 mails)

< Previous Next >
[zypp-commit] r11764 - in /trunk/libzypp: package/libzypp.changes zypp/repo/DeltaCandidates.cc zypp/repo/DeltaCandidates.h zypp/repo/PackageDelta.cc zypp/repo/PackageDelta.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Thu, 20 Nov 2008 23:03:59 -0000
  • Message-id: <20081120230359.F25E5E02E1@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Fri Nov 21 00:03:59 2008
New Revision: 11764

URL: http://svn.opensuse.org/viewcvs/zypp?rev=11764&view=rev
Log:
- Fix retrieval of deltarpm info.

Modified:
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/repo/DeltaCandidates.cc
trunk/libzypp/zypp/repo/DeltaCandidates.h
trunk/libzypp/zypp/repo/PackageDelta.cc
trunk/libzypp/zypp/repo/PackageDelta.h

Modified: trunk/libzypp/package/libzypp.changes
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=11764&r1=11763&r2=11764&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Fri Nov 21 00:03:59 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Nov 20 23:59:16 CET 2008 - ma@xxxxxxx
+
+- Fix retrieval of deltarpm info.
+- revision 11764
+
+-------------------------------------------------------------------
Thu Nov 20 22:15:28 CET 2008 - ma@xxxxxxx

- Fix retrieval of Repository attributes like timestamps, keywords

Modified: trunk/libzypp/zypp/repo/DeltaCandidates.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/DeltaCandidates.cc?rev=11764&r1=11763&r2=11764&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/DeltaCandidates.cc (original)
+++ trunk/libzypp/zypp/repo/DeltaCandidates.cc Fri Nov 21 00:03:59 2008
@@ -8,7 +8,7 @@
\---------------------------------------------------------------------*/
extern "C"
{
-#include <satsolver/repo.h>
+#include <satsolver/knownid.h>
}

#include <iostream>
@@ -31,22 +31,19 @@
/** DeltaCandidates implementation. */
struct DeltaCandidates::Impl
{
-
- public:
-
- Impl( const std::list<Repository> & repos, const std::string & pkgname =
"" )
+ public:
+ Impl( const std::list<Repository> & repos, const std::string & pkgname
= "" )
: repos(repos), pkgname(pkgname)
- {
+ {}

- }
+ std::list<Repository> repos;
+ std::string pkgname;

- friend Impl * rwcowClone<Impl>( const Impl * rhs );
- /** clone for RWCOW_pointer */
- Impl * clone() const
- { return new Impl( *this ); }
-
- std::list<Repository> repos;
- std::string pkgname;
+ private:
+ friend Impl * rwcowClone<Impl>( const Impl * rhs );
+ /** clone for RWCOW_pointer */
+ Impl * clone() const
+ { return new Impl( *this ); }
};
///////////////////////////////////////////////////////////////////

@@ -74,48 +71,28 @@
{
std::list<DeltaRpm> candidates;

- // query all repos
- for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
- it != _pimpl->repos.end(); ++it )
+ DBG << "package: " << package << endl;
+ for_( rit, _pimpl->repos.begin(), _pimpl->repos.end() )
{
- DBG << "package: " << package << endl;
+ sat::LookupRepoAttr q( sat::SolvAttr::repositoryDeltaInfo, *rit );
+ for_( it, q.begin(), q.end() )
{
- ::Dataiterator di;
- ::dataiterator_init(&di
- , sat::Pool::instance().get()
- , it->get() // in
this repo
- , SOLVID_META // in
metadata
- , REPOSITORY_DELTAINFO, 0, 0 );
-
- while (::dataiterator_step(&di))
+ if ( _pimpl->pkgname.empty()
+ || it.subFind( sat::SolvAttr(DELTA_PACKAGE_NAME) ).asString()
== _pimpl->pkgname )
{
- ::dataiterator_setpos( &di );
- ::Dataiterator di2;
- ::dataiterator_init(&di2
- , sat::Pool::instance().get()
- , it->get() // in this
repo
- , SOLVID_POS // in metadata
- , DELTA_PACKAGE_NAME
- , _pimpl->pkgname.empty() ? 0 : _pimpl->pkgname.c_str() //
of this value
- , SEARCH_STRING);
- while (::dataiterator_step(&di2))
- {
- ::dataiterator_setpos( &di );
- DeltaRpm delta(*it, SOLVID_POS);
- DBG << "checking delta: " << delta << endl;
- if ( ! package
- || ( package->name() == delta.name()
- && package->edition() == delta.edition()
- && package->arch() == delta.arch() ) )
- {
- DBG << "got delta candidate" << endl;
- candidates.push_back( delta );
- }
- }
+ DeltaRpm delta( it );
+ DBG << "checking delta: " << delta << endl;
+ if ( ! package
+ || ( package->name() == delta.name()
+ && package->edition() == delta.edition()
+ && package->arch() == delta.arch() ) )
+ {
+ DBG << "got delta candidate" << endl;
+ candidates.push_back( delta );
+ }
}
}
}
-
return candidates;
}


Modified: trunk/libzypp/zypp/repo/DeltaCandidates.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/DeltaCandidates.h?rev=11764&r1=11763&r2=11764&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/DeltaCandidates.h (original)
+++ trunk/libzypp/zypp/repo/DeltaCandidates.h Fri Nov 21 00:03:59 2008
@@ -64,12 +64,16 @@

///////////////////////////////////////////////////////////////////

- /** \relates DeltaCandidates Convenient construction. */
+ /** \relates DeltaCandidates Convenient construction.
+ * \todo templated ctor
+ */
template<class RepoIter>
inline DeltaCandidates makeDeltaCandidates( RepoIter begin_r, RepoIter
end_r )
{ return DeltaCandidates( std::list<Repository>( begin_r, end_r ) ); }

- /** \relates DeltaCandidates Convenient construction. */
+ /** \relates DeltaCandidates Convenient construction.
+ * \todo templated ctor
+ */
template<class RepoContainer>
inline DeltaCandidates makeDeltaCandidates( const RepoContainer & cont_r )
{ return makeDeltaCandidates( cont_r.begin(), cont_r.end() ); }

Modified: trunk/libzypp/zypp/repo/PackageDelta.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageDelta.cc?rev=11764&r1=11763&r2=11764&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/PackageDelta.cc (original)
+++ trunk/libzypp/zypp/repo/PackageDelta.cc Fri Nov 21 00:03:59 2008
@@ -12,7 +12,7 @@
#include <iostream>
extern "C"
{
-#include <satsolver/repo.h>
+#include <satsolver/knownid.h>
}

#include "zypp/base/LogTools.h"
@@ -24,6 +24,7 @@
using std::endl;
using std::string;

+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -31,118 +32,95 @@
namespace packagedelta
{ /////////////////////////////////////////////////////////////////

-
- DeltaRpm::DeltaRpm(const Repository & repo, sat::detail::IdType extraid)
- : _repo(repo)
+ DeltaRpm::DeltaRpm( sat::LookupAttr::iterator deltaInfo_r )
{
- MIL << "creating deltarpm from repo " << repo.alias() << ", id " <<
extraid << endl;
- ::Dataiterator di;
- ::dataiterator_init(&di, sat::Pool::instance().get(), repo.get(),
extraid, 0, 0, 0);
-
- string locdir;
- string locname;
- string locevr;
- string locsuffix;
- OnMediaLocation loc;
- BaseVersion base;
- string seqname;
- string seqevr;
- string seqnum;
+ if ( deltaInfo_r.inSolvAttr() != sat::SolvAttr::repositoryDeltaInfo )
+ {
+ INT << "Illegal non-repositoryDeltaInfo iterator: " << deltaInfo_r <<
endl;
+ return;
+ }
+ _repo = deltaInfo_r.inRepo();
+
+ IdString locdir;
+ IdString locname;
+ IdString locevr;
+ IdString locsuffix;
+
+ IdString seqname;
+ IdString seqevr;
+ std::string seqnum;

- if (::dataiterator_step(&di))
+ for_( it, deltaInfo_r.subBegin(), deltaInfo_r.subEnd() )
{
- do
+ switch ( it.inSolvAttr().id() )
{
- switch (di.key->name)
- {
case DELTA_PACKAGE_NAME:
- {
- setName(IdString(di.kv.id).asString());
+ _name = it.asString();
break;
- }
+
case DELTA_PACKAGE_EVR:
- {
- setEdition(Edition(IdString(di.kv.id).asString()));
+ _edition = Edition( it.idStr() );
break;
- }
+
case DELTA_PACKAGE_ARCH:
- {
- setArch(Arch(IdString(di.kv.id).asString()));
+ _arch = Arch( it.idStr() );
break;
- }
+
case DELTA_LOCATION_DIR:
- {
- locdir = IdString(di.kv.id).asString();
+ locdir = it.idStr();
break;
- }
+
case DELTA_LOCATION_NAME:
- {
- locname = IdString(di.kv.id).asString();
+ locname = it.idStr();
break;
- }
+
case DELTA_LOCATION_EVR:
- {
- locevr = IdString(di.kv.id).asString();
+ locevr = it.idStr();
break;
- }
+
case DELTA_LOCATION_SUFFIX:
- {
- locsuffix = IdString(di.kv.id).asString();
+ locsuffix = it.idStr();
break;
- }
+
case DELTA_DOWNLOADSIZE:
- {
- loc.setDownloadSize(ByteCount(di.kv.num, ByteCount::K));
+ _location.setDownloadSize( ByteCount( it.asUnsigned(),
ByteCount::K ) );
break;
- }
+
case DELTA_CHECKSUM:
- {
- const char * s = ::repodata_chk2str( di.data, di.key->type, (const
unsigned char*)di.kv.str );
- if ( s )
- {
- CheckSum val;
- switch ( di.key->type )
- {
- case REPOKEY_TYPE_MD5: val = CheckSum::md5( s ); break;
- case REPOKEY_TYPE_SHA1: val = CheckSum::sha1( s ); break;
- case REPOKEY_TYPE_SHA256: val = CheckSum::sha256( s ); break;
- }
- loc.setChecksum( val );
- }
- }
+ _location.setChecksum( it.asCheckSum() );
+ break;
+
case DELTA_BASE_EVR:
- {
- base.setEdition(Edition(IdString(di.kv.id).asString()));
+ _baseversion.setEdition( Edition( it.idStr() ) );
break;
- }
+
case DELTA_SEQ_NAME:
- {
- seqname = IdString(di.kv.id).asString();
+ seqname = it.idStr();
break;
- }
+
case DELTA_SEQ_EVR:
- {
- seqevr = IdString(di.kv.id).asString();
+ seqevr = it.idStr();
break;
- }
+
case DELTA_SEQ_NUM:
- {
- seqnum = di.kv.str;
+ seqnum = it.asString();
break;
- }
+
default:
- WAR << "ingoring unknown attribute: " << IdString(di.key->name) <<
endl;
- }
- } while (::dataiterator_step(&di));
+ WAR << "Igore unknown attribute: " << it << endl;
+ }
}
- else
- ERR << "the extra does not exist in the repo" << endl;

- //! \todo FIXME here + in sat tools
- loc.setLocation(locdir + "/" + locname + "-" + locevr + "." + locsuffix);
- setLocation(loc);
- base.setSequenceinfo(seqname + "-" + seqevr + "-" + seqnum);
- setBaseversion(base);
+ _location.setLocation( str::form( "%s/%s-%s.%s",
+ locdir.c_str(),
+ locname.c_str(),
+ locevr.c_str(),
+ locsuffix.c_str() ) );
+
+ _baseversion.setSequenceinfo( str::form( "%s-%s-%s",
+ seqname.c_str(),
+ seqevr.c_str(),
+ seqnum.c_str() ) );
}

std::ostream & operator<<( std::ostream & str, const DeltaRpm & obj )
@@ -150,10 +128,7 @@
return str
<< "DeltaRpm[" << obj.name() << "-" << obj.edition() << "." << obj.arch()
<< "](" << obj.location()
- //<< '|' << obj.buildtime()
<< '|' << obj.baseversion().edition()
- //<< ',' << obj.baseversion().buildtime()
- //<< ',' << obj.baseversion().checksum()
<< ',' << obj.baseversion().sequenceinfo()
<< ')';
}

Modified: trunk/libzypp/zypp/repo/PackageDelta.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageDelta.h?rev=11764&r1=11763&r2=11764&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/PackageDelta.h (original)
+++ trunk/libzypp/zypp/repo/PackageDelta.h Fri Nov 21 00:03:59 2008
@@ -34,67 +34,55 @@
/** \todo cheap copy! (switch to RWCOW) */
class DeltaRpm
{
- public:
- class BaseVersion
- {
public:
- BaseVersion()
- {}
+ class BaseVersion
+ {
+ public:
+ BaseVersion()
+ {}
+
+ public:
+ const Edition & edition() const { return _edition; }
+ const std::string & sequenceinfo() const { return _sequenceinfo; }
+
+ public:
+ BaseVersion & setEdition( const Edition & val_r ) {
_edition = val_r; return *this; }
+ BaseVersion & setSequenceinfo( const std::string & val_r ) {
_sequenceinfo = val_r; return *this; }
+
+ private:
+ Edition _edition;
+ std::string _sequenceinfo;
+ };

public:
- const Edition & edition() const { return _edition; }
- //const Date & buildtime() const { return _buildtime; }
- //const CheckSum & checksum() const { return _checksum; }
- const std::string & sequenceinfo() const { return _sequenceinfo; }
+ DeltaRpm() {}
+ DeltaRpm( sat::LookupAttr::iterator deltaInfo_r );

public:
- BaseVersion & setEdition( const Edition & val_r ) { _edition
= val_r; return *this; }
- //BaseVersion & setBuildtime( const Date & val_r ) {
_buildtime = val_r; return *this; }
- //BaseVersion & setChecksum( const CheckSum & val_r ) {
_checksum = val_r; return *this; }
- BaseVersion & setSequenceinfo( const std::string & val_r ) {
_sequenceinfo = val_r; return *this; }
+ /** \name Target package ident. */
+ //@{
+ const std::string & name() const { return _name; }
+ const Edition & edition() const { return _edition; }
+ const Arch & arch() const { return _arch; }
+ //@}
+ const OnMediaLocation & location() const { return _location; }
+ const BaseVersion & baseversion() const { return _baseversion; }
+ const Repository & repository() const { return _repo; }
+
+ public:
+ DeltaRpm & setName( const std::string & val_r ) { _name =
val_r; return *this; }
+ DeltaRpm & setEdition( const Edition & val_r ) { _edition =
val_r; return *this; }
+ DeltaRpm & setArch( const Arch & val_r ) { _arch =
val_r; return *this; }
+ DeltaRpm & setLocation( const OnMediaLocation & val_r ) { _location =
val_r; return *this; }
+ DeltaRpm & setBaseversion( const BaseVersion & val_r ) { _baseversion
= val_r; return *this; }

private:
- Edition _edition;
- //Date _buildtime;
- //CheckSum _checksum;
- std::string _sequenceinfo;
- };
-
- //typedef std::list<BaseVersion> BaseVersions;
-
- public:
- DeltaRpm()
- {}
- DeltaRpm(const Repository & repo, sat::detail::IdType id);
-
- public:
- /** \name Target package ident. */
- //@{
- const std::string & name() const { return _name; }
- const Edition & edition() const { return _edition; }
- const Arch & arch() const { return _arch; }
- //@}
- const OnMediaLocation & location() const { return _location; }
- const BaseVersion & baseversion() const { return _baseversion; }
- //const Date & buildtime() const { return _buildtime;}
- const Repository & repository() const { return _repo; }
-
- public:
- DeltaRpm & setName( const std::string & val_r ) { _name = val_r;
return *this; }
- DeltaRpm & setEdition( const Edition & val_r ) { _edition =
val_r; return *this; }
- DeltaRpm & setArch( const Arch & val_r ) { _arch = val_r;
return *this; }
- DeltaRpm & setLocation( const OnMediaLocation & val_r ) { _location =
val_r; return *this; }
- DeltaRpm & setBaseversion( const BaseVersion & val_r ) { _baseversion =
val_r; return *this; }
- //DeltaRpm & setBuildtime( const Date & val_r ) { _buildtime =
val_r; return *this; }
-
- private:
- std::string _name;
- Edition _edition;
- Arch _arch;
- OnMediaLocation _location;
- BaseVersion _baseversion;
- //Date _buildtime;
- Repository _repo;
+ std::string _name;
+ Edition _edition;
+ Arch _arch;
+ OnMediaLocation _location;
+ BaseVersion _baseversion;
+ Repository _repo;
};

/** \relates DeltaRpm Stream output. */

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

< Previous Next >
This Thread
  • No further messages