#!/bin/bash
# Sync the libqalculate-dev B-D version with debian/changelog
set -x
package_name=libqalculate-dev
target_version=">= $(dpkg-parsechangelog -S Version | sed 's/-.*/~/')"

sed -i -E "s/${package_name} \(>= ?\S+\)/${package_name} ($target_version)/" debian/control

if [[ ! $? ]]; then
    echo "no match"
    exit 1
else
    msg="Bump $package_name build-dependency to $target_version"
    dch -a -m "$msg"
    git commit -m "$msg" debian/changelog debian/control
fi
