Mailinglist Archive: zypp-devel (115 mails)

< Previous Next >
[zypp-devel] download area at commit
  • From: Duncan Mac-Vicar Prett <dmacvicar@xxxxxxx>
  • Date: Thu, 26 Jul 2007 14:29:56 +0200
  • Message-id: <200707261429.57706.dmacvicar@xxxxxxx>

Some background.

- every media opened can have its own mount point.
- before, every soure kept its media opened while the source obj was in memory
- SourceManager had a method that iterates over all living Sources, changing 
the attach point of their medias. This was used by pkg bindings.

Now:
- Medias are not used till refresh or commit, they are not part of the source, 
and there is not 1:1 repo <-> media access relation.
- There is a function MediaManager::setAttachPrefix(const Pathname) which 
changes the prefix for the future opened medias (not the attached ones).

It means:
- as we dont open the medias till commit, and  MoveDownloadArea() in bindings 
is called just before commit, it should be safe to use just 
MediaManager::setAttachPrefix in the MoveDownloadArea() func. 
- MoveDownLoad area gets /instdir + /var/tmp as parameter. I am not sure if 
MediaManager::setAttachPrefix includes the tmpdir again.

So, if I am correct, all the change needed would be:

#include <zypp/media/MediaManager.h>

YCPValue
PkgModuleFunctions::SourceMoveDownloadArea (const YCPString & path)
{
    try
    {
        y2milestone( "Moving download area of all sources to %s", 
path->value().c_str()) ;
        media::MediaManager manager;
        manager.setAttachPrefix(path->value());
    }
    catch (zypp::Exception & excpt)
    {
        _last_error.setLastError(excpt.asUserString());
        y2error("Pkg::SourceMoveDownloadArea has failed: %s", excpt.msg().c_str() );
        return YCPBoolean(false);
    }

    y2milestone( "Download areas moved");

    return YCPBoolean(true);
}

Comments?

-- 
Duncan Mac-Vicar Prett  
Novell :: SUSE R&D, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups