Author: jreidinger Date: Fri May 2 16:31:18 2008 New Revision: 9940 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9940&view=rev Log: release file after copy to cache as soon as possible. (bnc #381311) Modified: trunk/libzypp/zypp/Fetcher.cc trunk/libzypp/zypp/MediaSetAccess.cc trunk/libzypp/zypp/MediaSetAccess.h Modified: trunk/libzypp/zypp/Fetcher.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Fetcher.cc?rev=9940&r1=9939&r2=9940&view=diff ============================================================================== --- trunk/libzypp/zypp/Fetcher.cc (original) +++ trunk/libzypp/zypp/Fetcher.cc Fri May 2 16:31:18 2008 @@ -208,7 +208,7 @@ ZYPP_THROW( Exception("Can't copy " + tmp_file.asString() + " to " + dest_dir.asString())); } - + media.releaseFile((*it_res)->location); //not needed anymore, only eat space } catch (Exception & excpt_r) { Modified: trunk/libzypp/zypp/MediaSetAccess.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/MediaSetAccess.cc?rev=9940&r1=9939&r2=9940&view=diff ============================================================================== --- trunk/libzypp/zypp/MediaSetAccess.cc (original) +++ trunk/libzypp/zypp/MediaSetAccess.cc Fri May 2 16:31:18 2008 @@ -79,6 +79,25 @@ // report->finish( file_url, source::DownloadFileReport::NO_ERROR, "" ); // return file; + void MediaSetAccess::releaseFile( const OnMediaLocation & on_media_file ) + { + releaseFile( on_media_file.filename(), on_media_file.medianr() ); + } + + void MediaSetAccess::releaseFile( const Pathname & file, unsigned media_nr) + { + media::MediaManager media_mgr; + media::MediaAccessId media; + + media = getMediaAccessId( media_nr); + DBG << "Going to release file " << file + << " from media number " << media_nr << endl; + + if ( ! media_mgr.isAttached(media) ) + return; //disattached media is free + + media_mgr.releaseFile (media, file); + } Pathname MediaSetAccess::provideFile( const OnMediaLocation & on_media_file ) { Modified: trunk/libzypp/zypp/MediaSetAccess.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/MediaSetAccess.h?rev=9940&r1=9939&r2=9940&view=diff ============================================================================== --- trunk/libzypp/zypp/MediaSetAccess.h (original) +++ trunk/libzypp/zypp/MediaSetAccess.h Fri May 2 16:31:18 2008 @@ -131,6 +131,24 @@ Pathname provideFile(const Pathname & file, unsigned media_nr = 1 ); /** + * Release file from media. + * This signal that file is not needed anymore. + * + * \param on_media_file location of the file on media + */ + void releaseFile( const OnMediaLocation & on_media_file ); + + + /** + * Release file from media. + * This signal that file is not needed anymore. + * + * \param file path to the file relative to media URL + * \param media_nr the media number in the media set + */ + void releaseFile(const Pathname & file, unsigned media_nr = 1 ); + + /** * Provides direcotry \a dir from media number \a media_nr. * * \param dir path to the directory relative to media URL -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org