Mailinglist Archive: zypp-commit (266 mails)

< Previous Next >
[zypp-commit] r11641 - in /trunk/libzypp: VERSION.cmake package/libzypp.changes zypp/Patch.cc zypp/Patch.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Fri, 07 Nov 2008 22:59:08 -0000
  • Message-id: <20081107225908.D3BFE34672@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Fri Nov 7 23:59:08 2008
New Revision: 11641

URL: http://svn.opensuse.org/viewcvs/zypp?rev=11641&view=rev
Log:
- Fix retrieval of patch contents and references attributes. (bnc #442200)

Modified:
trunk/libzypp/VERSION.cmake
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/Patch.cc
trunk/libzypp/zypp/Patch.h

Modified: trunk/libzypp/VERSION.cmake
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=11641&r1=11640&r2=11641&view=diff
==============================================================================
--- trunk/libzypp/VERSION.cmake (original)
+++ trunk/libzypp/VERSION.cmake Fri Nov 7 23:59:08 2008
@@ -59,10 +59,10 @@
# changes file. See './mkChangelog -h' for help.
#
SET(LIBZYPP_MAJOR "5")
-SET(LIBZYPP_COMPATMINOR "20")
+SET(LIBZYPP_COMPATMINOR "21")
SET(LIBZYPP_MINOR "21")
SET(LIBZYPP_PATCH "0")
#
-# LAST RELEASED: 5.20.0 (20)
+# LAST RELEASED: 5.21.0 (21)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======

Modified: trunk/libzypp/package/libzypp.changes
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=11641&r1=11640&r2=11641&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Fri Nov 7 23:59:08 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Nov 7 23:55:47 CET 2008 - ma@xxxxxxx
+
+- Fix retrieval of patch contents and references attributes. (bnc #442200)
+- revision 11641
+- version 5.21.0 (21)
+
+-------------------------------------------------------------------
Fri Nov 7 19:51:00 CET 2008 - ma@xxxxxxx

- Add CheckSum::asString.

Modified: trunk/libzypp/zypp/Patch.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Patch.cc?rev=11641&r1=11640&r2=11641&view=diff
==============================================================================
--- trunk/libzypp/zypp/Patch.cc (original)
+++ trunk/libzypp/zypp/Patch.cc Fri Nov 7 23:59:08 2008
@@ -110,110 +110,64 @@
return false;
}

-
Patch::Contents Patch::contents() const
{
- Contents result;
-
- ::Dataiterator di;
- ::dataiterator_init(&di
- , sat::Pool::instance().get()
- , repository().get() // in this repo
- , sat::Solvable::id() // in metadata
- , UPDATE_COLLECTION, 0, 0 );
-
- while (::dataiterator_step(&di))
+ Contents result;
+ DBG << *this << endl;
+ sat::LookupAttr updateCollection( sat::SolvAttr::updateCollection,
satSolvable() );
+ for_( entry, updateCollection.begin(), updateCollection.end() )
+ {
+ IdString name ( entry.subFind( sat::SolvAttr::updateCollectionName
).idStr() );
+ Edition edition ( entry.subFind( sat::SolvAttr::updateCollectionEvr
).idStr() );
+ Arch arch ( entry.subFind( sat::SolvAttr::updateCollectionArch
).idStr() );
+ if ( name.empty() )
+ {
+ WAR << "Ignore malformed updateCollection entry: " << name << "-" <<
edition << "." << arch << endl;
+ continue;
+ }
+
+ // The entry is relevant if there is an installed
+ // package with the same name and arch.
+ bool relevant = false;
+ sat::WhatProvides providers( (Capability( name.id() )) );
+ for_( it, providers.begin(), providers.end() )
{
- ::dataiterator_setpos( &di );
- ::Dataiterator di2;
- ::dataiterator_init(&di2
- , sat::Pool::instance().get()
- , repository().get() // in this repo
- , SOLVID_POS // in metadata
- ,0,0,0 );
-
- IdString nameid;
- Edition evr;
- Arch arch;
-
- while (::dataiterator_step(&di2))
- {
- switch ( di2.key->name )
- {
- case UPDATE_COLLECTION_NAME:
- nameid = IdString(di2.kv.id);
- break;
- case UPDATE_COLLECTION_EVR:
- evr = Edition(di2.kv.id);
- break;
- case UPDATE_COLLECTION_ARCH:
- arch = Arch(di2.kv.id);
- break;
- }
- }
-
- if ( nameid.empty() )
- continue;
-
- /* search providers of name */
- sat::WhatProvides providers( Capability( nameid.c_str() ) );
- MIL << *this << " providers: " << endl;
- MIL << providers << endl;
-
- if (providers.empty())
- {
- WAR << *this << " misses provider for '" << nameid << "'" << endl;
- continue;
- }
-
- bool is_relevant = false;
- for_( it, providers.begin(), providers.end() )
- {
- if (it->ident() != nameid) /* package _name_ must match */
- continue;
-
- if (it->isSystem() /* only look at installed providers with same
arch */
- && it->arch() == arch)
- {
- is_relevant = true;
- }
- }
- if (!is_relevant)
- {
- MIL << *this << " is not relevant to the system" << endl;
-
- continue; /* skip if name.arch is not installed */
- }
-
-
- /* find exact providers first (this matches the _real_ 'collection
content' of the patch */
- sat::WhatProvides exact_providers( Capability( nameid.c_str(),
Rel::EQ, evr, ResKind::package ) );
- if (exact_providers.empty())
- {
- /* no exact providers: find 'best' providers: those with a larger
evr */
- sat::WhatProvides best_providers( Capability( nameid.c_str(),
Rel::GT, evr, ResKind::package ) );
- if (best_providers.empty())
- {
- // Hmm, this patch is not installable, noone is providing the
package in the collection
- // FIXME: raise execption ? fake a solvable ?
- }
- else
- {
- // FIXME ?! loop over providers and try to find installed ones ?
- result.get().insert( *(best_providers.begin()) );
- }
- }
- else
- {
- // FIXME ?! loop over providers and try to find installed ones ?
- result.get().insert( *(exact_providers.begin()) );
- }
- } /* while (attribute array) */
+ if ( it->isSystem() && it->ident() == name && it->arch() == arch )
+ {
+ relevant = true;
+ break;
+ }
+ }
+ if ( ! relevant )
+ {
+ DBG << "Not relevant: " << name << "-" << edition << "." << arch <<
endl;
+ continue;
+ }
+
+#warning definition of patch contents is poor - needs review
+ /* find exact providers first (this matches the _real_ 'collection
content' of the patch */
+ providers = sat::WhatProvides( Capability( arch, name.c_str(), Rel::EQ,
edition, ResKind::package ) );
+ if ( providers.empty() )
+ {
+ /* no exact providers: find 'best' providers: those with a larger evr
*/
+ providers = sat::WhatProvides( Capability( arch, name.c_str(),
Rel::GT, edition, ResKind::package ) );
+ if ( providers.empty() )
+ {
+ // Hmm, this patch is not installable, noone is providing the
package in the collection
+ // FIXME: raise execption ? fake a solvable ?
+ WAR << "Missing provider: " << name << "-" << edition << "." << arch
<< endl;
+ continue;
+ }
+ }
+
+ // FIXME ?! loop over providers and try to find installed ones ?
+ DBG << "Found " << name << "-" << edition << "." << arch << ": " <<
*(providers.begin()) << endl;
+ result.get().insert( *(providers.begin()) );
+ }

- return result;
+ return result;
}

-
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Patch::ReferenceIterator
@@ -221,35 +175,16 @@
///////////////////////////////////////////////////////////////////

Patch::ReferenceIterator::ReferenceIterator( const sat::Solvable & val_r )
- {
- base_reference() = sat::LookupAttr( sat::SolvAttr::updateReferenceId,
- val_r ).begin();
- _hrefit = sat::LookupAttr( sat::SolvAttr::updateReferenceHref,
- val_r ).begin();
- _titleit = sat::LookupAttr( sat::SolvAttr::updateReferenceTitle,
- val_r ).begin();
- _typeit = sat::LookupAttr( sat::SolvAttr::updateReferenceType,
- val_r ).begin();
- }
-
+ { base_reference() = sat::LookupAttr( sat::SolvAttr::updateReference, val_r
).begin(); }

std::string Patch::ReferenceIterator::id() const
- { return base_reference().asString(); }
+ { return base_reference().subFind( sat::SolvAttr::updateReferenceId
).asString(); }
std::string Patch::ReferenceIterator::href() const
- { return _hrefit.asString(); }
+ { return base_reference().subFind( sat::SolvAttr::updateReferenceHref
).asString(); }
std::string Patch::ReferenceIterator::title() const
- { return _titleit.asString(); }
+ { return base_reference().subFind( sat::SolvAttr::updateReferenceTitle
).asString(); }
std::string Patch::ReferenceIterator::type() const
- { return _typeit.asString(); }
-
-
- void Patch::ReferenceIterator::increment()
- {
- ++base_reference();
- ++_hrefit;
- ++_titleit;
- ++_typeit;
- }
+ { return base_reference().subFind( sat::SolvAttr::updateReferenceType
).asString(); }

/////////////////////////////////////////////////////////////////
} // namespace zypp

Modified: trunk/libzypp/zypp/Patch.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Patch.h?rev=11641&r1=11640&r2=11641&view=diff
==============================================================================
--- trunk/libzypp/zypp/Patch.h (original)
+++ trunk/libzypp/zypp/Patch.h Fri Nov 7 23:59:08 2008
@@ -196,15 +196,10 @@
* "bugzilla"
*/
std::string type() const;
+
private:
friend class boost::iterator_core_access;
-
int dereference() const { return 0; }
- void increment();
- private:
- sat::LookupAttr::iterator _hrefit;
- sat::LookupAttr::iterator _titleit;
- sat::LookupAttr::iterator _typeit;
};

inline Patch::ReferenceIterator Patch::referencesBegin() const

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

< Previous Next >
This Thread
  • No further messages