[sabayon] new function in storage module to get a path to a file/directory in uncompressed temp profile



This was discussed briefly on IRC, just thought I would follow up.

Sometimes when applying you don't want to extract a saved file into the
destination home directory, rather you want to read that file and merge
it into the destination. The extract() method only allowed you to copy
the file into the destination. This is what I did to fix this:

extract() essentially had two major pieces of logic that were folded
together:

1) find the path to the file/directory for the revision of the requested
path in the uncompressed profile staging area.

2) copy the file/directory to the destination

I split the logic up, a new method get_extract_src_path() returns the
path for the requested path/revision, extract() now just calls
get_extract_src_path() and then applies its copy logic.

get_extract_src_path() is a public method and can be called instead of
extract() if you just want to read the file.

I still need to modify the mozilla code to use it, that's next on my
list. The existing storage module is using it now. If anything breaks
let me know, I'm the responsible individual :-) BTW, it did make the
arguments to copytree() a little funny when extracting a directory, I
had to make the dst path the empty string. I think it's O.K, but it is a
little funky and the one thing I wasn't 100% sure would work the way I
expected.
-- 
John Dennis <jdennis redhat com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]