Mailinglist Archive: zypp-devel (116 mails)
| < Previous | Next > |
[zypp-devel] milestone success!
- From: Duncan Mac-Vicar <dmacvicar@xxxxxxx>
- Date: Tue, 12 Jun 2007 23:37:33 +0200
- Message-id: <200706122337.34413.dmacvicar@xxxxxxx>
Today, Jano had zypper in a state where the package installation was almost
working, except for the fact that the commit try to download the package from
the Source class.
Tonight, after modfying the commit code, I was able to install a package with
zypper.
Summary:
<install> [S0:0][package]kopete-floor-0.1.0-17.1.x86_64
Continue? [y/n] y
Downloading: [S0:0][package]kopete-floor-0.1.0-17.1.x86_64, -1 B(-1 B
unpacked)
Installing: [S0:0][package]kopete-floor-0.1.0-17.1.x86_64
duncan@tarro:/space/suse/build/zypper/src>
duncan@tarro:/space/suse/build/zypper/src> rpm -q kopete-floor
kopete-floor-0.1.0-17.1
Some notes:
- The commit modifications are a real hack, I mean, it tries to download using
the first url available only (no AI), and it wont work with patch and deltas
because I did not port that part. PackageProvider and SourceProvideFile code
is scary and hard to understand and follow. Can we make that simpler?
- I had to ignore 25 dependency problems, because the target for some reason
is not added to the pool, so nobody provides any of the requirements.
Attached, the hack for zypp commit (not commited to svn as it touches the real
working commit)
--
Duncan Mac-Vicar Prett
Novell :: SUSE R&D, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
Index: zypp/source/SourceProvideFile.h
===================================================================
--- zypp/source/SourceProvideFile.h (revision 5737)
+++ zypp/source/SourceProvideFile.h (working copy)
@@ -42,7 +42,7 @@
*
* \throws Exception
*/
- ManagedFile provideFile( Source_Ref source_r,
+ ManagedFile provideFile( const Url &url,
const OnMediaLocation & loc_r,
const ProvideFilePolicy & policy_r = ProvideFilePolicy() );
Index: zypp/source/PackageProvider.cc
===================================================================
--- zypp/source/PackageProvider.cc (revision 5737)
+++ zypp/source/PackageProvider.cc (working copy)
@@ -21,7 +21,12 @@
#include "zypp/source/PackageDelta.h"
#include "zypp/detail/ImplConnect.h"
+#include "zypp/RepoInfo.h"
+#include "zypp/Repository.h"
+#include "zypp/media/MediaManager.h"
+
using std::endl;
+using zypp::media::MediaManager;
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -77,12 +82,20 @@
ManagedFile PackageProvider::providePackage() const
{
+ Url url;
+ RepoInfo info = _package->repository().info();
+ // FIXME we only support the first url for now.
+ if ( info.baseUrls().empty() )
+ ZYPP_THROW(Exception("No url in repository."));
+ else
+ url = * info.baseUrls().begin();
+
MIL << "provide Package " << _package << endl;
ScopedGuard guardReport( newReport() );
ManagedFile ret;
do {
_retry = false;
- report()->start( _package, _package->source().url() );
+ report()->start( _package, url );
try // ELIMINATE try/catch by providing a log-guard
{
ret = doProvidePackage();
@@ -104,8 +117,16 @@
ManagedFile PackageProvider::doProvidePackage() const
{
+ Url url;
+ RepoInfo info = _package->repository().info();
+ // FIXME we only support the first url for now.
+ if ( info.baseUrls().empty() )
+ ZYPP_THROW(Exception("No url in repository."));
+ else
+ url = * info.baseUrls().begin();
+
// check whether to process patch/delta rpms
- if ( _package->source().remote() )
+ if ( MediaManager::downloads(url) )
{
std::list<DeltaRpm> deltaRpms( _implPtr->deltaRpms() );
std::list<PatchRpm> patchRpms( _implPtr->patchRpms() );
@@ -158,7 +179,7 @@
// no patch/delta -> provide full package
ManagedFile ret;
OnMediaLocation loc;
- loc.medianr( _package->sourceMediaNr() )
+ loc.medianr( _package->mediaNr() )
.filename( _package->location() )
.checksum( _package->checksum() )
.downloadsize( _package->archivesize() );
@@ -167,7 +188,7 @@
policy.progressCB( bind( &PackageProvider::progressPackageDownload, this, _1 ) );
policy.failOnChecksumErrorCB( bind( &PackageProvider::failOnChecksumError, this ) );
- return source::provideFile( _package->source(), loc, policy );
+ return source::provideFile( url, loc, policy );
}
ManagedFile PackageProvider::tryDelta( const DeltaRpm & delta_r ) const
@@ -186,7 +207,7 @@
{
ProvideFilePolicy policy;
policy.progressCB( bind( &PackageProvider::progressDeltaDownload, this, _1 ) );
- delta = source::provideFile( _package->source(), delta_r.location(), policy );
+ delta = source::provideFile( Url(), delta_r.location(), policy );
}
catch ( const Exception & excpt )
{
@@ -236,7 +257,7 @@
{
ProvideFilePolicy policy;
policy.progressCB( bind( &PackageProvider::progressPatchDownload, this, _1 ) );
- patch = source::provideFile( _package->source(), patch_r.location(), policy );
+ patch = source::provideFile( Url(), patch_r.location(), policy );
}
catch ( const Exception & excpt )
{
Index: zypp/source/SourceProvideFile.cc
===================================================================
--- zypp/source/SourceProvideFile.cc (revision 5737)
+++ zypp/source/SourceProvideFile.cc (working copy)
@@ -16,6 +16,7 @@
#include "zypp/source/SourceProvideFile.h"
#include "zypp/ZYppCallbacks.h"
+#include "zypp/MediaSetAccess.h"
using std::endl;
@@ -57,25 +58,25 @@
*/
struct SourceReleaseFile
{
- SourceReleaseFile( Source_Ref source_r, const Pathname & location_r, unsigned mediaNr_r )
- : _source( source_r ), _location( location_r ), _medianr( mediaNr_r )
- {}
+ SourceReleaseFile( const Url &url, const Pathname & location_r, unsigned mediaNr_r )
+ : _url(url), _location( location_r ), _medianr( mediaNr_r )
+ {}
- void operator()( const Pathname & /*UNUSED*/ )
- {
- _source.releaseFile( _location, _medianr );
- }
+ void operator()( const Pathname & /*UNUSED*/ )
+ {
+ //_source.releaseFile( _location, _medianr );
+ }
- Source_Ref _source;
- Pathname _location;
- unsigned _medianr;
+ Url _url;
+ Pathname _location;
+ unsigned _medianr;
};
/////////////////////////////////////////////////////////////////
} // namespace
///////////////////////////////////////////////////////////////////
- ManagedFile provideFile( Source_Ref source_r,
+ ManagedFile provideFile( const Url &url,
const OnMediaLocation & loc_r,
const ProvideFilePolicy & policy_r )
{
@@ -88,10 +89,11 @@
ref( policy_r ), _1 );
callback::TempConnect<source::SourceReport> temp( dumb );
+ MediaSetAccess access(url);
+
+ ManagedFile ret( access.provideFile(loc_r),
+ SourceReleaseFile( url, loc_r.filename(), loc_r.medianr() ) );
- ManagedFile ret( source_r.provideFile( loc_r.filename(), loc_r.medianr() ),
- SourceReleaseFile( source_r, loc_r.filename(), loc_r.medianr() ) );
-
if ( loc_r.checksum().empty() )
{
// no checksum in metadata
| < Previous | Next > |