| 1 |
# -*-Shell-script-*- |
| 2 |
# |
| 3 |
# Copyright (C) 2015-2020 SUSE Software Solutions Germany GmbH |
| 4 |
# |
| 5 |
# Author: |
| 6 |
# Frank Sundermeyer <fsundermeyer at opensuse dot org> |
| 7 |
# |
| 8 |
########################################################################### |
| 9 |
# |
| 10 |
# Stylecheck |
| 11 |
# |
| 12 |
# Performs a stylecheck on rootid |
| 13 |
# |
| 14 |
########################################################################### |
| 15 |
function stylecheck { |
| 16 |
local SHORT_OPTS LONG_OPTS SUB_CMD |
| 17 |
SUB_CMD=$1 |
| 18 |
shift |
| 19 |
|
| 20 |
SHORT_OPTS="h" |
| 21 |
LONG_OPTS="file:,help,name:,rootid:,not-validate-tables,show" |
| 22 |
|
| 23 |
parse_args "$SHORT_OPTS" "$LONG_OPTS" "$SUB_CMD" "$@" |
| 24 |
eval set -- "$P_REMAIN_ARGS" |
| 25 |
|
| 26 |
#------ Computing the values returned from the parser ----- |
| 27 |
if [[ 1 -eq $P_HELP ]]; then |
| 28 |
help_scmd_head "$SUB_CMD" "${HELP_SUBCOMMAND[$SUB_CMD]}" |
| 29 |
help_file |
| 30 |
help_help |
| 31 |
help_name |
| 32 |
help_not-validate-tables |
| 33 |
help_rootid |
| 34 |
help_show_check |
| 35 |
echo -e " NOTES: * Options --file (-f) and --rootid exclude one another.\n * If neither file nor rootid is specified, the rootid\n from the DC-file is used\n * $SUB_CMD follows xi:includes\n" |
| 36 |
exit 0 |
| 37 |
fi |
| 38 |
|
| 39 |
if [[ -z "$P_ROOTID" && -z "$P_FILE" ]]; then |
| 40 |
if [[ 0 -eq $VERBOSITY ]]; then |
| 41 |
ccecho "info" "Neither file nor rootid specified, using rootid from DC-file" |
| 42 |
fi |
| 43 |
elif [[ -n "$P_ROOTID" && -n "$P_FILE" ]]; then |
| 44 |
exit_on_error "Options --file (-f) and --rootid exclude one another.\nPlease specify only one of these options" |
| 45 |
fi |
| 46 |
|
| 47 |
if [[ -n "$P_FILE" ]]; then |
| 48 |
ROOTID=$($XSLTPROC --stylesheet "$DAPSROOT/daps-xslt/common/get-rootelement-id.xsl" --file "$P_FILE" "$XSLTPROCESSOR" 2>/dev/null) || exit_on_error "Cannot get a rootid from file $FILE" |
| 49 |
export ROOTID |
| 50 |
fi |
| 51 |
|
| 52 |
call_make "$SUB_CMD" "$@" |
| 53 |
} |