libzypp 17.32.5
refresh.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#include "refresh.h"
11#include <zypp/ng/Context>
15
16namespace zyppng::repo {
17
18 template<typename ZyppContextRefType>
19 RefreshContext<ZyppContextRefType>::RefreshContext( private_constr_t, ZyppContextRefType &&zyppContext, zypp::RepoInfo &&info, zypp::Pathname &&rawCachePath, zypp::filesystem::TmpDir &&tempDir, zypp::RepoManagerOptions &&opts )
20 : _zyppContext( std::move(zyppContext) )
21 , _repoInfo( std::move(info) )
22 , _rawCachePath( std::move(rawCachePath) )
23 , _tmpDir( std::move(tempDir) )
24 , _repoManagerOptions( std::move(opts) )
25 {}
26
27 template<typename ZyppContextRefType>
29 {
32
33 zypp::Pathname rawCachePath = zypp::rawcache_path_for_repoinfo ( opts, info );
34#if LEGACY(173205)
35 using zypp::PathInfo;
36 L_DBG("1222398") << "rawCachePath " << PathInfo( rawCachePath ) << std::endl;
37#endif
39#if LEGACY(173205)
40 L_DBG("1222398") << "siblinghPath " << PathInfo( tmpdir.path() ) << std::endl;
41#endif
42
43 if( tmpdir.path().empty() ) {
44 return expected<CtxRefType>::error( ZYPP_EXCPT_PTR(zypp::Exception(_("Can't create metadata cache directory."))) );
45 }
46
47 return expected<CtxRefType>::success( std::make_shared<CtxType>( private_constr_t{}
48 , std::move(zyppContext)
49 , std::move(info)
50 , std::move(rawCachePath)
51 , std::move(tmpdir)
52 , std::move(opts)));
53 }
54
55 template<typename ZyppContextRefType>
57 {
58 MIL << "Deleting RefreshContext" << std::endl;
59 }
60
61 template<typename ZyppContextRefType>
63 {
64#if LEGACY(173205)
65 using zypp::PathInfo;
66 L_DBG("1222398") << "PREEX rawCachePath " << PathInfo( _rawCachePath ) << std::endl;
67 L_DBG("1222398") << "PREEX siblinghPath " << PathInfo( _tmpDir.path() ) << std::endl;
68#endif
69 zypp::filesystem::exchange( _tmpDir.path(), _rawCachePath );
70#if LEGACY(173205)
71 L_DBG("1222398") << "PSTEX rawCachePath " << PathInfo( _rawCachePath ) << std::endl;
72 L_DBG("1222398") << "PSTEX siblinghPath " << PathInfo( _tmpDir.path() ) << std::endl;
73#endif
74 }
75
76 template<typename ZyppContextRefType>
78 {
79 return _rawCachePath;
80 }
81
82 template<typename ZyppContextRefType>
84 {
85 return _tmpDir.path();
86 }
87
88 template<typename ZyppContextRefType>
89 const ZyppContextRefType &RefreshContext<ZyppContextRefType>::zyppContext() const
90 {
91 return _zyppContext;
92 }
93
94 template<typename ZyppContextRefType>
96 {
97 return _repoInfo;
98 }
99
100 template<typename ZyppContextRefType>
105
106 template<typename ZyppContextRefType>
108 {
109 return _repoManagerOptions;
110 }
111
112 template<typename ZyppContextRefType>
117
118 template<typename ZyppContextRefType>
123
124 template<typename ZyppContextRefType>
125 const std::optional<typename RefreshContext<ZyppContextRefType>::PluginRepoverification> &RefreshContext<ZyppContextRefType>::pluginRepoverification() const
126 {
127 return _pluginRepoverification;
128 }
129
130 template<typename ZyppContextRefType>
132 {
133 if ( _probedType && *_probedType == rType )
134 return;
135
136 _probedType = rType;
137 _sigProbedTypeChanged.emit(rType);
138 }
139
140 template<typename ZyppContextRefType>
141 const std::optional<zypp::repo::RepoType> &RefreshContext<ZyppContextRefType>::probedType() const
142 {
143 return _probedType;
144 }
145
146 template<typename ZyppContextRefType>
151
152
153 // explicitely intantiate the template types we want to work with
154 template class RefreshContext<SyncContextRef>;
155 template class RefreshContext<ContextRef>;
156
157}
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition AutoDispose.h:95
Base class for Exception.
Definition Exception.h:147
What is known about a repository.
Definition RepoInfo.h:72
Wrapper class for stat/lstat.
Definition PathInfo.h:222
Provide a new empty temporary directory and recursively delete it when no longer needed.
Definition TmpPath.h:182
static TmpDir makeSibling(const Pathname &sibling_r)
Provide a new empty temporary directory as sibling.
Definition TmpPath.cc:301
Definition Arch.h:364
int exchange(const Pathname &lpath, const Pathname &rpath)
Exchanges two files or directories.
Definition PathInfo.cc:757
Pathname rawcache_path_for_repoinfo(const RepoManagerOptions &opt, const RepoInfo &info)
Calculates the raw cache path for a repository, this is usually /var/cache/zypp/alias.
RawMetadataRefreshPolicy
Definition refresh.h:31
ZyppContextRefType _zyppContext
Repo manager settings.
Repository type enumeration.
Definition RepoType.h:28
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
Definition Exception.h:433
#define _(MSG)
Definition Gettext.h:37
#define MIL
Definition Logger.h:96
#define L_DBG(GROUP)
Definition Logger.h:104