- Allow to configure default answers in signature verification workflow.
ResPool pool( ResPool::instance() );
sat::Pool satpool( sat::Pool::instance() );
+ Edition e("1.a");
+ DBG << e.copmpare( Edition("1a") ) << endl;
+ DBG << e.copmpare( Edition("1=a") ) << endl;
+ DBG << e.copmpare( Edition("1#$%^&*()_a") ) << endl;
+return 0;
if ( 1 )
{
Measure x( "INIT TARGET" );
{
{
- //zypp::base::LogControl::TmpLineWriter shutUp;
+ zypp::base::LogControl::TmpLineWriter shutUp;
getZYpp()->initializeTarget( sysRoot );
}
getZYpp()->target()->load();
+ USR << getZYpp()->target()->targetDistribution() << endl;
}
}
repoManager.cleanCache( nrepo );
}
SEC << "refreshMetadata" << endl;
- repoManager.refreshMetadata( nrepo );
+ //repoManager.refreshMetadata( nrepo );
SEC << "buildCache" << endl;
repoManager.buildCache( nrepo );
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- // access to the Pool of Selectables
- ResPoolProxy selectablePool( ResPool::instance().proxy() );
-
- // Iterate it's Products...
- for_( it, selectablePool.byKindBegin<Product>(), selectablePool.byKindEnd<Product>() )
- {
- // The current Product Selectable
- ui::Selectable::Ptr prodSel( *it );
- MIL << dump( prodSel ) << endl;
-
- // It's candiate as Product pointer
- Product::constPtr prod( prodSel->candidateAsKind<Product>() );
- if ( prod )
- {
- // Not NULL, so there is an available Product.
- // Get the installed Products it would replace.
- Product::ReplacedProducts prodReplaces( prod->replacedProducts() );
-
- // Iterate the replaced Products...
- for_( it, prodReplaces.begin(), prodReplaces.end() )
- {
- // The current replaced Product
- Product::constPtr replacedProduct( *it );
- DBG << replacedProduct << endl;
-
- // and this is how you would get the Selectable that contains
- // this replacedProduct, in case you need it ..
- ui::Selectable::Ptr replacedProductsSelectable( ui::Selectable::get( replacedProduct ) );
- DBG << replacedProductsSelectable << endl;
- }
- }
-
- }
///////////////////////////////////////////////////////////////////
-------------------------------------------------------------------
+Tue Sep 9 11:40:42 CEST 2008 - ma@suse.de
+
+- Fix reading of Traget::targetDistribution.
+- Allow to configure default answers in signature verification workflow.
+- revision 10968
+
+-------------------------------------------------------------------
Mon Sep 8 17:11:02 CEST 2008 - jkupec@suse.cz
- CredentialManager added to manage stored credentials
return true;
}
+ ///////////////////////////////////////////////////////////////////
+
namespace
{
- bool _keyRingDefaultAccept( getenv("ZYPP_KEYRING_DEFAULT_ACCEPT_ALL") );
+ KeyRingReport::DefaultAccept _keyRingDefaultAccept( KeyRingReport::ACCEPT_NOTHING );
}
- bool KeyRingReport::askUserToAcceptUnsignedFile( const string &file )
+ KeyRingReport::DefaultAccept KeyRingReport::defaultAccept()
{ return _keyRingDefaultAccept; }
+ void KeyRingReport::setDefaultAccept( DefaultAccept value_r )
+ {
+ MIL << "Set new default accept: " << value_r << endl;
+ _keyRingDefaultAccept = value_r;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+
+ bool KeyRingReport::askUserToAcceptUnsignedFile( const string &file )
+ { return _keyRingDefaultAccept.testFlag( ACCEPT_UNSIGNED_FILE ); }
+
bool KeyRingReport::askUserToAcceptUnknownKey( const string &file, const string &id )
- { return _keyRingDefaultAccept; }
+ { return _keyRingDefaultAccept.testFlag( ACCEPT_UNKNOWNKEY ); }
bool KeyRingReport::askUserToTrustKey( const PublicKey &key )
- { return _keyRingDefaultAccept; }
+ { return _keyRingDefaultAccept.testFlag( TRUST_KEY ); }
bool KeyRingReport::askUserToImportKey( const PublicKey &key)
- { return _keyRingDefaultAccept; }
+ { return _keyRingDefaultAccept.testFlag( IMPORT_KEY ); }
bool KeyRingReport::askUserToAcceptVerificationFailed( const string &file, const PublicKey &key )
- { return _keyRingDefaultAccept; }
+ { return _keyRingDefaultAccept.testFlag( ACCEPT_VERIFICATION_FAILED ); }
///////////////////////////////////////////////////////////////////
//
#include <string>
#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/Flags.h"
#include "zypp/Callback.h"
#include "zypp/base/PtrTypes.h"
#include "zypp/Locale.h"
DEFINE_PTR_TYPE(KeyRing);
+ /** Callbacks from signature verification workflow.
+ *
+ * Per default all methods answer \c false.
+ */
struct KeyRingReport : public callback::ReportBase
{
*/
virtual bool askUserToImportKey( const PublicKey &key);
virtual bool askUserToAcceptVerificationFailed( const std::string &file, const PublicKey &key );
+
+ public:
+ /** \name Query/change the default values.
+ * Per default all methods answer \c false.
+ */
+ //@{
+ enum DefaultAcceptBits
+ {
+ ACCEPT_NOTHING = 0x0000,
+ ACCEPT_UNSIGNED_FILE = 0x0001,
+ ACCEPT_UNKNOWNKEY = 0x0002,
+ TRUST_KEY = 0x0004,
+ IMPORT_KEY = 0x0008,
+ ACCEPT_VERIFICATION_FAILED = 0x0010,
+ };
+ ZYPP_DECLARE_FLAGS(DefaultAccept,DefaultAcceptBits);
+
+ /** Get the active accept bits. */
+ static DefaultAccept defaultAccept();
+ /** Set the active accept bits. */
+ static void setDefaultAccept( DefaultAccept value_r );
+ //@}
};
+ ZYPP_DECLARE_OPERATORS_FOR_FLAGS(KeyRingReport::DefaultAccept);
struct KeyRingSignals : public callback::ReportBase
{
/**
* Follows a signature verification interacting with the user.
* The bool returned depends on user decision to trust or not.
+ *
+ * To propagate user decisions, either connect to the \ref KeyRingReport
+ * or use its static methods to set the desired defaults.
+ *
+ * \code
+ * struct KeyRingReportReceive : public callback::ReceiveReport<KeyRingReport>
+ * {
+ * KeyRingReportReceive() { connect(); }
+ *
+ * // Overload the virtual methods to return the appropriate values.
+ * virtual bool askUserToAcceptUnsignedFile( const std::string &file );
+ * ...
+ * };
+ * \endcode
+ * \see \ref KeyRingReport
*/
bool verifyFileSignatureWorkflow( const Pathname &file, const std::string filedesc, const Pathname &signature);
bool verifyFileSignature( const Pathname &file, const Pathname &signature);
bool verifyFileTrustedSignature( const Pathname &file, const Pathname &signature);
-/** Dtor */
+ /** Dtor */
~KeyRing();
- public:
-
- /** Synonym for \ref text */
- //std::string asString() const
- //{}
-
private:
/** Pointer to implementation */
RWCOW_pointer<Impl> _pimpl;
std::string TargetImpl::targetDistribution() const
{
- std::ifstream baseProduct( (_root / "/etc/products.d/baseproduct").c_str() );
- for( iostr::EachLine in( baseProduct ); in; in.next() )
+ std::ostringstream cmd;
+ cmd << "rpmdb2solv";
+ cmd << " -n";
+ if ( ! _root.empty() )
+ cmd << " -r '" << _root << "'";
+ cmd << " -p '" << Pathname::assertprefix( _root, "/etc/products.d" ) << "'";
+ cmd << " -a distribution.target";
+
+ MIL << "Executing: " << cmd << endl;
+ ExternalProgram prog( cmd.str(), ExternalProgram::Discard_Stderr );
+ for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
{
- std::string line( str::trim( *in ) );
- if ( str::hasPrefix( line, "distribution" ) )
- {
- std::string::size_type pos( line.find( '=', 12 ) );
- if ( pos == std::string::npos )
- continue; // no '=' on line
- pos = line.find_first_not_of( " \t", pos+1 );
- if ( pos == std::string::npos )
- continue; // empty value
- line.erase( 0, pos );
- line += "-";
- line += ZConfig::instance().systemArchitecture().asString();
- return line;
- }
+ return str::trim(output);
}
- WAR << "No distribution in " << PathInfo(_root / "/etc/products.d/baseproduct") << endl;
+
+ int ret = prog.close();
+ WAR << "Got no output from rpmdb2solv (returned " << ret << ")." << endl;
+
return std::string();
}