Author: mlandres
Date: Mon Aug 11 18:05:22 2008
New Revision: 10813
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10813&view=rev
Log:
- Propagate default rpm install flags from zypp.conf via ZConfig and
ZYppCommitPolicy down to the installer. (FATE #302952)
Added:
trunk/libzypp/zypp/target/rpm/RpmFlags.h
Modified:
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/ZConfig.cc
trunk/libzypp/zypp/ZConfig.h
trunk/libzypp/zypp/ZYppCommitPolicy.cc
trunk/libzypp/zypp/ZYppCommitPolicy.h
trunk/libzypp/zypp/base/Flags.h
trunk/libzypp/zypp/target/TargetImpl.cc
trunk/libzypp/zypp/target/rpm/RpmDb.cc
trunk/libzypp/zypp/target/rpm/RpmDb.h
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Mon Aug 11 18:05:22 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Mon Aug 11 18:00:40 CEST 2008 - ma@suse.de
+
+- Propagate default rpm install flags from zypp.conf via ZConfig and
+ ZYppCommitPolicy down to the installer. (FATE #302952)
+- revision 10813
+
+-------------------------------------------------------------------
Mon Aug 11 16:28:07 CEST 2008 - ma@suse.de
- Add base::Flags (like qt's QFlags) a type-safe way of storing
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Mon Aug 11 18:05:22 2008
@@ -590,6 +590,7 @@
SET( zypp_target_rpm_HEADERS
target/rpm/BinHeader.h
target/rpm/RpmCallbacks.h
+ target/rpm/RpmFlags.h
target/rpm/RpmDb.h
target/rpm/RpmException.h
target/rpm/RpmHeader.h
Modified: trunk/libzypp/zypp/ZConfig.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.cc?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZConfig.cc (original)
+++ trunk/libzypp/zypp/ZConfig.cc Mon Aug 11 18:05:22 2008
@@ -280,7 +280,7 @@
}
else if ( entry == "rpm.install.excludedocs" )
{
- rpmInstallExcludedocs = true;
+ rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS );
}
}
}
@@ -342,7 +342,7 @@
bool apply_locks_file;
- DefaultIntegral rpmInstallExcludedocs;
+ target::rpm::RpmInstFlags rpmInstallFlags;
};
///////////////////////////////////////////////////////////////////
@@ -559,8 +559,8 @@
///////////////////////////////////////////////////////////////////
- bool ZConfig::rpmInstallExcludedocs() const
- { return _pimpl->rpmInstallExcludedocs; }
+ target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
+ { return _pimpl->rpmInstallFlags; }
/////////////////////////////////////////////////////////////////
} // namespace zypp
Modified: trunk/libzypp/zypp/ZConfig.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.h?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZConfig.h (original)
+++ trunk/libzypp/zypp/ZConfig.h Mon Aug 11 18:05:22 2008
@@ -17,7 +17,6 @@
#include <string>
#include "zypp/base/Deprecated.h"
-
#include "zypp/base/NonCopyable.h"
#include "zypp/base/PtrTypes.h"
@@ -26,6 +25,8 @@
#include "zypp/Pathname.h"
#include "zypp/IdString.h"
+#include "zypp/target/rpm/RpmFlags.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -208,22 +209,27 @@
Pathname update_dataPath() const;
/**
- * Path where the repo metadata is downloaded and kept (update_dataPath()/).
- * \ingroup g_ZC_REPOCACHE
+ * Path where the repo metadata is downloaded and kept (update_dataPath()/).
+ * \ingroup g_ZC_REPOCACHE
*/
Pathname update_scriptsPath() const;
/**
- * Path where the repo solv files are created and kept (update_dataPath()/solv).
- * \ingroup g_ZC_REPOCACHE
+ * Path where the repo solv files are created and kept (update_dataPath()/solv).
+ * \ingroup g_ZC_REPOCACHE
*/
Pathname update_messagesPath() const;
public:
/** \name Options for package installation */
//@{
- /** Don't install any files which are marked as documentation (false). */
- bool rpmInstallExcludedocs() const;
+ /** The default \ref target::rpm::RpmInstFlags for \ref ZYppCommitPolicy.
+ * Or-combination of \ref target::rpm::RpmInstFlag.
+ * \code
+ * ZConfig.instance().rpmInstallFlags().testFlag( target::rpm::RPMINST_EXCLUDEDOCS );
+ * \endcode
+ */
+ target::rpm::RpmInstFlags rpmInstallFlags() const;
//@}
public:
Modified: trunk/libzypp/zypp/ZYppCommitPolicy.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYppCommitPolicy.cc?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYppCommitPolicy.cc (original)
+++ trunk/libzypp/zypp/ZYppCommitPolicy.cc Mon Aug 11 18:05:22 2008
@@ -12,12 +12,23 @@
#include <iostream>
+#include "zypp/base/String.h"
+
+#include "zypp/ZConfig.h"
+
#include "zypp/ZYppCommitPolicy.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ ZYppCommitPolicy::ZYppCommitPolicy()
+ : _restrictToMedia ( 0 )
+ , _dryRun ( false )
+ , _rpmInstFlags ( ZConfig::instance().rpmInstallFlags() )
+ , _syncPoolAfterCommit( true )
+ {}
+
std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj )
{
str << "CommitPolicy(";
@@ -25,12 +36,10 @@
str << " restrictToMedia:" << obj.restrictToMedia();
if ( obj.dryRun() )
str << " dryRun";
- if ( obj.rpmNoSignature() )
- str << " rpmNoSignature";
- if ( obj.rpmExcludeDocs() )
- str << " rpmExcludeDocs";
if ( obj.syncPoolAfterCommit() )
str << " syncPoolAfterCommit";
+ if ( obj.rpmInstFlags() )
+ str << " rpmInstFlags{" << str::hexstring(obj.rpmInstFlags()) << "}";
return str << " )";
}
Modified: trunk/libzypp/zypp/ZYppCommitPolicy.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYppCommitPolicy.h?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYppCommitPolicy.h (original)
+++ trunk/libzypp/zypp/ZYppCommitPolicy.h Mon Aug 11 18:05:22 2008
@@ -14,6 +14,8 @@
#include <iosfwd>
+#include "zypp/target/rpm/RpmFlags.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -26,13 +28,7 @@
class ZYppCommitPolicy
{
public:
- ZYppCommitPolicy()
- : _restrictToMedia ( 0 )
- , _dryRun ( false )
- , _rpmNoSignature ( false )
- , _rpmExcludeDocs ( false )
- , _syncPoolAfterCommit( true )
- {}
+ ZYppCommitPolicy();
public:
unsigned restrictToMedia() const
@@ -41,11 +37,15 @@
bool dryRun() const
{ return _dryRun; }
+ target::rpm::RpmInstFlags rpmInstFlags() const
+ { return _rpmInstFlags; }
+
bool rpmNoSignature() const
- { return _rpmNoSignature; }
+ { return _rpmInstFlags.testFlag( target::rpm::RPMINST_NOSIGNATURE ); }
bool rpmExcludeDocs() const
- { return _rpmExcludeDocs; }
+ { return _rpmInstFlags.testFlag( target::rpm::RPMINST_EXCLUDEDOCS ); }
+
bool syncPoolAfterCommit() const
{ return _syncPoolAfterCommit; }
@@ -67,24 +67,27 @@
ZYppCommitPolicy & dryRun( bool yesNo_r )
{ _dryRun = yesNo_r; return *this; }
+ /** The default \ref target::rpm::RpmInstFlags. (default: none)*/
+ ZYppCommitPolicy & rpmInstFlags( target::rpm::RpmInstFlags newFlags_r )
+ { _rpmInstFlags = newFlags_r; return *this; }
+
/** Use rpm option --nosignature (default: false) */
ZYppCommitPolicy & rpmNoSignature( bool yesNo_r )
- { _rpmNoSignature = yesNo_r; return *this; }
+ { _rpmInstFlags.setFlag( target::rpm::RPMINST_NOSIGNATURE, yesNo_r ); return *this; }
/** Use rpm option --excludedocs (default: false) */
ZYppCommitPolicy & rpmExcludeDocs( bool yesNo_r )
- { _rpmExcludeDocs = yesNo_r; return *this; }
+ { _rpmInstFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS, yesNo_r ); return *this; }
/** Kepp pool in sync with the Target databases after commit (default: true) */
ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r )
{ _syncPoolAfterCommit = yesNo_r; return *this; }
private:
- unsigned _restrictToMedia;
- bool _dryRun;
- bool _rpmNoSignature;
- bool _rpmExcludeDocs;
- bool _syncPoolAfterCommit;
+ unsigned _restrictToMedia;
+ bool _dryRun;
+ target::rpm::RpmInstFlags _rpmInstFlags;
+ bool _syncPoolAfterCommit;
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/base/Flags.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Flags.h?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/Flags.h (original)
+++ trunk/libzypp/zypp/base/Flags.h Mon Aug 11 18:05:22 2008
@@ -59,8 +59,8 @@
public:
Flags() : _val( 0 ) {}
- Flags( Enum rhs ) : _val( rhs ) {}
- explicit Flags( unsigned rhs ) : _val( rhs ) {}
+ Flags( Enum flag_r ) : _val( flag_r ) {}
+ explicit Flags( unsigned flag_r ) : _val( flag_r ) {}
Flags & operator&=( unsigned rhs ) { _val &= rhs; return *this; }
Flags & operator&=( Flags rhs ) { _val &= rhs._val; return *this; }
@@ -88,7 +88,13 @@
Flags operator~() const { return ~_val; }
public:
- bool testFlag( Enum val_r ) const { return _val & val_r; }
+ void setFlag( Enum flag_r, bool newval_r )
+ { newval_r ? setFlag(flag_r) : unsetFlag(flag_r); }
+
+ void setFlag( Enum flag_r ) { _val |= flag_r; }
+ void unsetFlag( Enum flag_r ) { _val &= ~flag_r; }
+
+ bool testFlag( Enum flag_r ) const { return _val & flag_r; }
private:
unsigned _val;
Modified: trunk/libzypp/zypp/target/TargetImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetImpl.cc?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/TargetImpl.cc (original)
+++ trunk/libzypp/zypp/target/TargetImpl.cc Mon Aug 11 18:05:22 2008
@@ -717,7 +717,7 @@
RpmInstallPackageReceiver progress( it->resolvable() );
progress.connect();
bool success = true;
- unsigned flags = 0;
+ rpm::RpmInstFlags flags;
// Why force and nodeps?
//
// Because zypp builds the transaction and the resolver asserts that
@@ -725,13 +725,13 @@
// We use rpm just to unpack and register the package in the database.
// We do this step by step, so rpm is not aware of the bigger context.
// So we turn off rpms internal checks, because we do it inside zypp.
- flags |= rpm::RpmDb::RPMINST_NODEPS;
- flags |= rpm::RpmDb::RPMINST_FORCE;
+ flags |= rpm::RPMINST_NODEPS;
+ flags |= rpm::RPMINST_FORCE;
//
- if (p->installOnly()) flags |= rpm::RpmDb::RPMINST_NOUPGRADE;
- if (policy_r.dryRun()) flags |= rpm::RpmDb::RPMINST_TEST;
- if (policy_r.rpmExcludeDocs()) flags |= rpm::RpmDb::RPMINST_NODOCS;
- if (policy_r.rpmNoSignature()) flags |= rpm::RpmDb::RPMINST_NOSIGNATURE;
+ if (p->installOnly()) flags |= rpm::RPMINST_NOUPGRADE;
+ if (policy_r.dryRun()) flags |= rpm::RPMINST_TEST;
+ if (policy_r.rpmExcludeDocs()) flags |= rpm::RPMINST_EXCLUDEDOCS;
+ if (policy_r.rpmNoSignature()) flags |= rpm::RPMINST_NOSIGNATURE;
try
{
@@ -778,8 +778,8 @@
RpmRemovePackageReceiver progress( it->resolvable() );
progress.connect();
- unsigned flags = rpm::RpmDb::RPMINST_NODEPS;
- if (policy_r.dryRun()) flags |= rpm::RpmDb::RPMINST_TEST;
+ rpm::RpmInstFlags flags( rpm::RPMINST_NODEPS );
+ if (policy_r.dryRun()) flags |= rpm::RPMINST_TEST;
try
{
rpm().removePackage( p, flags );
Modified: trunk/libzypp/zypp/target/rpm/RpmDb.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmDb.cc?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmDb.cc (original)
+++ trunk/libzypp/zypp/target/rpm/RpmDb.cc Mon Aug 11 18:05:22 2008
@@ -1936,7 +1936,7 @@
// METHOD NAME : RpmDb::installPackage
// METHOD TYPE : PMError
//
-void RpmDb::installPackage( const Pathname & filename, unsigned flags )
+void RpmDb::installPackage( const Pathname & filename, RpmInstFlags flags )
{
callback::SendReport<RpmInstallReport> report;
@@ -1966,7 +1966,7 @@
while (true);
}
-void RpmDb::doInstallPackage( const Pathname & filename, unsigned flags, callback::SendReport<RpmInstallReport> & report )
+void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, callback::SendReport<RpmInstallReport> & report )
{
FAILIFNOTINITIALIZED;
CommitLog progresslog;
@@ -2002,7 +2002,7 @@
opts.push_back("--nodigest");
if (flags & RPMINST_NOSIGNATURE)
opts.push_back("--nosignature");
- if (flags & RPMINST_NODOCS)
+ if (flags & RPMINST_EXCLUDEDOCS)
opts.push_back ("--excludedocs");
if (flags & RPMINST_NOSCRIPTS)
opts.push_back ("--noscripts");
@@ -2091,7 +2091,7 @@
// METHOD NAME : RpmDb::removePackage
// METHOD TYPE : PMError
//
-void RpmDb::removePackage( Package::constPtr package, unsigned flags )
+void RpmDb::removePackage( Package::constPtr package, RpmInstFlags flags )
{
// 'rpm -e' does not like epochs
return removePackage( package->name()
@@ -2106,7 +2106,7 @@
// METHOD NAME : RpmDb::removePackage
// METHOD TYPE : PMError
//
-void RpmDb::removePackage( const string & name_r, unsigned flags )
+void RpmDb::removePackage( const string & name_r, RpmInstFlags flags )
{
callback::SendReport<RpmRemoveReport> report;
@@ -2137,7 +2137,7 @@
}
-void RpmDb::doRemovePackage( const string & name_r, unsigned flags, callback::SendReport<RpmRemoveReport> & report )
+void RpmDb::doRemovePackage( const string & name_r, RpmInstFlags flags, callback::SendReport<RpmRemoveReport> & report )
{
FAILIFNOTINITIALIZED;
CommitLog progresslog;
Modified: trunk/libzypp/zypp/target/rpm/RpmDb.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmDb.h?rev=10813&r1=10812&r2=10813&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmDb.h (original)
+++ trunk/libzypp/zypp/target/rpm/RpmDb.h Mon Aug 11 18:05:22 2008
@@ -26,6 +26,7 @@
#include "zypp/Package.h"
#include "zypp/KeyRing.h"
+#include "zypp/target/rpm/RpmFlags.h"
#include "zypp/target/rpm/RpmHeader.h"
#include "zypp/target/rpm/RpmCallbacks.h"
#include "zypp/ZYppCallbacks.h"
@@ -447,27 +448,6 @@
typedef std::setstd::string FileList;
/**
- * Bits representing rpm installation options, useable as or
- * combination
- *
- * @see installPackage(), removePackage()
- * */
- enum RpmInstFlag
- {
- RPMINST_NONE = 0x0000,
- RPMINST_NODOCS = 0x0001,
- RPMINST_NOSCRIPTS = 0x0002,
- RPMINST_FORCE = 0x0004,
- RPMINST_NODEPS = 0x0008,
- RPMINST_IGNORESIZE = 0x0010,
- RPMINST_JUSTDB = 0x0020,
- RPMINST_NODIGEST = 0x0040,
- RPMINST_NOSIGNATURE= 0x0080,
- RPMINST_NOUPGRADE = 0x0100,
- RPMINST_TEST = 0x0200
- };
-
- /**
* checkPackage result
* @see checkPackage
* */
@@ -500,7 +480,7 @@
* \throws RpmException
*
* */
- void installPackage (const Pathname& filename, unsigned flags = 0 );
+ void installPackage ( const Pathname & filename, RpmInstFlags flags = RPMINST_NONE );
/** remove rpm package
*
@@ -512,8 +492,8 @@
* \throws RpmException
*
* */
- void removePackage(const std::string & name_r, unsigned flags = 0);
- void removePackage(Package::constPtr package, unsigned flags = 0);
+ void removePackage( const std::string & name_r, RpmInstFlags flags = RPMINST_NONE );
+ void removePackage( Package::constPtr package, RpmInstFlags flags = RPMINST_NONE );
/**
* get backup dir for rpm config files
@@ -579,8 +559,8 @@
virtual std::ostream & dumpOn( std::ostream & str ) const;
protected:
- void doRemovePackage( const std::string & name_r, unsigned flags, callback::SendReport<RpmRemoveReport> & report );
- void doInstallPackage( const Pathname & filename, unsigned flags, callback::SendReport<RpmInstallReport> & report );
+ void doRemovePackage( const std::string & name_r, RpmInstFlags flags, callback::SendReport<RpmRemoveReport> & report );
+ void doInstallPackage( const Pathname & filename, RpmInstFlags flags, callback::SendReport<RpmInstallReport> & report );
const std::listPackage::Ptr & doGetPackages(callback::SendReport<ScanDBReport> & report);
void doRebuildDatabase(callback::SendReport<RebuildDBReport> & report);
Added: trunk/libzypp/zypp/target/rpm/RpmFlags.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmFlags.h?rev=10813&view=auto
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmFlags.h (added)
+++ trunk/libzypp/zypp/target/rpm/RpmFlags.h Mon Aug 11 18:05:22 2008
@@ -0,0 +1,64 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/target/rpm/RpmFlags.h
+ *
+*/
+#ifndef ZYPP_TARGET_RPM_RPMFLAGS_H
+#define ZYPP_TARGET_RPM_RPMFLAGS_H
+
+#include <iosfwd>
+
+#include "zypp/base/Flags.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace target
+ { /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace rpm
+ { /////////////////////////////////////////////////////////////////
+
+ /**
+ * Bits representing rpm installation options.
+ *
+ * Use \ref RpmInstFlags as a type-safe way of
+ * storing OR-combinations.
+ *
+ * @see RpmDb::installPackage(), RpmDb::removePackage(),
+ */
+ enum RpmInstFlag
+ {
+ RPMINST_NONE = 0x0000,
+ RPMINST_EXCLUDEDOCS= 0x0001,
+ RPMINST_NOSCRIPTS = 0x0002,
+ RPMINST_FORCE = 0x0004,
+ RPMINST_NODEPS = 0x0008,
+ RPMINST_IGNORESIZE = 0x0010,
+ RPMINST_JUSTDB = 0x0020,
+ RPMINST_NODIGEST = 0x0040,
+ RPMINST_NOSIGNATURE= 0x0080,
+ RPMINST_NOUPGRADE = 0x0100,
+ RPMINST_TEST = 0x0200
+ };
+
+ /** \relates RpmInstFlag Type-safe way of storing OR-combinations. */
+ ZYPP_DECLARE_FLAGS_AND_OPERATORS( RpmInstFlags, RpmInstFlag );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace rpm
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+ } // namespace target
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_TARGET_RPM_RPMFLAGS_H
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org