On Sat, May 06, 2006 at 03:26:43AM -0700, Steve Langasek wrote: > - update-fonts-scale something something. I dunno, this probably parallels > u-f-a, but I haven't tested it yet.
Oh neat, that was way more simple than I expected it to be; update-fonts-scale already has the line-wise parsing of .scale files that I expected I would have to add, which makes the patch almost identical to the one for update-fonts-alias. Anyway, it looks like I forgot to attach the patch the first time, so let's use this one instead which should now be pretty complete -- it fixes up both of the utilities and also removes mention of the deprecated -7 options from the usage output and manpages. Any objections to committing this? Cheers, -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. [EMAIL PROTECTED] http://www.debian.org/
Index: debian/changelog
===================================================================
--- debian/changelog (revision 2106)
+++ debian/changelog (working copy)
@@ -1,3 +1,15 @@
+xfonts-utils (1:1.0.0-4) unstable; urgency=low
+
+ * Fix up update-fonts-alias and update-fonts-scale to cope with
+ files in /etc/X11/fonts/$type/ pointing to font files in either
+ /usr/share/fonts/X11 or /usr/X11R6/lib/X11/fonts, eliminating some
+ unnecessary transition work for font package maintainers;
+ update-fonts-{alias,scale} will in addition check
+ /etc/X11/fonts/X11R7/$type/ when called with -7, for transitional
+ purposes only. Closes: #364530.
+
+ -- Steve Langasek <[EMAIL PROTECTED]> Fri, 5 May 2006 23:02:12 -0700
+
xfonts-utils (1:1.0.0-3) unstable; urgency=low
* Upload to unstable
Index: debian/local/update-fonts-alias
===================================================================
--- debian/local/update-fonts-alias (revision 2106)
+++ debian/local/update-fonts-alias (working copy)
@@ -6,6 +6,7 @@
# mkfontdir(1x) for a description of the format of fonts.alias files.
# Copyright 1999, 2001, 2002, 2004 Branden Robinson.
+# Copyright 2006 Steve Langasek.
# Licensed under the GNU General Public License, version 2. See the file
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
@@ -43,7 +44,6 @@
fi
cat <<EOF
Usage: $PROGNAME DIRECTORY ...
- $PROGNAME { -7 | --x11r7-layout } DIRECTORY ...
$PROGNAME { -h | --help }
This program combines X font alias information from several packages into a
single file that is placed in each specified X font directory DIRECTORY. This
@@ -51,7 +51,6 @@
update-fonts-alias(8) for more information.
Options:
-h, --help display this usage message and exit
- -7, --x11r7-layout use new font layout introduced with X11R7
EOF
}
@@ -85,40 +84,66 @@
# Try to be clever about the argument; were we given an absolute path?
if expr "$1" : "/.*" >/dev/null 2>&1; then
# Yes; an absolute path to an X font directory was provided.
- XDIR=$1
+ X11R7DIR=$1
+ ETCDIR=/etc/X11/fonts/${XDIR##*/}
if [ -n "$X11R7_LAYOUT" ]; then
- ETCDIR=/etc/X11/fonts/X11R7/${XDIR##*/}
- else
- ETCDIR=/etc/X11/fonts/${XDIR##*/}
+ ETC7DIR=/etc/X11/fonts/X11R7/${XDIR##*/}
fi
- if [ "$XDIR" = "$ETCDIR" ]; then
+ if [ "$X11R7DIR" = "$ETCDIR" ] || [ "$X11R7DIR" = "$ETC7DIR" ]; then
# We were given an /etc directory as an argument.
die "path to X font directory must be used"
else
- warn "absolute path $XDIR was provided"
+ warn "absolute path $X11R7DIR was provided"
fi
else
# No; a relative path was provided -- assume we were given just the
# basename.
+ X11R6DIR=/usr/lib/X11/fonts/$1
+ X11R7DIR=/usr/share/fonts/X11/$1
+ ETCDIR=/etc/X11/fonts/$1
if [ -n "$X11R7_LAYOUT" ]; then
- XDIR=/usr/share/fonts/X11/$1
- ETCDIR=/etc/X11/fonts/X11R7/$1
+ ETC7DIR=/etc/X11/fonts/X11R7/$1
+ fi
+ fi
+
+ shift
+
+ # Confirm that the directories to be operated on exist.
+ VALIDSRC=
+ if [ -d "$ETCDIR" ]; then
+ VALIDSRC=yes
+ else
+ warn "$ETCDIR does not exist or is not a directory"
+ fi
+ if [ -n "$ETC7DIR" ]; then
+ if [ -d "$ETC7DIR" ]; then
+ VALIDSRC=yes
else
- XDIR=/usr/lib/X11/fonts/$1
- ETCDIR=/etc/X11/fonts/$1
+ warn "$ETC7DIR does not exist or is not a directory"
fi
fi
- # Confirm that the directories to be operated on exist.
- for DIR in "$XDIR" "$ETCDIR"; do
- VALID=yes
- if ! [ -d "$DIR" ]; then
+
+ VALIDDEST=
+ for DIR in "$X11R7DIR" "$X11R6DIR"; do
+ [ -n "$DIR" ] || continue
+ if [ -d "$DIR" ]; then
+ VALIDDEST=yes
+ else
warn "$DIR does not exist or is not a directory"
- VALID=
fi
done
- if [ -n "$VALID" ]; then
- # Are there any files to process?
- if [ "$(echo "$ETCDIR"/*.alias)" != "$ETCDIR/*.alias" ]; then
+
+ if [ -z "$VALIDSRC" ] || [ -z "$VALIDDEST" ]; then
+ continue
+ fi
+
+ # Are there any files to process?
+ if [ "$(echo "$ETCDIR"/*.alias "$ETC7DIR"/*.alias)" != "$ETCDIR/*.alias
$ETC7DIR/*.alias" ]
+ then
+ for XDIR in "$X11R7DIR" "$X11R6DIR"; do
+ if [ -z "$XDIR" ] || ! [ -d "$XDIR" ]; then
+ continue
+ fi
# Write the new alias file in a temporary location in case we are
# interrupted.
cat >"$XDIR/fonts.alias.update-new" <<EOF
@@ -130,15 +155,19 @@
cat "$FILE" >>"$XDIR/fonts.alias.update-new"
done
mv "$XDIR/fonts.alias.update-new" "$XDIR/fonts.alias"
- else
+ done
+ else
+ for XDIR in "$X11R7DIR" "$X11R6DIR"; do
+ if [ -z "$XDIR" ] || ! [ -d "$XDIR" ]; then
+ continue
+ fi
# There are no files to process; remove any alias file already in
# the font directory.
rm -f "$XDIR/fonts.alias"
# Remove the font directory if it is empty.
rmdir "$XDIR" >/dev/null 2>&1 || true
- fi
+ done
fi
- shift
done
exit 0
Index: debian/local/update-fonts-scale.8
===================================================================
--- debian/local/update-fonts-scale.8 (revision 2106)
+++ debian/local/update-fonts-scale.8 (working copy)
@@ -96,12 +96,6 @@
.SH OPTIONS
.B \-h\fR, \fB\-\-help
displays a brief usage message and exits.
-.PP
-.B \-7\fR, \fB\-\-x11r7\-layout
-switches the font layout to the one introduced in X11R7: fonts in
-.IR /usr/share/fonts/X11/ directory
-(default is: fonts in
-.IR /usr/lib/X11/fonts/ directory)
.SH OPERANDS
.B update\-fonts\-scale
takes one or more X font directory names to operate on as operands.
Index: debian/local/update-fonts-alias.8
===================================================================
--- debian/local/update-fonts-alias.8 (revision 2106)
+++ debian/local/update-fonts-alias.8 (working copy)
@@ -92,12 +92,6 @@
.SH OPTIONS
.B \-h\fR, \fB\-\-help
displays a brief usage message and exits.
-.PP
-.B \-7\fR, \fB\-\-x11r7\-layout
-switches the font layout to the one introduced in X11R7: fonts in
-.IR /usr/share/fonts/X11/ directory
-(default is: fonts in
-.IR /usr/lib/X11/fonts/ directory)
.SH OPERANDS
.B update\-fonts\-alias
takes one or more X font directory names to operate on as operands.
Index: debian/local/update-fonts-scale
===================================================================
--- debian/local/update-fonts-scale (revision 2106)
+++ debian/local/update-fonts-scale (working copy)
@@ -6,6 +6,7 @@
# mkfontdir(1x) for a description of the format of fonts.scale files.
# Copyright 1999-2002, 2004 Branden Robinson.
+# Copyright 2006 Steve Langasek.
# Licensed under the GNU General Public License, version 2. See the file
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
@@ -50,7 +51,6 @@
fi
cat <<EOF
Usage: $PROGNAME DIRECTORY ...
- $PROGNAME { -7 | --x11r7-layout } DIRECTORY ...
$PROGNAME { -h | --help }
This program combines scalable X font information from several packages into a
single file that is placed in each specified X font directory DIRECTORY. This
@@ -58,7 +58,6 @@
update-fonts-scale(8) for more information.
Options:
-h, --help display this usage message and exit
- -7, --x11r7-layout use new font layout introduced with X11R7
EOF
}
@@ -92,40 +91,66 @@
# Try to be clever about the argument; were we given an absolute path?
if expr "$1" : "/.*" >/dev/null 2>&1; then
# Yes; an absolute path to an X font directory was provided.
- XDIR=$1
+ X11R7DIR=$1
+ ETCDIR=/etc/X11/fonts/${XDIR##*/}
if [ -n "$X11R7_LAYOUT" ]; then
- ETCDIR=/etc/X11/fonts/X11R7/${XDIR##*/}
- else
- ETCDIR=/etc/X11/fonts/${XDIR##*/}
+ ETC7DIR=/etc/X11/fonts/X11R7/${XDIR##*/}
fi
- if [ "$XDIR" = "$ETCDIR" ]; then
+ if [ "$X11R7DIR" = "$ETCDIR" ] || [ "$X11R7DIR" = "$ETC7DIR" ]; then
# We were given an /etc directory as an argument.
die "path to X font directory must be used"
else
- warn "absolute path $XDIR was provided"
+ warn "absolute path $X11R7DIR was provided"
fi
else
# No; a relative path was provided -- assume we were given just the
# basename.
+ X11R6DIR=/usr/lib/X11/fonts/$1
+ X11R7DIR=/usr/share/fonts/X11/$1
+ ETCDIR=/etc/X11/fonts/$1
if [ -n "$X11R7_LAYOUT" ]; then
- XDIR=/usr/share/fonts/X11/$1
- ETCDIR=/etc/X11/fonts/X11R7/$1
+ ETC7DIR=/etc/X11/fonts/X11R7/$1
+ fi
+ fi
+
+ shift
+
+ # Confirm that the directories to be operated on exist.
+ VALIDSRC=
+ if [ -d "$ETCDIR" ]; then
+ VALIDSRC=yes
+ else
+ warn "$ETCDIR does not exist or is not a directory"
+ fi
+ if [ -n "$ETC7DIR" ]; then
+ if [ -d "$ETC7DIR" ]; then
+ VALIDSRC=yes
else
- XDIR=/usr/lib/X11/fonts/$1
- ETCDIR=/etc/X11/fonts/$1
+ warn "$ETC7DIR does not exist or is not a directory"
fi
fi
- # Confirm that the directories to be operated on exist.
- for DIR in "$XDIR" "$ETCDIR"; do
- VALID=yes
- if ! [ -d "$DIR" ]; then
+
+ VALIDDEST=
+ for DIR in "$X11R7DIR" "$X11R6DIR"; do
+ [ -n "$DIR" ] || continue
+ if [ -d "$DIR" ]; then
+ VALIDDEST=yes
+ else
warn "$DIR does not exist or is not a directory"
- VALID=
fi
done
- if [ -n "$VALID" ]; then
- # Are there any files to process?
- if [ "$(echo "$ETCDIR"/*.scale)" != "$ETCDIR/*.scale" ]; then
+
+ if [ -z "$VALIDSRC" ] || [ -z "$VALIDDEST" ]; then
+ continue
+ fi
+
+ # Are there any files to process?
+ if [ "$(echo "$ETCDIR"/*.scale "$ETC7DIR"/*.scale)" != "$ETCDIR/*.scale
$ETC7DIR/*.scale" ]
+ then
+ for XDIR in "$X11R7DIR" "$X11R6DIR"; do
+ if [ -z "$XDIR" ] || ! [ -d "$XDIR" ]; then
+ continue
+ fi
for SCALEFILE in "$ETCDIR"/*.scale; do
# Only write fonts to the .scale file that actually exist, so
# that removed-but-not-purged scalable font packages do not
@@ -155,15 +180,19 @@
mv "$XDIR/fonts.scale.update-new" "$XDIR/fonts.scale"
rm "$XDIR/fonts.scale.update-tmp"
fi
- else
+ done
+ else
+ for XDIR in "$X11R7DIR" "$X11R6DIR"; do
+ if [ -z "$XDIR" ] || ! [ -d "$XDIR" ]; then
+ continue
+ fi
# No files to process; remove any fonts.scale file already in the
# font directory.
rm -f "$XDIR/fonts.scale"
# Remove the font directory if it is empty.
rmdir "$XDIR" >/dev/null 2>&1 || true
- fi
+ done
fi
- shift
done
exit 0
signature.asc
Description: Digital signature

