FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Portage Developer

 
 
LinkBack Thread Tools
 
Old 08-08-2012, 09:56 PM
W-Mark Kubacki
 
Default 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:
>
> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;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 'os.pid' 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
[QSA,T=text/plain,E=no-gzip:1,L]
<FilesMatch "Packages.gz$">
Header set Content-Encoding gzip
</FilesMatch>

'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
 

Thread Tools




All times are GMT. The time now is 07:51 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org