19 #include <zypp-core/zyppng/pipelines/Expected> 20 #include <zypp-media/FileCheckException> 21 #include <zypp-media/ng/Provide> 23 #include <zypp/ng/Context> 25 #include <zypp/ng/UserRequest> 33 template <
class Executor,
class OpType >
45 : _context(
std::move(zyppContext) )
55 if ( _checksum.empty() ) {
56 MIL <<
"File " <<
_file <<
" has no checksum available." << std::endl;
57 if ( _report.askUserToAcceptNoDigest(
_file ) ) {
58 MIL <<
"User accepted " <<
_file <<
" with no checksum." << std::endl;
66 return _context->provider()->checksumForFile (
_file, _checksum.type() )
73 if ( (real_checksum != _checksum) )
78 static std::map<std::string,std::string> exceptions;
84 WAR <<
"File " <<
_file <<
" has wrong checksum " << real_checksum <<
" (expected " << _checksum <<
")" << std::endl;
85 if ( !exceptions.empty() && exceptions[real_checksum.checksum()] == _checksum.checksum() )
87 WAR <<
"User accepted " <<
_file <<
" with WRONG CHECKSUM. (remembered)" << std::endl;
90 else if ( _report.askUserToAcceptWrongDigest(
_file, _checksum.checksum(), real_checksum.checksum() ) )
92 WAR <<
"User accepted " <<
_file <<
" with WRONG CHECKSUM." << std::endl;
93 exceptions[real_checksum.checksum()] = _checksum.checksum();
127 using zyppng::operators::operator|;
141 using zyppng::operators::operator|;
MaybeAsyncContextRef< OpType > ZyppContextRefType
std::function< AsyncOpRef< expected< ProvideRes > >ProvideRes &&)> checksumFileChecker(ContextRef zyppCtx, zypp::CheckSum checksum)
A ProvideRes object is a reference counted ownership of a resource in the cache provided by a Provide...
std::string basename() const
Return the last component of this path.
static expected error(ConsParams &&...params)
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
ZyppContextRefType _context
Store and operate on date (time_t).
typename ProvideType::Res ProvideRes
typename ZyppContextType::ProvideType ProvideType
#define ZYPP_ENABLE_LOGIC_BASE(Executor, OpType)
std::conditional_t< isAsync, AsyncOpRef< T >, T > makeReadyResult(T &&result)
static expected success(ConsParams &&...params)
static const ValueType hour
std::shared_ptr< AsyncOp< T > > AsyncOpRef
DigestReportHelper< ZyppContextRefType > _report
static Date now()
Return the current time.
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
expected< void > verifyChecksum(SyncContextRef zyppCtx, zypp::CheckSum checksum, zypp::Pathname file)
typename ProvideType::MediaHandle MediaHandle
std::conditional_t< detail::is_async_op_v< OpType >, ContextRef, SyncContextRef > MaybeAsyncContextRef
typename remove_smart_ptr< T >::type remove_smart_ptr_t
CheckSumWorkflowLogic(ZyppContextRefType zyppContext, zypp::CheckSum &&checksum, zypp::Pathname file)
remove_smart_ptr_t< ZyppContextRefType > ZyppContextType