diff options
Diffstat (limited to '')
20 files changed, 691 insertions, 0 deletions
diff --git a/bin/git-debian-check.d/branch_initial-empty-commit.sh b/bin/git-debian-check.d/branch_initial-empty-commit.sh new file mode 100755 index 0000000..8efc8e4 --- /dev/null +++ b/bin/git-debian-check.d/branch_initial-empty-commit.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) branch has initial empty commit..." + +ID="$(git log --no-abbrev-commit ${BRANCH} -- | awk '/^commit / { print $2 }' | tail -n1)" +MESSAGE="$(git show --no-patch --no-renames --pretty=format:%B ${ID} | head -n1)" + +if [ "${MESSAGE}" != "Initial commit." ] +then + echo " \033[1;31mno\033[0m." +else + echo " \033[1;32myes\033[0m." +fi diff --git a/bin/git-debian-check.d/comit_good-signatures.sh b/bin/git-debian-check.d/comit_good-signatures.sh new file mode 100755 index 0000000..3501639 --- /dev/null +++ b/bin/git-debian-check.d/comit_good-signatures.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) commits have good signatures..." + +IDS="$(git log ${BRANCH} -- | grep -c ^commit)" +SIGNATURES="$(git log --show-signature ${BRANCH} -- | grep -c '^gpg: Good signature from')" + +if [ "${IDS}" -ne "${SIGNATURES}" ] +then + echo " \033[1;31mno\033[0m." + echo "E: some commits on branch ${BRANCH} have no good signatures." +else + echo " \033[1;32myes\033[0m." +fi diff --git a/bin/git-debian-check.d/comit_signed-off-lines.sh b/bin/git-debian-check.d/comit_signed-off-lines.sh new file mode 100755 index 0000000..0940eaa --- /dev/null +++ b/bin/git-debian-check.d/comit_signed-off-lines.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) commits have Signed-off-by lines..." + +IDS="$(git log ${BRANCH} -- | grep -c ^commit)" +SIGNED="$(git log ${BRANCH} -- | grep -c '^ Signed-off-by: ')" + +if [ "${IDS}" -ne "${SIGNED}" ] +then + echo " \033[1;31mno\033[0m." + echo "E: some commits on branch ${BRANCH} have no Signed-off-by lines." +else + echo " \033[1;32myes\033[0m." +fi diff --git a/bin/git-debian-check.d/commit_message-begin-with-capital-letter.sh b/bin/git-debian-check.d/commit_message-begin-with-capital-letter.sh new file mode 100755 index 0000000..0cc981a --- /dev/null +++ b/bin/git-debian-check.d/commit_message-begin-with-capital-letter.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) commit messages begin with capital letter..." + +COMMITS="$(git log --no-abbrev-commit ${BRANCH} -- | awk '/^commit / { print $2 }')" + +for COMMIT in ${COMMITS} +do + MESSAGE="$(git show --no-patch --no-renames --pretty=format:%B ${COMMIT} | head -n1)" + + if ! echo ${MESSAGE} | grep -qs '^[A-Z]' + then + echo " \033[1;31mno\033[0m." + echo "E: commit message ${COMMIT} does not begin with capital letter." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/commit_message-end-with-full-stop.sh b/bin/git-debian-check.d/commit_message-end-with-full-stop.sh new file mode 100755 index 0000000..4a97e42 --- /dev/null +++ b/bin/git-debian-check.d/commit_message-end-with-full-stop.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) commit messages end with full stop..." + +COMMITS="$(git log --no-abbrev-commit ${BRANCH} -- | awk '/^commit / { print $2 }')" + +for COMMIT in ${COMMITS} +do + MESSAGE="$(git show --no-patch --no-renames --pretty=format:%B ${COMMIT} | head -n1)" + + if ! echo ${MESSAGE} | grep -qs '.$' + then + echo " \033[1;31mno\033[0m." + echo "E: commit message ${COMMIT} does not end with full stop." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/commit_release-commits-have-release-tags.sh b/bin/git-debian-check.d/commit_release-commits-have-release-tags.sh new file mode 100755 index 0000000..cdc2d98 --- /dev/null +++ b/bin/git-debian-check.d/commit_release-commits-have-release-tags.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) release commits have release tags..." + +COMMITS="$(git log --no-abbrev-commit ${BRANCH} -- | grep -B4 -E "(Releasing|Adding) ${BRANCH} version [0-9].*.$" | awk '/^commit / { print $2 }')" + +for COMMIT in ${COMMITS} +do + VERSION="$(git show --no-patch --no-renames --pretty=format:%B ${COMMIT} | head -n1 | awk -Fversion\ '{ print $2 }' | sed -e 's|.$||')" + TAG="$(echo ${VERSION} | sed -e 's|:|%|g' -e 's|~|_|g')" + ID="$(git show --no-abbrev-commit --no-patch --no-renames ${BRANCH}/${TAG} | awk '/^commit / { print $2 }')" + + if [ "${ID}" != "${COMMIT}" ] + then + echo " \033[1;31mno\033[0m." + echo "E: commit ${COMMIT} has no release tag." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/packaging_debian-maintainer-fields.sh b/bin/git-debian-check.d/packaging_debian-maintainer-fields.sh new file mode 100755 index 0000000..65dfcfd --- /dev/null +++ b/bin/git-debian-check.d/packaging_debian-maintainer-fields.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${FEATURE_BRANCH}\033[0m) debian maintainer field..." + +if ! grep -qs "^Maintainer: ${MAINTAINER}" debian/control +then + echo " \033[1;31mno\033[0m." + echo "E: packaging has no maintainer field." +fi + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/packaging_debian-source-compression.sh b/bin/git-debian-check.d/packaging_debian-source-compression.sh new file mode 100755 index 0000000..dabbbb7 --- /dev/null +++ b/bin/git-debian-check.d/packaging_debian-source-compression.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +COMPRESSION="${@}" + +echo -n " * (\033[0;32m${FEATURE_BRANCH}\033[0m) debian source compression..." + +case "${COMPRESSION}" in + lzip) + if grep -qs "^compression" debian/source/options + then + echo " \033[1;31mno\033[0m." + echo "E: wrong compression." + fi + ;; + + xz) + if [ "$(awk -F= '/^compression/ { print $2 }' debian/source/options | sed -e 's| ||g' -e 's|"||g')" != "xz" ] + then + echo " \033[1;31mno\033[0m." + echo "E: wrong compression." + fi + ;; +esac + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/packaging_debian-source-format.sh b/bin/git-debian-check.d/packaging_debian-source-format.sh new file mode 100755 index 0000000..060aef6 --- /dev/null +++ b/bin/git-debian-check.d/packaging_debian-source-format.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${FEATURE_BRANCH}\033[0m) debian package source format..." + +FORMAT="$(cat debian/source/format)" + +if [ "${FORMAT}" != "3.0 (quilt)" ] +then + echo " \033[1;31mno\033[0m." + echo "E: debian source format is not 3.0 (quilt)." +fi + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/packaging_debian-source-local-options.sh b/bin/git-debian-check.d/packaging_debian-source-local-options.sh new file mode 100755 index 0000000..a3a2bb6 --- /dev/null +++ b/bin/git-debian-check.d/packaging_debian-source-local-options.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${FEATURE_BRANCH}\033[0m) source local options..." + +if ! grep -qs ^abort-on-upstream-changes debian/source/local-options +then + echo " \033[1;31mno\033[0m." + echo "E: packaging has no source local options." +fi + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/packaging_debian-upload-urgency.sh b/bin/git-debian-check.d/packaging_debian-upload-urgency.sh new file mode 100755 index 0000000..8ee731f --- /dev/null +++ b/bin/git-debian-check.d/packaging_debian-upload-urgency.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${FEATURE_BRANCH}\033[0m) debian upload urgency..." + +DERIVATIVE_TAGS="$(git tag | grep "^${FEATURE_BRANCH}" | awk -F/ '{ print $2 }')" + +for DERIVATIVE_TAG in ${DERIVATIVE_TAGS} +do + DERIVATIVE_URGENCY="$(git show ${FEATURE_BRANCH}/${DERIVATIVE_TAG}:debian/changelog | head -n1 | awk -Furgency= '{ print $2 }' | sed -e 's| ||g')" + DISTRIBUTION="$(git show ${FEATURE_BRANCH}/${DERIVATIVE_TAG}:debian/changelog | head -n1 | awk '{ print $3 }' | sed -e 's|;$||')" + + case "${DISTRIBUTION}" in + *-extras) + URGENCY="low" + ;; + + *) + TAG="$(echo ${DERIVATIVE_TAG} | sed -e 's|-0+cairon[0-9]$||' -e 's|-0_cairon[0-9]$||' -e 's|-0cairon[0-9]$||' -e 's|_cairon[0-9]$||' -e 's|cairon[0-9]$||')" + URGENCY="$(git show debian/${TAG}:debian/changelog | head -n1 | awk -Furgency= '{ print $2 }' | sed -e 's| ||g')" + ;; + esac + + if [ "${DERIVATIVE_URGENCY}" != "${URGENCY}" ] + then + echo " \033[1;31mno\033[0m." + echo "E: wrong urgency of ${DERIVATIVE_TAG}, should be ${URGENCY} instead of ${DERIVATIVE_URGENCY}." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/packaging_debian-vcs-fields.sh b/bin/git-debian-check.d/packaging_debian-vcs-fields.sh new file mode 100755 index 0000000..476a947 --- /dev/null +++ b/bin/git-debian-check.d/packaging_debian-vcs-fields.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${FEATURE_BRANCH}\033[0m) debian vcs fields..." + +if ! grep -qs "^Vcs-Browser: ${VCS_BROWSER}/${REPOSITORY}.git" debian/control +then + echo " \033[1;31mno\033[0m." + echo "E: packaging has no vcs-browser field." +fi + +if ! grep -qs "Vcs-Git: ${VCS_GIT}/${REPOSITORY}.git" debian/control +then + echo " \033[1;31mno\033[0m." + echo "E: packaging has no vcs-git field." +fi + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/packaging_no-direct-upstream-changes.sh b/bin/git-debian-check.d/packaging_no-direct-upstream-changes.sh new file mode 100755 index 0000000..2cf0372 --- /dev/null +++ b/bin/git-debian-check.d/packaging_no-direct-upstream-changes.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${FEATURE_BRANCH}\033[0m) no direct upstream changes..." + +CHANGES="$(git diff upstream..${FEATURE_BRANCH} | grep -E '^(---|\+\+\+) (a|b)/' | sed -e 's|--- a/||g' -e 's|+++ a/||g' -e 's|--- b/||g' -e 's|+++ b/||g' | grep -v ^debian\/ || true)" + +if [ -n "${CHANGES}" ] +then + echo " \033[1;31mno\033[0m." + echo "E: packaging has direct upstream changes." +fi + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/repository_branches-exist.sh b/bin/git-debian-check.d/repository_branches-exist.sh new file mode 100755 index 0000000..dfbdd9e --- /dev/null +++ b/bin/git-debian-check.d/repository_branches-exist.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +BRANCHES="${@}" + +echo -n " * [\033[1;34m${REPOSITORY}\033[0m] branches \"${BRANCHES}\" exist..." + +for BRANCH in ${BRANCHES} +do + if ! git branch | grep -qs " ${BRANCH}$" + then + echo " \033[1;31mno\033[0m." + echo "E: repository has no ${BRANCH} branch." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/repository_branches-not-exist.sh b/bin/git-debian-check.d/repository_branches-not-exist.sh new file mode 100755 index 0000000..69b3251 --- /dev/null +++ b/bin/git-debian-check.d/repository_branches-not-exist.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +BRANCHES="${@}" + +echo -n " * [\033[1;34m${REPOSITORY}\033[0m] no other branches..." + +BRANCHES="$(echo ${@} | sed -e 's| |\||g')" +BRANCH="$(echo $(git branch | grep -Ev " (${BRANCHES})$" || true) | sed -e 's| | |g')" + +if [ -n "${BRANCH}" ] +then + echo " \033[1;31mno\033[0m." + echo "E: repository has other branches ${BRANCH}." +fi + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/repository_clean-working-directory.sh b/bin/git-debian-check.d/repository_clean-working-directory.sh new file mode 100755 index 0000000..72aa501 --- /dev/null +++ b/bin/git-debian-check.d/repository_clean-working-directory.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * [\033[1;34m${REPOSITORY}\033[0m] repository working directory clean..." + +if ! git status 2>&1 | grep -qs "^nothing to commit, working directory clean$" +then + echo " \033[1;31mno\033[0m." + echo "E: repository has unclean working directory." + exit 1 +fi + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/tag_all-tags-are-on-branch.sh b/bin/git-debian-check.d/tag_all-tags-are-on-branch.sh new file mode 100755 index 0000000..7463758 --- /dev/null +++ b/bin/git-debian-check.d/tag_all-tags-are-on-branch.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) tags are on branch..." + +TAGS="$(git tag | grep ^${BRANCH}/ | sort -V)" + +for TAG in ${TAGS} +do + ID="$(git show --no-abbrev-commit --no-patch --no-renames ${TAG} | awk '/^commit / { print $2 }')" + + if ! git log --no-abbrev-commit ${BRANCH} -- | grep -Eqs "^commit ${ID}($| \()" + then + echo " \033[1;31mno\033[0m." + echo "E: tag ${TAG} is not on branch." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/tag_messages-match-release-commit.sh b/bin/git-debian-check.d/tag_messages-match-release-commit.sh new file mode 100755 index 0000000..e53a87a --- /dev/null +++ b/bin/git-debian-check.d/tag_messages-match-release-commit.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) tag messages matches release commit..." + +TAGS="$(git tag | grep ^${BRANCH}/ | sort -V)" + +for TAG in ${TAGS} +do + VERSION="$(echo ${TAG} | awk -F/ '{ print $2 }' | sed -e 's|%|:|g' -e 's|_|~|g')" + + if ! git show --no-patch --no-renames ${TAG} | grep -Eqs "^ (Releasing|Adding) ${BRANCH} version $(echo ${VERSION} | sed -e 's|+|\\+|g').$" + then + echo " \033[1;31mno\033[0m." + echo "E: tag message ${TAG} does not match release commit." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/tag_messages-match-version.sh b/bin/git-debian-check.d/tag_messages-match-version.sh new file mode 100755 index 0000000..c4edef0 --- /dev/null +++ b/bin/git-debian-check.d/tag_messages-match-version.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) tag messages matches version..." + +TAGS="$(git tag | grep ^${BRANCH}/ | sort -V)" + +for TAG in ${TAGS} +do + VERSION="$(echo ${TAG} | awk -F/ '{ print $2 }' | sed -e 's|%|:|g' -e 's|_|~|g')" + + if ! git show --no-patch --no-renames ${TAG} | grep -qs "^Tagging ${BRANCH} version ${VERSION}.$" + then + echo " \033[1;31mno\033[0m." + echo "E: tag message ${TAG} does not match version ${VERSION}." + fi +done + +echo " \033[1;32myes\033[0m." diff --git a/bin/git-debian-check.d/tag_signatures-with-gnupg.sh b/bin/git-debian-check.d/tag_signatures-with-gnupg.sh new file mode 100755 index 0000000..d74055d --- /dev/null +++ b/bin/git-debian-check.d/tag_signatures-with-gnupg.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# source-tools - Git extra utilities +# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# +# 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 <http://www.gnu.org/licenses/>. + +set -e + +echo -n " * (\033[0;32m${BRANCH}\033[0m) tags signatures with gnupg..." + +TAGS="$(git tag | grep ^${BRANCH}/ | sort -V)" + +for TAG in ${TAGS} +do + if ! git show --no-patch --no-renames ${TAG} | grep -qs '^Version: GnuPG v1$' + then + echo " \033[1;31mno\033[0m." + echo "E: tag ${TAG} has no signature with gnupg." + fi +done + +echo " \033[1;32myes\033[0m." |