~james-w/udd/multi-db

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
70
71
# Collect various commands used to fix errors in the packages
# branches

# This is intended to be sourced when needed on jubany

# When all is said and done, this file should not exist. When
# bugs like http://pad.lv/713719 et al will be fixed (i.e. when
# the package importer can be managed without requiring a shell
# access), this file should be deleted. In the mean time, please
# add your own commands there as you discover them, the long term
# plan is to get rid of the useless ones and integrate the useful
# ones in a better place.

export BASEDIR=/srv/package-import.canonical.com/new
export PATH=${BASEDIR}/scripts/bin:${PATH}
# 1) 'scripts' contains the udd library.
# 2) If a local bzr is installed, use it
# 3) bzr-builddeb requires distro-info
export PYTHONPATH=${BASEDIR}/scripts:${BASEDIR}/bzr:${BASEDIR}/distro-info/python
export BZR_PLUGIN_PATH=${BASEDIR}/scripts/plugins
export LANG="en_GB.UTF-8"
export BZR_EMAIL="Package Import Robot <package-import@ubuntu.com>"


lp_url() {
    local package dist series
    package=$1
    dist=$2
    series=$3
    if [ ${dist} = 'debian' ] ; then
        lpdist=debianlp
    else
        lpdist=${dist}
    fi
    # If the following doesn't work, we may switch to:
    # "bzr+ssh://bazaar.launchpad.net/+branch/${dist}/${series}/${package}"
    echo "${lpdist}:${series}/${package}"
}

delete_tag() {
    local tag package dist multiseries
    tag=$1
    package=$2
    dist=$3
    multiseries=$4

    for series in $multiseries; do
        url=`lp_url ${package} ${dist} ${series}`
        echo "delete tag ${tag} for ${package} in ${dist} ${series}"
        bzr tag --delete -d"${url}" "${tag}"
    done
}

force_tag() {
    local tag revisionid package dist multiseries
    tag=$1
    revid=$2
    package=$3
    dist=$4
    multiseries=$5

    for series in $multiseries; do
        url=`lp_url ${package} ${dist} ${series}`
        echo "force ${tag} to ${revid} for ${package} in ${dist} ${series}"
        bzr tag --force -d"${url}" "${tag}" -r"${revid}"
    done
}

requeue() {
    requeue-package "$@"
}