Jeff Mahoney 77b939
#!/bin/bash
Jeff Mahoney 77b939
Jeff Mahoney 77b939
#############################################################################
Jeff Mahoney 77b939
# Copyright (c) 2017 SUSE
Jeff Mahoney 77b939
# All Rights Reserved.
Jeff Mahoney 77b939
#
Jeff Mahoney 77b939
# This program is free software; you can redistribute it and/or
Jeff Mahoney 77b939
# modify it under the terms of version 2 of the GNU General Public License as
Jeff Mahoney 77b939
# published by the Free Software Foundation.
Jeff Mahoney 77b939
#
Jeff Mahoney 77b939
# This program is distributed in the hope that it will be useful,
Jeff Mahoney 77b939
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Jeff Mahoney 77b939
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
Jeff Mahoney 77b939
# GNU General Public License for more details.
Jeff Mahoney 77b939
#
Jeff Mahoney 77b939
# You should have received a copy of the GNU General Public License
Jeff Mahoney 77b939
# along with this program; if not, contact Novell, Inc.
Jeff Mahoney 77b939
#
Jeff Mahoney 77b939
# To contact SUSE about this file by physical or electronic mail,
Jeff Mahoney 77b939
# you may find current contact information at www.suse.com
Jeff Mahoney 77b939
#############################################################################
Jeff Mahoney 77b939
Jeff Mahoney 77b939
. ${0%/*}/wd-functions.sh
Jeff Mahoney 77b939
Jeff Mahoney 77b939
branch="$(get_branch_name)"
Jeff Mahoney 77b939
Jeff Mahoney 77b939
result=true
Jeff Mahoney 77b939
check=false
Jeff Mahoney 77b939
Jeff Mahoney 77b939
# This policy starts with master and stable but will apply to
Jeff Mahoney 77b939
# future releases starting with SLE15-SP1 and the next openSUSE release
Jeff Mahoney 77b939
# following 42.3
Jeff Mahoney 77b939
case $branch in
Jeff Mahoney 77b939
SLES9*|SLES10*|SLE11-*|SLE12-*|SLE15)
Jeff Mahoney 77b939
    ;;
Jeff Mahoney 77b939
openSUSE-1*|openSUSE-42.[123])
Jeff Mahoney 77b939
    ;;
Jeff Mahoney 77b939
*)
Jeff Mahoney 77b939
    check=true
Jeff Mahoney 77b939
    ;;
Jeff Mahoney 77b939
esac
Jeff Mahoney 77b939
Jeff Mahoney 77b939
if $check; then
Jeff Mahoney 77b939
    for file in "$@"; do
Jeff Mahoney 77b939
	# We don't care about anything outside of the patches.* directories
Jeff Mahoney 77b939
	case "$file" in
Jeff Mahoney 77b939
	patches.*)
Jeff Mahoney 77b939
	    ;;
Jeff Mahoney 77b939
	*)
Jeff Mahoney 77b939
	    continue
Jeff Mahoney 77b939
	    ;;
Jeff Mahoney 77b939
	esac
Jeff Mahoney 77b939
Jeff Mahoney 77b939
	case "$file" in
Jeff Mahoney 77b939
	patches.suse/*|patches.rpmify/*|patches.kabi/*|patches.kernel.org/*)
Jeff Mahoney 77b939
	    ;;
Jeff Mahoney 77b939
	*)
Jeff Mahoney 77b939
	    echo "** $file is in obsolete directory \"${file%%/*}\""
Jeff Mahoney 77b939
	    result=false
Jeff Mahoney 77b939
	    ;;
Jeff Mahoney 77b939
	esac
Jeff Mahoney 77b939
    done
Jeff Mahoney 77b939
Jeff Mahoney 77b939
    if ! $result; then
Jeff Mahoney 77b939
	echo "Valid patch directories are:"
Jeff Mahoney 77b939
	echo "* patches.kernel.org"
Jeff Mahoney 77b939
	echo "* patches.rpmify"
Jeff Mahoney 77b939
	echo "* patches.kabi"
Jeff Mahoney 77b939
	echo "* patches.suse"
Jeff Mahoney 77b939
    fi
Jeff Mahoney 77b939
fi
Jeff Mahoney 77b939
Jeff Mahoney 77b939
$result