CI: add scripts/check_debian_changelog.sh lint
Check if latest version in debian/changelog matches the version in meli/Cargo.toml. Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>pull/322/head
parent
3ba1603af2
commit
1617212c5b
|
@ -45,6 +45,8 @@ jobs:
|
|||
os: ubuntu-latest
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
run:
|
||||
working-directory: ./scripts
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@v2
|
||||
- id: os-deps
|
||||
|
@ -95,3 +97,7 @@ jobs:
|
|||
cargo-sort --check --check-format --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace fuzz
|
||||
cargo-sort --check --check-format --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace tools
|
||||
cargo-sort --check --check-format --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace --workspace
|
||||
- name: Check debian/changelog is up-to-date.
|
||||
if: success() || failure()
|
||||
run: |
|
||||
./scripts/check_debian_changelog.sh
|
||||
|
|
|
@ -4,7 +4,7 @@ Priority: optional
|
|||
Maintainer: Manos Pitsidianakis <manos@pitsidianak.is>
|
||||
Build-Depends: debhelper (>=11~), mandoc (>=1.14.4-1), quilt, libsqlite3-dev
|
||||
Standards-Version: 4.1.4
|
||||
Homepage: https://meli.delivery
|
||||
Homepage: https://meliemail.org
|
||||
|
||||
Package: meli
|
||||
Architecture: any
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: meli
|
||||
Source: <https://git.meli.delivery/meli/meli>
|
||||
Source: <https://git.meliemail.org/meli/meli>
|
||||
#
|
||||
# Please double check copyright with the licensecheck(1) command.
|
||||
|
||||
Files: *
|
||||
Copyright: 2017-2020 Manos Pitsidianakis
|
||||
Copyright: 2017-2023 Manos Pitsidianakis
|
||||
License: GPL-3.0+
|
||||
#----------------------------------------------------------------------------
|
||||
# License file: COPYING
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
usage() { printf "Check if latest version in debian/changelog matches the version in meli/Cargo.toml.\n\nUsage: %s [-q ] [-i]\n\n-q\tQuiet; no output.\n-i\tNon-interactive mode.\n" "${0}" 1>&2; exit 1; }
|
||||
|
||||
while getopts "qi" o; do
|
||||
case "${o}" in
|
||||
q)
|
||||
QUIET="true"
|
||||
;;
|
||||
i)
|
||||
NONINTERACTIVE="true"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
VERSION=$(grep -m1 version meli/Cargo.toml | head -n1 | cut -d'"' -f 2 | head -n1)
|
||||
DEBIAN_CHANGELOG_VERSION=$(grep -m1 meli debian/changelog | head -n1 | cut -d'(' -f 2 | cut -d')' -f 1 | sed -e 's/\-[0-9]$//')
|
||||
|
||||
|
||||
if [ "${VERSION}" == "${DEBIAN_CHANGELOG_VERSION}" ]; then
|
||||
if [ -z "${QUIET}" ]; then
|
||||
printf "Versions match: %s\n" "${VERSION}"
|
||||
fi
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
if [ -z "${QUIET}" ]; then
|
||||
printf "Version in meli/Cargo.toml, %s, is not the same as the latest version in debian/changelog file, which is %s\n\n" "${VERSION}" "${DEBIAN_CHANGELOG_VERSION}"
|
||||
echo "Please update debian/changelog with the following diff:"
|
||||
author=$(grep -m1 authors meli/Cargo.toml | head -n1 | cut -d'"' -f 2 | head -n1)
|
||||
now=$(date -u +"%a, %d %b %Y %T +0000")
|
||||
prepend_value=$(cat <<EOF
|
||||
meli (${VERSION}-1) bookworm; urgency=low
|
||||
|
||||
-- ${author} ${now}
|
||||
|
||||
EOF
|
||||
)
|
||||
changelog_value=$(cat debian/changelog)
|
||||
patch_diff=$(LC_ALL=C TZ=UTC0 diff -Naur debian/changelog <(printf "%s\n\n%s\n" "${prepend_value}" "${changelog_value}"))
|
||||
printf "%s\n" "${patch_diff}"
|
||||
if [ -n "${NONINTERACTIVE}" ]; then
|
||||
echo "Apply the diff automatically?"
|
||||
select yn in "Yes" "No"; do
|
||||
case $yn in
|
||||
Yes ) break;;
|
||||
No ) exit 0;;
|
||||
esac
|
||||
done
|
||||
printf "%s\n" "${patch_diff}"|patch debian/changelog
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
Loading…
Reference in New Issue