libzypp  17.38.7
filesystem.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 ----------------------------------------------------------------------*/
9 #include "filesystem.h"
10 
12 #include <zypp-core/base/String.h>
14 #include <zypp-core/fs/watchfile.h>
15 
16 #include <zypp/ng/sat/pool.h>
17 
19 
20  namespace {
22  {
23  static const zypp::Pathname _val( "/etc/sysconfig/storage" );
24  return _val;
25  }
26  }
27 
29  {
30  const auto &req = requiredFilesystems ();
31  return req.count( zypp::IdString(value).asString() ) > 0;
32  }
33 
35  {
37  if ( _requiredFilesystems && sysconfigFile.hasChanged() ) {
38  _requiredFilesystems.reset(); // recreated on demand
39  pool.setDirty( PoolInvalidation::Data, { "/etc/sysconfig/storage change" } );
40  }
41  }
42 
43  const std::set<std::string> & FilesystemNamespaceProvider::requiredFilesystems() const
44  {
45  if ( !_requiredFilesystems )
46  {
47  _requiredFilesystems = std::set<std::string>();
48  std::set<std::string> & requiredFilesystems( *_requiredFilesystems );
50  std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
51  }
52  return *_requiredFilesystems;
53  }
54 
55 
56 } // namespace zyppng::sat
const Pathname & sysconfigStoragePath()
Definition: PoolImpl.cc:108
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
Definition: Patch.cc:122
bool hasChanged()
Definition: watchfile.h:80
Access to the sat-pools string space.
Definition: IdString.h:51
Orchestrator for a libsolv pool instance.
Definition: pool.h:36
Remember a files attributes to detect content changes.
Definition: watchfile.h:49
Structural or data change (e.g., Rootfs, Arch, or Repo content).
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \, const Trim trim_r=NO_TRIM)
Split line_r into words.
Definition: String.h:602
void setDirty(PoolInvalidation invalidation, std::initializer_list< std::string_view > reasons)
Invalidate everything.
Definition: pool.cc:152
const std::set< std::string > & requiredFilesystems() const
Definition: filesystem.cc:43
zypp::sat::detail::IdType IdType
Definition: poolconstants.h:43
bool isSatisfied(detail::IdType value) const override
Check if a specific value satisfies this namespace condition.
Definition: filesystem.cc:28
std::map< std::string, std::string > read(const Pathname &_path)
Read sysconfig file path_r and return (key,valye) pairs.
Definition: sysconfig.cc:34
std::optional< std::set< std::string > > _requiredFilesystems
filesystems mentioned in /etc/sysconfig/storage, mutable for lazy init
Definition: filesystem.h:40
void checkDirty(Pool &pool) override
checkDirty
Definition: filesystem.cc:34