Opened 19 years ago

Closed 17 years ago

#2155 closed enhancement (fixed)

patch for "compressdoc" to automatically use best compression method

Reported by: Lars Bamberger Owned by: dnicholson@…
Priority: low Milestone: 6.3
Component: BOOK Version: SVN
Severity: minor Keywords:
Cc:

Description

In chapter 3 of the book (Compressing Man and Info Pages) there is a script called "compressdoc". I have added an option '--automatic'. The idea is: Compress using either gzip or bzip2, depending on the size of the file to be compressed. Files larger than 5 kB are bziped, files larger than 1 kB are gziped and files smaller than 1 kB are not compressed.

Here follows the diff from version 20060311.0028 of the script to my version:

2c2
< # VERSION: 20060311.0028
---
> # VERSION: 20060903.2149
27a28,30
> # Modified 20060903 by Lars Bamberger to (sort of) automatically choose
> # a compression method based on the size of the manpage.
> #
31,33d33
< #     - offer an option to automagically choose the best compression
< #       methed on a per page basis (eg. check which of
< #       gzip/bzip2/whatever is the most effective, page per page);
51a52,57
>   --automatic
>               Compress using either gzip or bzip2, depending on the
>               size of the file to be compressed. Files larger than 5
>               kB are bziped, files larger than 1 kB are gziped and
>               files smaller than 1 kB are not compressed.
>
181a188,192
>     --automatic)
>       COMP_SUF=TBD
>       COMP_METHOD=$1
>       shift
>       ;;
288a300
>     --automatic) echo -n "depending on file size";;
429a442,453
>       # Find out which compression method to use
>       if COMP_METHOD="--automatic" ;
>       then
>               # filter the size of the file from the output of 'ls'
>               if (($(ls -k -s $FILE | sed "s@\([[:digit:]]\+\)\(.*\)@\1@") >=
5)) ;
>                 then COMP_SUF=.bz2 ;
>               elif (($(ls -k -s $FILE | sed "s@\([[:digit:]]\+\)\(.*\)@\1@") >= 1)) ;
>               then COMP_SUF=.gz ;
>               else COMP_SUF="" ;
>                 fi ;
>       fi
>

Change History (5)

comment:1 by Randy McMurchy, 19 years ago

Milestone: 6.2future

In this day and age of 300 GB hard drives costing less than $50.00, I'm not sure it is even important to have the compressdoc script in the book any longer.

Why would anyone use the script?

comment:2 by Randy McMurchy, 18 years ago

Milestone: future6.2.1

comment:3 by dnicholson@…, 18 years ago

Owner: changed from blfs-book@… to dnicholson@…
Status: newassigned

I think it's been shown that people use this script. I'll try to get it in if it doesn't seem like there are any regressions.

comment:4 by Randy McMurchy, 18 years ago

Milestone: 6.2.16.3

comment:5 by dnicholson@…, 17 years ago

Resolution: fixed
Status: assignedclosed

Applied in r7392 with a few changes to fix bugs I found when testing. And it only took 2 years!

Note: See TracTickets for help on using tickets.