21 #include <zypp-core/ng/pipelines/Expected> 22 #include <zypp-media/FileCheckException> 24 #include <zypp/ng/UserRequest> 41 : _context(
std::move(zyppContext) )
51 if ( _checksum.empty() ) {
52 MIL <<
"File " <<
_file <<
" has no checksum available." << std::endl;
54 MIL <<
"User accepted " <<
_file <<
" with no checksum." << std::endl;
62 return _context->provider()->checksumForFile (
_file, _checksum.type() )
69 if ( (real_checksum != _checksum) )
74 static std::map<std::string,std::string> exceptions;
80 WAR <<
"File " <<
_file <<
" has wrong checksum " << real_checksum <<
" (expected " << _checksum <<
")" << std::endl;
81 if ( !exceptions.empty() && exceptions[real_checksum.checksum()] == _checksum.checksum() )
83 WAR <<
"User accepted " <<
_file <<
" with WRONG CHECKSUM. (remembered)" << std::endl;
86 else if (
_report.askUserToAcceptWrongDigest(
_file, _checksum.checksum(), real_checksum.checksum() ) )
88 WAR <<
"User accepted " <<
_file <<
" with WRONG CHECKSUM." << std::endl;
89 exceptions[real_checksum.checksum()] = _checksum.checksum();
114 zypp_co_return zypp_co_await( impl.
execute() );
119 using zyppng::operators::operator|;
typename ProvideType::Res ProvideRes
typename ProvideType::MediaHandle MediaHandle
typename Context::ProvideType ProvideType
std::function< MaybeAwaitable< expected< ProvideRes > >ProvideRes &&)> checksumFileChecker(ContextRef zyppCtx, zypp::CheckSum checksum)
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.
Store and operate on date (time_t).
std::unique_ptr< ReportType > _report
static expected success(ConsParams &&...params)
MaybeAwaitable< expected< void > > verifyChecksum(ContextRef zyppCtx, zypp::CheckSum checksum, zypp::filesystem::Pathname file)
static const ValueType hour
static Date now()
Return the current time.
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
DigestReportHelper _report
CheckSumWorkflowLogic(ContextRef zyppContext, zypp::CheckSum &&checksum, zypp::Pathname file)