Mailinglist Archive: zypp-commit (194 mails)
| < Previous | Next > |
[zypp-commit] r10335 - in /trunk/libzypp: package/libzypp.changes zypp/Capability.cc
- From: mlandres@xxxxxxxxxxxxxxxx
- Date: Tue, 03 Jun 2008 18:00:58 -0000
- Message-id: <20080603180058.7087F34F5F@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Tue Jun 3 20:00:58 2008
New Revision: 10335
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10335&view=rev
Log:
- Take care satsolver recognizes 'Capability( "srcpackage:zypper" )'
as 'source package named zypper'. So these capabilities can be used
together with sat::Whatprovides or in resolver requests. (bnc #369893)
Modified:
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/Capability.cc
Modified: trunk/libzypp/package/libzypp.changes
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10335&r1=10334&r2=10335&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Tue Jun 3 20:00:58 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Tue Jun 3 20:00:00 CEST 2008 - ma@xxxxxxx
+
+- Take care satsolver recognizes 'Capability( "srcpackage:zypper" )'
+ as 'source package named zypper'. So these capabilities can be used
+ together with sat::Whatprovides or in resolver requests. (bnc #369893)
+- revision 10335
+
+-------------------------------------------------------------------
Tue Jun 3 15:40:37 CEST 2008 - jreidinger@xxxxxxx
- allow aborting progress during removing packages. (bnc #389238)
Modified: trunk/libzypp/zypp/Capability.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Capability.cc?rev=10335&r1=10334&r2=10335&view=diff
==============================================================================
--- trunk/libzypp/zypp/Capability.cc (original)
+++ trunk/libzypp/zypp/Capability.cc Tue Jun 3 20:00:58 2008
@@ -48,6 +48,13 @@
{
nid = IdString( name_r ).id();
}
+ else if ( kind_r == ResKind::srcpackage )
+ {
+ // map 'kind srcpackage' to 'arch src', the pseudo architecture
+ // satsolver uses.
+ nid = IdString( name_r ).id();
+ nid = ::rel2id( pool_r, nid, IdString(ARCH_SRC).id(), REL_ARCH,
/*create*/true );
+ }
else
{
nid = IdString( str::form( "%s:%s",
@@ -56,8 +63,8 @@
}
- // Extend name by architecture, if provided
- if ( ! arch_r.empty() )
+ // Extend name by architecture, if provided and not a srcpackage
+ if ( ! arch_r.empty() && kind_r != ResKind::srcpackage )
{
nid = ::rel2id( pool_r, nid, arch_r.id(), REL_ARCH, /*create*/true );
}
@@ -71,12 +78,22 @@
return nid;
}
- /** Build \ref Capability from data, just parsing name for '[.arch]'.
+ /** Build \ref Capability from data, just parsing name for '[.arch]' and
detect
+ * 'kind srcpackage' (will be mapped to arch \c src).
*/
sat::detail::IdType relFromStr( ::_Pool * pool_r,
const std::string & name_r, Rel op_r,
const Edition & ed_r,
const ResKind & kind_r )
{
+ static const Arch srcArch( IdString(ARCH_SRC).asString() );
+ static const std::string srcKindPrefix( ResKind::srcpackage.asString() +
':' );
+
+ // check for an embedded 'srcpackage:foo' to be mapped to 'foo' and
'ResKind::srcpackage'.
+ if ( kind_r.empty() && str::hasPrefix( name_r, srcKindPrefix ) )
+ {
+ return relFromStr( pool_r, Arch_empty, name_r.substr(
srcKindPrefix.size() ), op_r, ed_r, ResKind::srcpackage );
+ }
+
Arch arch( Arch_empty );
std::string name( name_r );
@@ -84,7 +101,7 @@
if ( asep != std::string::npos )
{
Arch ext( name_r.substr( asep+1 ) );
- if ( ext.isBuiltIn() )
+ if ( ext.isBuiltIn() || ext == srcArch )
{
arch = ext;
name.erase( asep );
@@ -325,6 +342,12 @@
_kind = EXPRESSION;
return;
}
+ // map back satsolvers pseudo arch 'src' to kind srcpackage
+ if ( _archIfSimple == ARCH_SRC )
+ {
+ _lhs = IdString( (ResKind::srcpackage.asString() + ":" +
IdString(_lhs).c_str()).c_str() ).id();
+ _archIfSimple = 0;
+ }
}
/******************************************************************
@@ -334,6 +357,7 @@
*/
std::ostream & operator<<( std::ostream & str, const CapDetail & obj )
{
+ static const char archsep = '.';
switch ( obj.kind() )
{
case CapDetail::NOCAP:
@@ -342,13 +366,13 @@
case CapDetail::NAMED:
str << obj.name();
if ( obj.hasArch() )
- str << '.' << obj.arch();
+ str << archsep << obj.arch();
return str;
break;
case CapDetail::VERSIONED:
str << obj.name();
if ( obj.hasArch() )
- str << '.' << obj.arch();
+ str << archsep << obj.arch();
return str << " " << obj.op() << " " << obj.ed();
break;
case CapDetail::EXPRESSION:
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
Date: Tue Jun 3 20:00:58 2008
New Revision: 10335
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10335&view=rev
Log:
- Take care satsolver recognizes 'Capability( "srcpackage:zypper" )'
as 'source package named zypper'. So these capabilities can be used
together with sat::Whatprovides or in resolver requests. (bnc #369893)
Modified:
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/Capability.cc
Modified: trunk/libzypp/package/libzypp.changes
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10335&r1=10334&r2=10335&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Tue Jun 3 20:00:58 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Tue Jun 3 20:00:00 CEST 2008 - ma@xxxxxxx
+
+- Take care satsolver recognizes 'Capability( "srcpackage:zypper" )'
+ as 'source package named zypper'. So these capabilities can be used
+ together with sat::Whatprovides or in resolver requests. (bnc #369893)
+- revision 10335
+
+-------------------------------------------------------------------
Tue Jun 3 15:40:37 CEST 2008 - jreidinger@xxxxxxx
- allow aborting progress during removing packages. (bnc #389238)
Modified: trunk/libzypp/zypp/Capability.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Capability.cc?rev=10335&r1=10334&r2=10335&view=diff
==============================================================================
--- trunk/libzypp/zypp/Capability.cc (original)
+++ trunk/libzypp/zypp/Capability.cc Tue Jun 3 20:00:58 2008
@@ -48,6 +48,13 @@
{
nid = IdString( name_r ).id();
}
+ else if ( kind_r == ResKind::srcpackage )
+ {
+ // map 'kind srcpackage' to 'arch src', the pseudo architecture
+ // satsolver uses.
+ nid = IdString( name_r ).id();
+ nid = ::rel2id( pool_r, nid, IdString(ARCH_SRC).id(), REL_ARCH,
/*create*/true );
+ }
else
{
nid = IdString( str::form( "%s:%s",
@@ -56,8 +63,8 @@
}
- // Extend name by architecture, if provided
- if ( ! arch_r.empty() )
+ // Extend name by architecture, if provided and not a srcpackage
+ if ( ! arch_r.empty() && kind_r != ResKind::srcpackage )
{
nid = ::rel2id( pool_r, nid, arch_r.id(), REL_ARCH, /*create*/true );
}
@@ -71,12 +78,22 @@
return nid;
}
- /** Build \ref Capability from data, just parsing name for '[.arch]'.
+ /** Build \ref Capability from data, just parsing name for '[.arch]' and
detect
+ * 'kind srcpackage' (will be mapped to arch \c src).
*/
sat::detail::IdType relFromStr( ::_Pool * pool_r,
const std::string & name_r, Rel op_r,
const Edition & ed_r,
const ResKind & kind_r )
{
+ static const Arch srcArch( IdString(ARCH_SRC).asString() );
+ static const std::string srcKindPrefix( ResKind::srcpackage.asString() +
':' );
+
+ // check for an embedded 'srcpackage:foo' to be mapped to 'foo' and
'ResKind::srcpackage'.
+ if ( kind_r.empty() && str::hasPrefix( name_r, srcKindPrefix ) )
+ {
+ return relFromStr( pool_r, Arch_empty, name_r.substr(
srcKindPrefix.size() ), op_r, ed_r, ResKind::srcpackage );
+ }
+
Arch arch( Arch_empty );
std::string name( name_r );
@@ -84,7 +101,7 @@
if ( asep != std::string::npos )
{
Arch ext( name_r.substr( asep+1 ) );
- if ( ext.isBuiltIn() )
+ if ( ext.isBuiltIn() || ext == srcArch )
{
arch = ext;
name.erase( asep );
@@ -325,6 +342,12 @@
_kind = EXPRESSION;
return;
}
+ // map back satsolvers pseudo arch 'src' to kind srcpackage
+ if ( _archIfSimple == ARCH_SRC )
+ {
+ _lhs = IdString( (ResKind::srcpackage.asString() + ":" +
IdString(_lhs).c_str()).c_str() ).id();
+ _archIfSimple = 0;
+ }
}
/******************************************************************
@@ -334,6 +357,7 @@
*/
std::ostream & operator<<( std::ostream & str, const CapDetail & obj )
{
+ static const char archsep = '.';
switch ( obj.kind() )
{
case CapDetail::NOCAP:
@@ -342,13 +366,13 @@
case CapDetail::NAMED:
str << obj.name();
if ( obj.hasArch() )
- str << '.' << obj.arch();
+ str << archsep << obj.arch();
return str;
break;
case CapDetail::VERSIONED:
str << obj.name();
if ( obj.hasArch() )
- str << '.' << obj.arch();
+ str << archsep << obj.arch();
return str << " " << obj.op() << " " << obj.ed();
break;
case CapDetail::EXPRESSION:
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
| < Previous | Next > |