head	1.5;
access;
symbols;
locks; strict;
comment	@# @;


1.5
date	2008.10.25.23.18.45;	author ulm;	state dead;
branches;
next	1.4;
commitid	7fea4903a9544567;

1.4
date	2008.05.25.17.26.28;	author ulm;	state Exp;
branches;
next	1.3;
commitid	fe74839a1424567;

1.3
date	2008.03.08.06.53.06;	author ulm;	state Exp;
branches;
next	1.2;
commitid	3f8947d237d04567;

1.2
date	2008.02.21.11.06.20;	author opfer;	state Exp;
branches;
next	1.1;
commitid	4a8b47bd5b2a4567;

1.1
date	2008.01.09.15.47.17;	author ulm;	state Exp;
branches;
next	;
commitid	12194784ec834567;


desc
@@


1.5
log
@Remove old.
(Portage version: 2.2_rc12/cvs/Linux 2.6.26-gentoo-r1 i686)
@
text
@#!/bin/bash

# Copyright 2007-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: emacs-updater,v 1.4 2008/05/25 17:26:28 ulm Exp $

# Authors:
# Christian Faulhammer <opfer@@gentoo.org>
# Ulrich Mueller <ulm@@gentoo.org>

VERSION=0.6
SITELISP=/usr/share/emacs/site-lisp
TMPFILE="$(mktemp /tmp/emacs-updater.XXXXXX)"

cat <<-EOF

Emacs updater version ${VERSION}
Written by the Gentoo Emacs team http://www.gentoo.org/proj/en/lisp/emacs/
Find packages that are installed in the wrong location

EOF

usage() {
    sed -e 's/^X//' <<-EOF
	Usage: ${0##*/} [OPTION]...
	X  -n, --nocolour   disable colour in output
	X  -p, --pretend    don't actually emerge packages
	X  -h, --help       display this help and exit
	EOF
    exit ${1}
}

# Read in all command-line options and force English output
OPTIONS=$(LC_ALL=C getopt -o hpn --long help,pretend,nocolour \
     -n 'emacs-updater' -- "$@@")
[ $? -eq 0 ] || usage 1

eval set -- "${OPTIONS}"

while true
do
    case "${1}" in
	-h|--help)      usage 0 ;;
	-p|--pretend)   PRETEND="true"; shift 1 ;;
	-n|--nocolour)  NOCOLOUR="true"; shift 1 ;;
	--)             shift; break ;;
    esac
done

# Only set colours if output is not redirected or the --no-colour
# option is not set
if [ -t 1 ] && [ -z "${NOCOLOUR}" ] ; then
    RED=$(tput -S <<<$'setaf 1\nbold')
    GREEN=$(tput -S <<<$'setaf 2\nbold')
    YELLOW=$(tput -S <<<$'setaf 3\nbold')
    BLUE=$(tput -S <<<$'setaf 4\nbold')
    MAGENTA=$(tput -S <<<$'setaf 5\nbold')
    CYAN=$(tput -S <<<$'setaf 6\nbold')
    BOLD=$(tput bold)
    NORMAL=$(tput sgr0)
fi

# Some type of output can be prettified and capsulated in functions
message() {
    local OUTPUT=$@@
    echo "${GREEN}*${NORMAL}${BOLD} ${OUTPUT}${NORMAL}"
}

warning() {
    local OUTPUT=$@@
    echo "${YELLOW}*${NORMAL}${BOLD} ${OUTPUT}${NORMAL}"
}

failure() {
    local OUTPUT=$@@
    echo "${RED}*${NORMAL}${BOLD} ${OUTPUT}${NORMAL}" 
}

if ! [ -x /usr/bin/qfile ]; then
    echo
    failure "Please emerge app-portage/portage-utils to use this tool"
    exit 1
fi

for sf in "${ROOT}${SITELISP}"/[0-9][0-9]*-gentoo.el
do
    [ "${sf##*/}" = 00site-gentoo.el ] && continue
    message "Processing ${sf##*/} ..."
    qfile -qCR "${sf}" >> "${TMPFILE}"
done
echo

if [ ! -s "${TMPFILE}" ]; then
    warning "No packages to update, quitting."
    exit 2
fi

NO_OF_PACKAGES=$(sed -n '$=' "${TMPFILE}")

[ ${NO_OF_PACKAGES} -eq 1 ] && s= || s=s
message "${NO_OF_PACKAGES} package${s} with site files in the wrong location:"
cat "${TMPFILE}"

if [ "${PRETEND}" ]; then
    exit 3
fi

echo
echo -n "${BOLD}Remerge packages?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
read choice
echo
case "${choice}" in
    y*|Y*|"")
	;;
    *)
	warning "Quitting."
	exit 10 ;;
esac

emerge --oneshot --ask --verbose $(cat "${TMPFILE}")

warning "If a package is being rebuilt over and over again,"
warning "please report it on http://bugs.gentoo.org/"
@


1.4
log
@Version bump.
(Portage version: 2.1.5.2)
@
text
@d5 1
a5 1
# $Id: emacs-updater,v 1.3 2008/03/08 06:53:06 ulm Exp $
@


1.3
log
@Update emacs-updater to version 0.6.
(Portage version: 2.1.4.4)
@
text
@d5 1
a5 1
# $Id: emacs-updater 1008 2008-03-02 23:42:20Z opfer $
d63 1
@


1.2
log
@bump emacs-updater to version 0.4
(Portage version: 2.1.4.4)
@
text
@d3 4
a6 1
# Licensed under GPL version 2
d11 1
a11 1
VERSION=0.4
d23 10
d36 1
d43 4
a46 4
	-h|--help) echo "You have the following options: --pretend|-p and/or --no-colour|-n" ; exit 0 ;;
	-p|--pretend) PRETEND="true"; shift 1 ;;
	-n|--nocolour) NOCOLOUR="true"; shift 1;;
	--) shift ; break ;;
d52 9
a60 8
if tty -s <&1 && [ -z ${NOCOLOUR} ] ; then
    BLUE=$'\e[34;01m'
    GREEN=$'\e[32;01m'
    RED=$'\e[31;01m'
    YELLOW=$'\e[33;01m'
    CYAN=$'\e[36;01m'
    BOLD=$'\e[0;01m'
    NORMAL=$'\e[0m'
d97 4
a100 1
message "Packages with site files in the wrong location:"
d103 1
a103 1
if [ ${PRETEND} ]; then
@


1.1
log
@Install emacs-updater shell script.
(Portage version: 2.1.4_rc14)
@
text
@d8 31
a38 2
# Only set colours if output is not redirected
if tty -s <&1; then
a47 5
SITELISP=/usr/share/emacs/site-lisp
VERSION=0.3
TMPFILE="$(mktemp /tmp/emacs-updater.XXXXXX)"


a62 8
cat <<-EOF

Emacs updater version ${VERSION}
Written by the Gentoo Emacs team http://www.gentoo.org/proj/en/lisp/emacs/
Find packages that are installed in the wrong location

EOF

d85 4
d94 3
a96 3
     y*|Y*|"")
          ;;
     *)
@

