1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZYppCommitPolicy.h
12 #ifndef ZYPP_ZYPPCOMMITPOLICY_H
13 #define ZYPP_ZYPPCOMMITPOLICY_H
17 #include "zypp/base/PtrTypes.h"
19 #include "zypp/target/rpm/RpmFlags.h"
21 ///////////////////////////////////////////////////////////////////
23 { /////////////////////////////////////////////////////////////////
25 /** Supported commit download policies. */
28 DownloadOnly, //!< Just download all packages to the local cache.
29 //!< Do not install. Implies a dry-run.
30 DownloadInAdvance, //!< First download all packages to the local cache.
31 //!< Then start to install.
32 DownloadInHeaps, //!< Similar to DownloadInAdvance, but try to split
33 //!< the transaction into heaps, where at the end of
34 //!< each heap a consistent system state is reached.
35 DownloadAsNeeded //!< Alternating download and install. Packages are
36 //!< cached just to avid CD/DVD hopping. This is the
37 //!< traditional behaviour.
40 /** \relates DownloadMode Stream output. */
41 std::ostream & operator<<( std::ostream & str, DownloadMode obj );
43 ///////////////////////////////////////////////////////////////////
45 // CLASS NAME : ZYppCommitPolicy
48 class ZYppCommitPolicy
55 /** Restrict commit to media 1.
56 * Fake outstanding YCP fix: Honour restriction to media 1
57 * at installation, but install all remaining packages if
58 * post-boot (called with <tt>mediaNr_r > 1</tt>).
60 ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r );
62 /** Process all media (default) */
63 ZYppCommitPolicy & allMedia()
64 { return restrictToMedia( 0 ); }
66 unsigned restrictToMedia() const;
69 /** Set dry run (default: false).
70 * Dry-run should not change anything on the system, unless
71 * the \ref downloadMode is set to \ref DownloadOnly. In that
72 * case packages are downloaded to the local cache.
74 ZYppCommitPolicy & dryRun( bool yesNo_r );
79 /** Commit download policy to use. (default: \ref DownloadAsNeeded)
80 * \note \ref DownloadOnly also implies a \ref dryRun.
82 ZYppCommitPolicy & downloadMode( DownloadMode val_r );
84 DownloadMode downloadMode() const;
87 /** The default \ref target::rpm::RpmInstFlags. (default: none)*/
88 ZYppCommitPolicy & rpmInstFlags( target::rpm::RpmInstFlags newFlags_r );
90 /** Use rpm option --nosignature (default: false) */
91 ZYppCommitPolicy & rpmNoSignature( bool yesNo_r );
93 /** Use rpm option --excludedocs (default: false) */
94 ZYppCommitPolicy & rpmExcludeDocs( bool yesNo_r );
96 target::rpm::RpmInstFlags rpmInstFlags() const;
98 bool rpmNoSignature() const;
100 bool rpmExcludeDocs() const;
103 /** Kepp pool in sync with the Target databases after commit (default: true) */
104 ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r );
106 bool syncPoolAfterCommit() const;
109 /** Implementation */
112 /** Pointer to data. */
113 RWCOW_pointer<Impl> _pimpl;
115 ///////////////////////////////////////////////////////////////////
117 /** \relates ZYppCommitPolicy Stream output. */
118 std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj );
120 /////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////
123 #endif // ZYPP_ZYPPCOMMITPOLICY_H