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

1 by Adam Conrad
* Rename source package to pkgbinarymangler, providing a transitional
1
# read value for attribute $2 in dpkg control style file $1
2
# return value in $RET
3
readctrl() {
4
    _line=$(grep "^$2: " $1) || true
5
    RET=${_line#"$2: "}
6
}
7
8
#
9
# Execution starts here
10
#
11
12
# Check configuration: enabled?
13
[ -f "$CONFFILE" ] || exit 0
14
readctrl "$CONFFILE" "enable"
15
[ "$RET" = "true" ] || exit 0
16
17
if [ ! -f debian/control ]; then
18
    echo "$0: Error: not in source package directory" >&2
26 by Luca Falavigna
common: Do not FTBFS if debian/control does not exist. This is *very*
19
    exit 0
1 by Adam Conrad
* Rename source package to pkgbinarymangler, providing a transitional
20
fi
21
22
srcname=$(dpkg-parsechangelog | grep ^Source: | cut -f 2 -d\ )
23
version=$(dpkg-parsechangelog | grep ^Version: | cut -f 2 -d\ )
24
version=${version#*:}
25
63 by Martin Pitt
Replace hardcoded "/CurrentlyBuilding" path with a $BUILDINFO variable set
26
BUILDINFO=${CURRENTLY_BUILDING_PATH:-"/CurrentlyBuilding"}
27
28
# check whether build info is present and if it's consistent
29
if [ "$PKG_IGNORE_CURRENTLY_BUILDING" != 1 ] && [ -f "$BUILDINFO" ]; then
1 by Adam Conrad
* Rename source package to pkgbinarymangler, providing a transitional
30
    unset ignore_invalid_cb
31
    readctrl "$CONFFILE" "invalid_currentlybuilding"
32
    [ "$RET" != "ignore" ] || ignore_invalid_cb=1
33
63 by Martin Pitt
Replace hardcoded "/CurrentlyBuilding" path with a $BUILDINFO variable set
34
    readctrl "$BUILDINFO" "Package"
1 by Adam Conrad
* Rename source package to pkgbinarymangler, providing a transitional
35
36
    if [ "$RET" != $srcname ]; then
63 by Martin Pitt
Replace hardcoded "/CurrentlyBuilding" path with a $BUILDINFO variable set
37
        echo "$0: inconsistent $BUILDINFO file, Package: value is $RET (should be $srcname)" >&2
1 by Adam Conrad
* Rename source package to pkgbinarymangler, providing a transitional
38
        [ "$ignore_invalid_cb" ] || exit 1
39
    fi
40
63 by Martin Pitt
Replace hardcoded "/CurrentlyBuilding" path with a $BUILDINFO variable set
41
    readctrl "$BUILDINFO" "Component"
1 by Adam Conrad
* Rename source package to pkgbinarymangler, providing a transitional
42
    if [ -z "$RET" ]; then
63 by Martin Pitt
Replace hardcoded "/CurrentlyBuilding" path with a $BUILDINFO variable set
43
        echo "$0: inconsistent $BUILDINFO file, Component: value is empty" >&2
1 by Adam Conrad
* Rename source package to pkgbinarymangler, providing a transitional
44
        [ "$ignore_invalid_cb" ] || exit 1
45
    fi
46
fi
213 by Martin Pitt
Move code for determining the location of the binary package control file,
47
48
# find binary package control file and name
49
while [ $# -gt 0 ]; do
50
    if [ -f "$1"/DEBIAN/control ]; then
51
        PKGCTL="$1"/DEBIAN/control
52
        break
53
    else
54
        shift
55
    fi
56
done
57
58
if [ -z "$PKGCTL" ]; then
59
    echo "$0: did not find a package name argument or control file, skipping"
60
    exit 0
61
fi
62