Dont mark failed patch scripts as installed.
[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 ///////////////////////////////////////////////////////////////////
18 namespace zypp
19 { /////////////////////////////////////////////////////////////////
20
21   ///////////////////////////////////////////////////////////////////
22   //
23   //    CLASS NAME : ZYppCommitPolicy
24   //
25   /** */
26   class ZYppCommitPolicy
27   {
28   public:
29     ZYppCommitPolicy()
30     : _restrictToMedia    ( 0 )
31     , _dryRun             ( false )
32     , _rpmNoSignature     ( false )
33     , _syncPoolAfterCommit( true )
34     {}
35
36   public:
37     unsigned restrictToMedia() const
38     { return _restrictToMedia; }
39
40     bool dryRun() const
41     { return _dryRun; }
42
43     bool rpmNoSignature() const
44     { return _rpmNoSignature; }
45
46     bool syncPoolAfterCommit() const
47     { return _syncPoolAfterCommit; }
48
49   public:
50     /** Restrict commit to media 1.
51      * Fake outstanding YCP fix: Honour restriction to media 1
52      * at installation, but install all remaining packages if
53      * post-boot (called with <tt>mediaNr_r &gt; 1</tt>).
54      */
55     ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r )
56     { _restrictToMedia = ( mediaNr_r == 1 ) ? 1 : 0; return *this; }
57
58     /** Process all media (default) */
59     ZYppCommitPolicy & allMedia()
60     { return restrictToMedia( 0 ); }
61
62     /** Set dry run (default: false) */
63     ZYppCommitPolicy & dryRun( bool yesNo_r = true )
64     { _dryRun = yesNo_r; return *this; }
65
66     /** Use rpm option --nosignature (default: false) */
67     ZYppCommitPolicy & rpmNoSignature( bool yesNo_r = true )
68     { _rpmNoSignature = yesNo_r; return *this; }
69
70     /** Kepp pool in sync with the Target databases after commit (default: true) */
71     ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r = true )
72     { _syncPoolAfterCommit = yesNo_r; return *this; }
73
74   private:
75     unsigned _restrictToMedia;
76     bool     _dryRun;
77     bool     _rpmNoSignature;
78     bool     _syncPoolAfterCommit;
79   };
80   ///////////////////////////////////////////////////////////////////
81
82   /** \relates ZYppCommitPolicy Stream output. */
83   std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj );
84
85   /////////////////////////////////////////////////////////////////
86 } // namespace zypp
87 ///////////////////////////////////////////////////////////////////
88 #endif // ZYPP_ZYPPCOMMITPOLICY_H