~ubuntu-branches/ubuntu/vivid/pkgbinarymangler/vivid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash -e

CONFFILE=/etc/pkgbinarymangler/maintainermangler.conf
CONFFILE=${PKGBINARYMANGLER_CONF_DIR:-/etc/pkgbinarymangler}/maintainermangler.conf
OVERRIDEFILE=${PKMAINTAINERGMANGLER_OVERRIDES:-/etc/pkgbinarymangler/maintainermangler.overrides}

. ${PKGBINARYMANGLER_COMMON_PATH:-/usr/share/pkgbinarymangler}/common

readctrl "$OVERRIDEFILE" "default"
OVERRIDE="$RET"

if [ -f "$BUILDINFO" ]; then
    readctrl "$BUILDINFO" "Component"
    COMPONENT="$RET"
    readctrl "$OVERRIDEFILE" "%$RET"
    if [ -n "$RET" ]; then
        OVERRIDE="$RET"
    fi
    if grep -qs '^Purpose: PPA' "$BUILDINFO"; then
        echo "INFO: Disabling pkgmaintainermangler for PPA build"
        exit 0
    fi
fi

readctrl "$PKGCTL" "Maintainer"
OLDMAINT="$RET"
OLDMAINTEMAIL=$(echo "$OLDMAINT" | sed -e 's/.*<\(.*\)>.*/\1/')
OLDMAINTDOMAIN=$(echo "$OLDMAINTEMAIL" | sed -e 's/.*@//')

readctrl "$OVERRIDEFILE" "ignore_domains"
IGNORE_DOMAINS="$RET"
if [ -n "$IGNORE_DOMAINS" ]; then
    for i in $IGNORE_DOMAINS; do
        if [ "$i" = "$OLDMAINTDOMAIN" ]; then
            echo "pkgmaintainermangler: Not overriding Maintainer for domain $OLDMAINTDOMAIN"
            exit 0
        fi
    done
fi

readctrl "$OVERRIDEFILE" "ignore_emails"
IGNORE_EMAILS="$RET"
if [ -n "$IGNORE_EMAILS" ]; then
    for i in $IGNORE_EMAILS; do
        if [ "$i" = "$OLDMAINTEMAIL" ]; then
            echo "pkgmaintainermangler: Not overriding Maintainer for address $OLDMAINTEMAIL"
            exit 0
        fi
    done
fi

readctrl "$OVERRIDEFILE" "@$OLDMAINTEMAIL"
if [ -n "$RET" ]; then
    OVERRIDE="$RET"
fi

readctrl "$PKGCTL" "Original-Maintainer"
if [ -n "$RET" ]; then
    echo "pkgmaintainermangler: $PKGCTL already contains an Original-Maintainer field; doing nothing" >&2
    exit 0
fi

if [ "$OLDMAINT" = "$OVERRIDE" ]; then
    echo "pkgmaintainermangler: Override matches original Maintainer; doing nothing"
    exit 0
fi

echo "pkgmaintainermangler: Maintainer field overridden to \"$OVERRIDE\""
sed -i -e "s/^Maintainer: \(.*\)$/Maintainer: $OVERRIDE\nOriginal-Maintainer: \1/" $PKGCTL