From 453cc058d9ee6d7cb47529d99061216e72149a5f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 9 May 2021 06:21:55 +0200 Subject: Adding bin. Signed-off-by: Daniel Baumann --- bin/git-debian-check | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100755 bin/git-debian-check (limited to 'bin/git-debian-check') diff --git a/bin/git-debian-check b/bin/git-debian-check new file mode 100755 index 0000000..b4d5869 --- /dev/null +++ b/bin/git-debian-check @@ -0,0 +1,132 @@ +#!/bin/sh + +# source-tools - Manage Git repositories effectively and efficiently +# Copyright (C) 2014-2017 Daniel Baumann +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +FEATURE_BRANCH="progress-linux" +MAINTAINER="Progress Linux Maintainers " + +Main () +{ + REPOSITORY="$(basename $(git config --get remote.origin.url) .git)" + + echo "Checking ${REPOSITORY} repository:" + + # repository checks + for CHECK in /usr/lib/git-tools/repository-check.d/repository_* + do + ./${CHECK} + done + + ORIGINAL_BRANCH="$(git branch | awk '/^\* / { print $2 }')" + + case "${ORIGINAL_BRANCH}" in + ${FEATURE_BRANCH}) + ;; + + *) + git checkout ${FEATURE_BRANCH} + ;; + esac + + DISTRIBUTION="$(dpkg-parsechangelog | awk '/Distribution: / { print $2 }')" + + case ${DISTRIBUTION} in + *-extras) + BRANCHES="upstream ${FEATURE_BRANCH}" + ;; + + *) + BRANCHES="upstream debian ${FEATURE_BRANCH}" + ;; + esac + + # repository checks + for CHECK in /usr/lib/git-tools/repository-check.d/branch_* + do + ./${CHECK} + done + + BRANCHES="$(git branch | sed -e 's|^\* ||')" + + for BRANCH in ${BRANCHES} + do + case "${BRANCH}" in + upstream) + Branch_has_initial_empty_commit + ;; + esac + + # repository checks + for CHECK in /usr/lib/git-tools/repository-check.d/commit_* + do + ./${CHECK} + done + + # repository checks + for CHECK in /usr/lib/git-tools/repository-check.d/tag_* + do + ./${CHECK} + done + + # TODO: + # * git commits and tags have ever increasing commit date + done + + RELEASE="$(echo ${DISTRIBUTION} | sed -e 's|-extras||' -e 's|-security||' -e 's|-updates||')" + + VCS_BROWSER="https://sources.progress-linux.org/cgit/releases/${RELEASE}/packages" + VCS_GIT="git://sources.progress-linux.org/git/releases/${RELEASE}/packages" + + case "${REPOSITORY}" in + apt|dpkg|debian-archive-keyring|debian-keyring|clzip|lunzip|lzd|lzip|lziprecover|lzlib|pdlzip|plzip|zutils) + COMPRESSION="xz" + ;; + + *) + COMPRESSION="lzip" + ;; + esac + + # repository checks + for CHECK in /usr/lib/git-tools/repository-check.d/packaging_* + do + ./${CHECK} + done + + # TODO: + # * debian version + # * debian distribution + # * debian changelog entries + # * release tags only modify debian/changelog + + CURRENT_BRANCH="$(git branch | awk '/^\* / { print $2 }')" + + case "${CURRENT_BRANCH}" in + ${ORIGINAL_BRANCH}) + ;; + + *) + git checkout ${ORIGINAL_BRANCH} + ;; + esac + + echo "done." +} + +Main ${@} -- cgit v1.2.3