Home Home > GIT Browse > SLE12-SP5
summaryrefslogtreecommitdiff
blob: 237bbc5dcedc3e9d3116fc2d37d8016b63793857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/bash

#############################################################################
# Copyright (c) 2004-2006,2008,2009 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# 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, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################
 
# Check if all files referenced by series.conf are in GIT and vice versa.
# Also check that none of the referenced files is deleted in the working tree.
 

. ${0%/*}/wd-functions.sh

if ! $using_git || test ! -e series.conf; then
	exit 0
fi

export LANG=C

if test "$1" = "--committed"; then
	cmd="git ls-tree -r --name-only HEAD"
	# The kabi/ and sysctl/ directories are packaged as whole, so we need
	# to ensure that there are no untracked files in them
	kabi_untracked=$(git ls-files -d -o -m --directory --exclude-standard kabi/ sysctl/ | sort -u)
else
	cmd="git ls-files --cached"
	kabi_untracked=
fi
in_repo="$($cmd | grep '^patches\..*/' | sort -u)"
in_series="$(scripts/guards --list < series.conf | sort -u)"
deleted=$(git ls-files --deleted | grep '^patches\..*/' | sort -u)
in_repo=$(join -v1 <(echo "$in_repo") <(echo "$deleted"))

series_missing=$(join -v1 <(echo "$in_repo") <(echo "$in_series"))
repo_missing=$(join -v2 <(echo "$in_repo") <(echo "$in_series"))

status=0
if test -n "$series_missing"; then
	printf 'Not in series.conf: %s\n' $series_missing >&2
	status=1
fi
if test -n "$repo_missing$kabi_untracked"; then
	printf 'Not in GIT: %s\n' $repo_missing $kabi_untracked >&2
	status=1
fi

exit $status