Lars Gustäbel added the comment:

> It's also consistent with how the tar command works afaik, just listing the 
> contents of the current volume.

No, GNU tar operates on the entirety of the archive and asks for the filename 
of the subsequent volume every time it hits eof in the current volume.

> You don't want to directly do a plain open in there, because you want to be 
> able to deal with read/write modes, with gzip/bzip/Stream class.

The example I gave is based on the idea that there is a TarVolumeSet class in 
the tarfile module that implements all the required file-object methods (e.g.  
read(), write(), seek(), etc.) and acts as if the sequence of volumes is 
actually one big file. It is passed to tarfile.open() as the fileobj argument. 
This TarVolumeSet class is supposed to be subclassable to let the user 
implement her/his own mode of operation. This way the open_volume() method can 
do whatever the user wants it to do. The TarVolumeSet class might as well have 
a new_volume() method for writing multivol archives, the example only covered 
the case of reading a multivol archive.

BTW, my version of GNU tar refuses to create compressed multiple-volume 
archives which is why I doubt the usefulness of this feature overall.

> [...] because a multivol tarfile is not exactly the same as a normal tarfile 
> chopped up.

No, I think it is exactly that. The only purpose of the GNUTYPE_MULTIVOL header 
that is at the start of each subsequent volume is to give GNU tar the ability 
to detect if it is reading the correct volume. It is not essential and could as 
well be left out.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18321>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to