Imported Upstream version 17.17.0
[platform/upstream/libzypp.git] / zypp / PurgeKernels.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/PurgeKernels.h
10  *
11 */
12
13 #include <zypp/PoolItem.h>
14 #include <zypp/base/PtrTypes.h>
15
16 namespace zypp {
17
18   namespace str {
19   class regex;
20   }
21
22   /*!
23    * Implements the logic of the "purge-kernels" command.
24    *
25    */
26   class PurgeKernels
27   {
28   public:
29     PurgeKernels();
30
31
32     /*!
33      * Marks all currently obsolete Kernels according to the keep spec.
34      * \note This will not commit the changes
35      */
36     void markObsoleteKernels();
37
38     /*!
39      * Force a specific uname to be set, only used for testing,
40      * in production the running kernel is detected.
41      */
42     void setUnameR( const std::string &val );
43     std::string unameR() const;
44
45
46     /*!
47      * Force a specific kernel arch to be set, only used for testing,
48      * in production the running kernel arch is detected.
49      */
50     void setKernelArch( const zypp::Arch &arch );
51     Arch kernelArch() const;
52
53     /*!
54        * Overrides the keep spec, the default value is read from ZConfig.
55        * The keep spec is a string of tokens seperated by ",".
56        * It only supports 3 different tokens:
57        *  - "running" matches only the currently running kernel of the system
58        *  - "oldest"  matches the kernel version for each flavour/arch combination with the lowest edition
59        *              can be modified with a positive number:  oldest+n
60        *  - "latest"  matches the kernel version for each flavour/arch combination with the highest edition
61        *              can be modified with a negative number:  latest-n
62        */
63     void setKeepSpec( const std::string &val );
64     std::string keepSpec () const;
65
66     struct Impl;
67   private:
68     RW_pointer<Impl> _pimpl;
69   };
70
71 }
72