Deprecate MediaAccess::downloads (accidentally deleted)
[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/target/rpm/RpmFlags.h"
20
21 ///////////////////////////////////////////////////////////////////
22 namespace zypp
23 { /////////////////////////////////////////////////////////////////
24
25   /** Supported commit download policies. */
26   enum DownloadMode
27   {
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.
38   };
39
40   /** \relates DownloadMode Stream output. */
41   std::ostream & operator<<( std::ostream & str, DownloadMode obj );
42
43   ///////////////////////////////////////////////////////////////////
44   //
45   //    CLASS NAME : ZYppCommitPolicy
46   //
47   /** */
48   class ZYppCommitPolicy
49   {
50     public:
51
52       ZYppCommitPolicy();
53
54     public:
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 &gt; 1</tt>).
59        */
60       ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r );
61
62       /** Process all media (default) */
63       ZYppCommitPolicy & allMedia()
64       { return restrictToMedia( 0 ); }
65
66       unsigned restrictToMedia() const;
67
68
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.
73       */
74       ZYppCommitPolicy & dryRun( bool yesNo_r );
75
76       bool dryRun() const;
77
78
79       /** Commit download policy to use. (default: \ref DownloadAsNeeded)
80        *  \note \ref DownloadOnly also implies a \ref dryRun.
81        */
82       ZYppCommitPolicy & downloadMode( DownloadMode val_r );
83
84       DownloadMode downloadMode() const;
85
86
87       /** The default \ref target::rpm::RpmInstFlags. (default: none)*/
88       ZYppCommitPolicy &  rpmInstFlags( target::rpm::RpmInstFlags newFlags_r );
89
90       /** Use rpm option --nosignature (default: false) */
91       ZYppCommitPolicy & rpmNoSignature( bool yesNo_r );
92
93       /** Use rpm option --excludedocs (default: false) */
94       ZYppCommitPolicy & rpmExcludeDocs( bool yesNo_r );
95
96       target::rpm::RpmInstFlags rpmInstFlags() const;
97
98       bool rpmNoSignature() const;
99
100       bool rpmExcludeDocs() const;
101
102
103       /** Kepp pool in sync with the Target databases after commit (default: true) */
104       ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r );
105
106       bool syncPoolAfterCommit() const;
107
108     public:
109       /** Implementation  */
110       class Impl;
111     private:
112       /** Pointer to data. */
113       RWCOW_pointer<Impl> _pimpl;
114   };
115   ///////////////////////////////////////////////////////////////////
116
117   /** \relates ZYppCommitPolicy Stream output. */
118   std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj );
119
120   /////////////////////////////////////////////////////////////////
121 } // namespace zypp
122 ///////////////////////////////////////////////////////////////////
123 #endif // ZYPP_ZYPPCOMMITPOLICY_H