Merge pull request #23 from openSUSE/drop_package_manager
[platform/upstream/libzypp.git] / zypp / ZYppCommitPolicy.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ZYppCommitPolicy.h
10  *
11 */
12 #ifndef ZYPP_ZYPPCOMMITPOLICY_H
13 #define ZYPP_ZYPPCOMMITPOLICY_H
14
15 #include <iosfwd>
16
17 #include "zypp/base/PtrTypes.h"
18
19 #include "zypp/DownloadMode.h"
20 #include "zypp/target/rpm/RpmFlags.h"
21
22 ///////////////////////////////////////////////////////////////////
23 namespace zypp
24 { /////////////////////////////////////////////////////////////////
25
26   ///////////////////////////////////////////////////////////////////
27   //
28   //    CLASS NAME : ZYppCommitPolicy
29   //
30   /** Options and policies for ZYpp::commit.
31    * \see \ref ZYpp::commit
32    */
33   class ZYppCommitPolicy
34   {
35     public:
36
37       ZYppCommitPolicy();
38
39     public:
40       /** Restrict commit to media 1.
41        * Fake outstanding YCP fix: Honour restriction to media 1
42        * at installation, but install all remaining packages if
43        * post-boot (called with <tt>mediaNr_r &gt; 1</tt>).
44        */
45       ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r );
46
47       /** Process all media (default) */
48       ZYppCommitPolicy & allMedia()
49       { return restrictToMedia( 0 ); }
50
51       unsigned restrictToMedia() const;
52
53
54       /** Set dry run (default: false).
55        * Dry-run should not change anything on the system, unless
56        * the \ref downloadMode is set to \ref DownloadOnly. In that
57        * case packages are downloaded to the local cache.
58       */
59       ZYppCommitPolicy & dryRun( bool yesNo_r );
60
61       bool dryRun() const;
62
63
64       /** Commit download policy to use. (default: \ref DownloadDefault)
65        *  \note \ref DownloadOnly also implies a \ref dryRun.
66        */
67       ZYppCommitPolicy & downloadMode( DownloadMode val_r );
68
69       DownloadMode downloadMode() const;
70
71
72       /** The default \ref target::rpm::RpmInstFlags. (default: none)*/
73       ZYppCommitPolicy &  rpmInstFlags( target::rpm::RpmInstFlags newFlags_r );
74
75       /** Use rpm option --nosignature (default: false) */
76       ZYppCommitPolicy & rpmNoSignature( bool yesNo_r );
77
78       /** Use rpm option --excludedocs (default: false) */
79       ZYppCommitPolicy & rpmExcludeDocs( bool yesNo_r );
80
81       target::rpm::RpmInstFlags rpmInstFlags() const;
82
83       bool rpmNoSignature() const;
84
85       bool rpmExcludeDocs() const;
86
87
88       /** Kepp pool in sync with the Target databases after commit (default: true) */
89       ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r );
90
91       bool syncPoolAfterCommit() const;
92
93     public:
94       /** Implementation  */
95       class Impl;
96     private:
97       /** Pointer to data. */
98       RWCOW_pointer<Impl> _pimpl;
99   };
100   ///////////////////////////////////////////////////////////////////
101
102   /** \relates ZYppCommitPolicy Stream output. */
103   std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj );
104
105   /////////////////////////////////////////////////////////////////
106 } // namespace zypp
107 ///////////////////////////////////////////////////////////////////
108 #endif // ZYPP_ZYPPCOMMITPOLICY_H