DeltaCandidates::~DeltaCandidates()
{}
- std::list<PatchRpm> DeltaCandidates::patchRpms(const Package::constPtr & package ) const
- {
- std::list<PatchRpm> candidates;
-
- // query all repos
- for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
- it != _pimpl->repos.end();
- ++it )
- {
- // all delta in repo
- #warning patchRpms are not implemented
- std::list<PatchRpm> candidates_in_repo; // = (*it).patchRpms();
- for ( std::list<PatchRpm>::const_iterator dit = candidates_in_repo.begin();
- dit != candidates_in_repo.end();
- ++dit )
- {
- if ( ! package
- || ( package->name() == dit->name()
- && package->edition() == dit->edition()
- && package->arch() == dit->arch() ) )
- {
- candidates.push_back( *dit );
- }
- }
- }
- return candidates;
- }
-
std::list<DeltaRpm> DeltaCandidates::deltaRpms(const Package::constPtr & package) const
{
std::list<DeltaRpm> candidates;
/** Dtor */
~DeltaCandidates();
-
- std::list<packagedelta::PatchRpm> patchRpms(const Package::constPtr & package) const;
std::list<packagedelta::DeltaRpm> deltaRpms(const Package::constPtr & package) const;
private:
{ /////////////////////////////////////////////////////////////////
- std::ostream & operator<<( std::ostream & str, const PatchRpm & obj )
- {
- str
- << "PatchRpm[" << obj.name() << "-" << obj.edition() << "." << obj.arch()
- << "](" << obj.location()
- << '|' << obj.buildtime()
- << '|';
- return dumpRangeLine( str, obj.baseversions().begin(), obj.baseversions().end() )
- << ')';
- }
-
DeltaRpm::DeltaRpm(const Repository & repo, sat::detail::IdType extraid)
: _repo(repo)
{
namespace packagedelta
{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
-
- /** \todo cheap copy! (switch to RWCOW) */
- class PatchRpm
- {
- public:
- typedef Edition BaseVersion;
- typedef std::list<BaseVersion> BaseVersions;
-
- public:
- PatchRpm()
- {}
-
- public:
- /** \name Target package ident. */
- //@{
- const std::string & name() const { return _name; }
- const Edition & edition() const { return _edition; }
- const Arch & arch() const { return _arch; }
- //@}
- const OnMediaLocation & location() const { return _location; }
- const BaseVersions & baseversions() const { return _baseversions; }
- const Date & buildtime() const { return _buildtime;}
-
- public:
- PatchRpm & setName( const std::string & val_r ) { _name = val_r; return *this; }
- PatchRpm & setEdition( const Edition & val_r ) { _edition = val_r; return *this; }
- PatchRpm & setArch( const Arch & val_r ) { _arch = val_r; return *this; }
- PatchRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
- PatchRpm & setBaseversions( const BaseVersions & val_r ){ _baseversions = val_r; return *this; }
- PatchRpm & addBaseversion( const BaseVersion & val_r ) { _baseversions.push_back( val_r ); return *this; }
- PatchRpm & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
-
- private:
- std::string _name;
- Edition _edition;
- Arch _arch;
- OnMediaLocation _location;
- BaseVersions _baseversions;
- Date _buildtime;
- };
-
- /** \relates PatchRpm Stream output. */
- std::ostream & operator<<( std::ostream & str, const PatchRpm & obj );
-
- ///////////////////////////////////////////////////////////////////
/** \todo cheap copy! (switch to RWCOW) */
class DeltaRpm
_deltas.deltaRpms( _package ).swap( deltaRpms );
}
- std::list<PatchRpm> patchRpms;
-#warning cleanup patchrpm
-#if 0
- if ( ZConfig::instance().download_use_patchrpm() )
- {
- _deltas.patchRpms( _package ).swap( patchRpms );
- }
-#endif
-
- if ( ! ( deltaRpms.empty() && patchRpms.empty() )
+ if ( ! ( deltaRpms.empty() )
&& queryInstalled() )
{
if ( ! deltaRpms.empty() && applydeltarpm::haveApplydeltarpm() )
return ret;
}
}
-
- if ( ! patchRpms.empty() )
- {
- for( std::list<PatchRpm>::const_iterator it = patchRpms.begin();
- it != patchRpms.end(); ++it )
- {
- DBG << "tryPatch " << *it << endl;
- ManagedFile ret( tryPatch( *it ) );
- if ( ! ret->empty() )
- return ret;
- }
- }
- }
- }
- else
- {
- // allow patch rpm from local source
- std::list<PatchRpm> patchRpms;
-#warning cleanup patchrpm
-#if 0
- if ( ZConfig::instance().download_use_patchrpm() )
- {
- _deltas.patchRpms( _package ).swap( patchRpms );
- }
-#endif
-
- if ( ! patchRpms.empty() && queryInstalled() )
- {
- for( std::list<PatchRpm>::const_iterator it = patchRpms.begin();
- it != patchRpms.end(); ++it )
- {
- DBG << "tryPatch " << *it << endl;
- ManagedFile ret( tryPatch( *it ) );
- if ( ! ret->empty() )
- return ret;
- }
}
}
return ManagedFile( destination, filesystem::unlink );
}
- ManagedFile PackageProvider::tryPatch( const PatchRpm & patch_r ) const
- {
- // installed edition is in baseversions?
- const PatchRpm::BaseVersions & baseversions( patch_r.baseversions() );
-
- if ( std::find_if( baseversions.begin(), baseversions.end(),
- bind( &PackageProvider::queryInstalled, this, _1 ) )
- == baseversions.end() )
- return ManagedFile();
-
- report()->startPatchDownload( patch_r.location().filename(),
- patch_r.location().downloadSize() );
- ManagedFile patch;
- try
- {
- ProvideFilePolicy policy;
- policy.progressCB( bind( &PackageProvider::progressPatchDownload, this, _1 ) );
- patch = _access.provideFile( _package->repoInfo(), patch_r.location(), policy );
- }
- catch ( const Exception & excpt )
- {
- report()->problemPatchDownload( excpt.asUserString() );
- return ManagedFile();
- }
- report()->finishPatchDownload();
-
- return patch;
- }
-
PackageProvider::ScopedGuard PackageProvider::newReport() const
{
_report.reset( new Report );
void PackageProvider::progressDeltaApply( int value ) const
{ return report()->progressDeltaApply( value ); }
- bool PackageProvider::progressPatchDownload( int value ) const
- { return report()->progressPatchDownload( value ); }
-
bool PackageProvider::progressPackageDownload( int value ) const
{ return report()->progress( value, _package ); }
// CLASS NAME : PackageProvider
//
/** Provide a package from a Source.
- * Use available delta/patch-rpm if apropriate.
+ * Use available deltarpm if apropriate.
*/
class PackageProvider : private base::NonCopyable
{
typedef callback::SendReport<repo::DownloadResolvableReport> Report;
typedef packagedelta::DeltaRpm DeltaRpm;
- typedef packagedelta::PatchRpm PatchRpm;
-
public:
/** Ctor taking the Package to provide. */
private:
ManagedFile doProvidePackage() const;
ManagedFile tryDelta( const DeltaRpm & delta_r ) const;
- ManagedFile tryPatch( const PatchRpm & patch_r ) const;
private:
ScopedGuard newReport() const;
Report & report() const;
bool progressDeltaDownload( int value ) const;
void progressDeltaApply( int value ) const;
- bool progressPatchDownload( int value ) const;
bool progressPackageDownload( int value ) const;
bool failOnChecksumError() const;
bool queryInstalled( const Edition & ed_r = Edition() ) const;