#!/bin/sh

# Usage: damove NEW_SUFFIX OLD_SUFFIX SOURCE_PACKAGE

# Move the source package from the old suffix to the new suffix, where
# a suffix is probably one of "", "-proposed", or "-development"
#
# This moves any source or binary package built from the source
# package PACKAGE

set -e

. $(dirname "$0")/debian-versions.sh

if [ "$#" -ne 3 ]; then
    echo "Usage: damove NEW_SUFFIX OLD_SUFFIX SOURCE_PACKAGE" >&2
    exit 1
fi

new_suffix="$1"; shift
old_suffix="$1"; shift

dacopy "$new_suffix" "$old_suffix" "$@"
if [ "$new_suffix" != "$old_suffix" ]; then
    daremove "$old_suffix" "$@"
fi
