[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg 1.1.6[elf]: many bugfixes



>   * dpkg-name now includes architecture component in .deb filename,
>     and translates - in package name to _.
sorry Ian, you will receive this twice. The modifications you made on
dpkg-name were nice but not enough to get what we want. I updated it
a little. Please include this in the next dpkg version:

#!/bin/sh

set -e

prog="`basename \"${0}\"`"
version="1.1.6"; # This line modified by Makefile
purpose="rename Debian packages to full package names"

license () {
echo "# ${prog} ${version} -- ${purpose}
# Copyright (C) 1995,1996 Erick Branderhorst <branderh@debian.org>.

# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.

# This is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the file
# /usr/doc/copyright/GPL for more details."
}

stderr () {
	echo "${prog}: $@" >/dev/stderr;
}

show_version () {
	echo "${prog} version ${version} -- ${purpose}";
}

usage () {
	echo "Usage: ${prog} file[s]
  ${purpose}
  file.deb changes to <package>-<version>.<architecture>.deb
  -h|--help|-v|--version|-l|--license  Show help/version/license"
}

rename () {
	if [ -f "$1" ];
	then
		if p=`dpkg-deb -f -- "$1" package|tr -s -- '- ' '_'`;
		then
			v=`dpkg-deb -f -- "$1" version`;
			r=`dpkg-deb -f -- "$1" revision`;
			if [ -z "$r" ];
			then
				r=`dpkg-deb -f -- "$1" package_revision`;
			fi
			if [ -n "$r" ];
			then
				v=$v-$r;
			fi
			a=`dpkg-deb -f -- "$1" architecture`;
			if [ -z "$a" ];
			then
				a=`dpkg --print-architecture`;
				stderr "assuming "$a" architecture for \`"$1"'";
			fi				
#     			p=`echo \"$p\"|tr -ds -- '- ' _`
			p=`dirname "$1"`"/"$p"-"$v.$a.deb
			if [ $p -ef "$1" ];									# same device and inode numbers
			then
				stderr "skipping \`"$1"'";
			elif [ -f $p ];
			then
				stderr "can't move \`"$1"' to existing file";
			elif `mv -- "$1" $p`;
			then
				echo "moved \``basename "$1"`' to \`${p}'";
			else
				stderr "hmm how did this happen?";
			fi
		fi
	else
		stderr "can't deal with \`"$1"'";
  fi
}

if [ $# = 0 ]; then usage; exit 0; fi	
for arg
do
	case "$arg" in
		--version|-v) show_version; exit 0;;
		--help|-[h?]) usage; exit 0;;
		--licen[cs]e|-l) license; exit 0;;
		--) shift; 
			for arg 
			do 
				rename "$arg"; 
			done; exit 0;;
		*) rename "$arg";;
	esac
done
exit 0;

# Local variables:
# tab-width: 2
# End:
--
Erick Branderhorst@heel.fgg.eur.nl +31-10-4635142
Department of General Surgery (Intensive Care) University Hospital Rotterdam NL


Reply to: