Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Portage Developer (http://www.linux-archive.org/gentoo-portage-developer/)
-   -   Portage to write a compressed copy of 'Packages' index file (http://www.linux-archive.org/gentoo-portage-developer/691955-portage-write-compressed-copy-packages-index-file.html)

W-Mark Kubacki 08-08-2012 06:35 PM

Portage to write a compressed copy of 'Packages' index file
 
Hi Portage devs,

Can I send patches by `git send-email` or do you prefer attachments?

The patch applies to master/HEAD and can be backported to 2.1*. Its
description is as follows:

Portage writes a compressed copy of 'Packages' index file.

This behaviour is enabled by FEATURES="compress-index". The
resulting file is 'Packages.gz' and its modification time will
match that of 'Packages'.

Web-servers use that copy to avoid repeated on-the-fly compression.

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.)

Example usage, Nginx:

location =/Packages {
gzip_static on;
default_type text/plain;
}

Apache httpd (use with caution):

RewriteRule ^(.*)/Packages$ $1/Packages.gz
[T=text/plain,E=GZIP:gzip,L]
<FilesMatch "Packages.gz$">
Header set Content-Encoding gzip
</FilesMatch>

Zac Medico 08-08-2012 08:22 PM

Portage to write a compressed copy of 'Packages' index file
 
On 08/08/2012 11:35 AM, W-Mark Kubacki wrote:
> Hi Portage devs,
>
> Can I send patches by `git send-email` or do you prefer attachments?

Either way is fine.

> The patch applies to master/HEAD and can be backported to 2.1*. Its
> description is as follows:
>
> Portage writes a compressed copy of 'Packages' index file.
>
> This behaviour is enabled by FEATURES="compress-index". The
> resulting file is 'Packages.gz' and its modification time will
> match that of 'Packages'.
>
> Web-servers use that copy to avoid repeated on-the-fly compression.
>
> 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.)
>
> Example usage, Nginx:
>
> location =/Packages {
> gzip_static on;
> default_type text/plain;
> }
>
> Apache httpd (use with caution):
>
> RewriteRule ^(.*)/Packages$ $1/Packages.gz
> [T=text/plain,E=GZIP:gzip,L]
> <FilesMatch "Packages.gz$">
> Header set Content-Encoding gzip
> </FilesMatch>
>

Thanks, I've applied your patch:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=11c0619c63b54346ee5c67cd67a b1ccb24f5f947

--
Thanks,
Zac

Zac Medico 08-08-2012 09:00 PM

Portage to write a compressed copy of 'Packages' index file
 
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
--
Thanks,
Zac


All times are GMT. The time now is 01:35 PM.

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