Linux Archive

Linux Archive (
-   Gentoo Portage Developer (
-   -   Portage to write a compressed copy of 'Packages' index file (

W-Mark Kubacki 08-08-2012 09:56 PM

Portage to write a compressed copy of 'Packages' index file
On Wed, Aug 08, 2012 at 02:00:23PM -0700, Zac Medico wrote:
> On 08/08/2012 11:35 AM, W-Mark Kubacki wrote:
> > In order to re-use 'atomic_ofstream' usage of 'codecs.zlib_codec'
> > has been considered and discarded, because 'GzipFile' yields
> > smaller files. (According to Mark's tests 62% smaller.)
> I've fixed it to use an atomic_ofstream as GzipFile's fileobj argument:
>;a=commit;h=e95a07267c7f642fdca2aca346a b4c12f46748bb

I've noticed the differences between my initial patch and your commit.
Thank you!

Indeed, GzipFile not closing the underlying 'fileobj' makes things ugly.
Your previous and now detached commit (where '' has been appended
to the file name and, after having been closed, the file was renamed)
made me wonder whether modification times would be preserved. Well,
that's an obsolete though now.

The example usage with Apache httpd is not complete. Some conditions are
missing. I have no Apache httpd at hand, but that's what I gather from
the documentation:

RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -s
RewriteRule ^(.*)/Packages$ $1/Packages.gz
<FilesMatch "Packages.gz$">
Header set Content-Encoding gzip

'Packages' served as 'text/plain' will prevent browsers from downloading
that file like, say, zip files. And, one of my next patches will
introduce the 'Accept' HTTP header which could come in handy in future
extensions – and content-negotiation on server-side; 'text/plain+diff'
anyone? ;-)

Grüße, Mark

All times are GMT. The time now is 05:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.