libzypp 17.38.6
filesystem.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8----------------------------------------------------------------------*/
9#include "filesystem.h"
10
15
16#include <zypp/ng/sat/pool.h>
17
19
20 namespace {
21 const zypp::Pathname & sysconfigStoragePath()
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 {
36 static zypp::WatchFile sysconfigFile( sysconfigStoragePath(), zypp::WatchFile::NO_INIT );
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 {
46 {
47 _requiredFilesystems = std::set<std::string>();
48 std::set<std::string> & requiredFilesystems( *_requiredFilesystems );
49 zypp::str::split( zypp::base::sysconfig::read( sysconfigStoragePath() )["USED_FS_LIST"],
50 std::inserter( requiredFilesystems, requiredFilesystems.end() ) );
51 }
53 }
54
55
56} // namespace zyppng::sat
Access to the sat-pools string space.
Definition IdString.h:55
Remember a files attributes to detect content changes.
Definition watchfile.h:50
bool hasChanged()
Definition watchfile.h:80
Orchestrator for a libsolv pool instance.
Definition pool.h:37
void checkDirty(Pool &pool) override
checkDirty
Definition filesystem.cc:34
std::optional< std::set< std::string > > _requiredFilesystems
filesystems mentioned in /etc/sysconfig/storage, mutable for lazy init
Definition filesystem.h:40
const std::set< std::string > & requiredFilesystems() const
Definition filesystem.cc: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
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", const Trim trim_r=NO_TRIM)
Split line_r into words.
Definition String.h:602
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
Definition Patch.cc:122
zypp::sat::detail::IdType IdType
@ Data
Structural or data change (e.g., Rootfs, Arch, or Repo content).