Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Dec 2013 21:15:08 GMT
From:      Matthieu Volat <mazhe@alkumuna.eu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/185189: [patch] freeing graphic/netpbm from bash dep
Message-ID:  <201312252115.rBPLF8MZ033569@oldred.freebsd.org>
Resent-Message-ID: <201312252120.rBPLK0ja046475@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         185189
>Category:       ports
>Synopsis:       [patch] freeing graphic/netpbm from bash dep
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 25 21:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Matthieu Volat
>Release:        10.0-RC2
>Organization:
>Environment:
FreeBSD justice.alkumuna.eu 10.0-RC2 FreeBSD 10.0-RC2 #0: Mon Dec 16 23:30:07 CET 2013     root@justice.alkumuna.eu:/usr/obj/usr/src/sys/GENERIC+IPSEC  amd64
>Description:
Here's an attempt to de-bashify graphics/netpbm, there is two routes possibles :
1. Moderatly fix editor/ppmquantall to run with /bin/sh
2. Lightly fix editor/ppmquantall.csh and copy it to replace editor/ppmquantall

Both would work, I've attached patches to fix said scripts. Solution 1 use a bigger patch, but is more straightforward.
>How-To-Repeat:

>Fix:
See joined shar archives for ppmquantall(.csh) fixes. Then remove bash dependency and enjoy a (more) bash-free netpbm :)

Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	patch-editor_ppmquantall.csh.txt
#	patch-editor_ppmquantall.txt
#
echo x - patch-editor_ppmquantall.csh.txt
sed 's/^X//' >patch-editor_ppmquantall.csh.txt << '4b708c94a4d1c2211de08048bfc85e67'
X--- editor/ppmquantall.csh.orig	2013-12-25 21:47:57.086853695 +0100
X+++ editor/ppmquantall.csh	2013-12-25 21:56:17.183814873 +0100
X@@ -30,8 +30,8 @@
X set widths=()
X set heights=()
X foreach i ( $files )
X-    set widths=( $widths `sed '1d; s/ .*//; 2q' $i` )
X-    set heights=( $heights `sed '1d; s/.* //; 2q' $i` )
X+    set widths=( $widths `grep -v '^#' $i | sed '1d; s/ .*//; 2q'` )
X+    set heights=( $heights `grep -v '^#' $i | sed '1d; s/.* //; 2q'` )
X end
X 
X set all=/tmp/pqa.all.$$
4b708c94a4d1c2211de08048bfc85e67
echo x - patch-editor_ppmquantall.txt
sed 's/^X//' >patch-editor_ppmquantall.txt << '6b64289d665edd27ccecb8e54114d3d8'
X--- editor/ppmquantall.orig	2013-12-25 21:33:13.917913692 +0100
X+++ editor/ppmquantall	2013-12-25 21:44:26.342864655 +0100
X@@ -54,7 +54,7 @@
X newcolors=$1
X shift
X nfiles=$#
X-files=($@)
X+files=$@
X 
X # Extract the width and height of each of the images.
X # Here, we make the assumption that the width and height are on the
X@@ -62,14 +62,6 @@
X # To be robust, we need to use Pnmfile to get that information, or 
X # Put this program in C and use ppm_readppminit().
X 
X-widths=()
X-heights=()
X-
X-for i in ${files[@]}; do
X-    widths=(${widths[*]} `grep -v '^#' $i | sed '1d; s/ .*//; 2q'`)
X-    heights=(${heights[*]} `grep -v '^#' $i | sed '1d; s/.* //; 2q'`)
X-done
X-
X tempdir="${TMPDIR-/tmp}/ppmquantall.$$"
X mkdir $tempdir || { echo "Could not create temporary file. Exiting."; exit 1;}
X chmod 700 $tempdir
X@@ -78,7 +70,7 @@
X 
X all=$tempdir/pqa.all.$$
X 
X-pnmcat -topbottom -jleft -white ${files[@]} | pnmquant $newcolors > $all
X+pnmcat -topbottom -jleft -white $files | pnmquant $newcolors > $all
X if [ $? != 0 ]; then
X     exit $?
X fi
X@@ -86,12 +78,15 @@
X y=0
X i=0
X 
X-while [ $i -lt $nfiles ]; do
X-    pamcut -left 0 -top $y -width ${widths[$i]} -height ${heights[$i]} $all \
X-        > ${files[$i]}$ext
X+for f in $files; do
X+    width=`grep -v '^#' $f | sed '1d; s/ .*//; 2q'`
X+    height=`grep -v '^#' $f | sed '1d; s/.* //; 2q'`
X+
X+    pamcut -left 0 -top $y -width $width -height $height $all \
X+        > $f$ext
X     if [ $? != 0 ]; then
X         exit $?
X     fi
X-    y=$(($y + ${heights[$i]}))
X+    y=$(($y + $height))
X     i=$(($i + 1))
X done
6b64289d665edd27ccecb8e54114d3d8
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312252115.rBPLF8MZ033569>