Blame Scripts/CentOS-Art/Functions/cli_checkRepoDirTarget.sh

328582
#!/bin/bash
328582
#
328582
# cli_checkRepoDirTarget.sh -- This function provides input validation
328582
# to repository entries considered as target location.
328582
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
328582
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
328582
# General Public License for more details.
328582
#
328582
# You should have received a copy of the GNU General Public License
328582
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
328582
# ----------------------------------------------------------------------
571f97
# $Id$
328582
# ----------------------------------------------------------------------
328582
328582
function cli_checkRepoDirTarget {
328582
0c579a
    local LOCATION="$1"
328582
328582
    # Redefine target value to build repository absolute path from
328582
    # repository top level on. As we are removing
328582
    # /home/centos/artwork/ from all centos-art.sh output (in order to
328582
    # save horizontal output space), we need to be sure that all
328582
    # strings begining with trunk/..., branches/..., and tags/... use
328582
    # the correct absolute path. That is, you can refer trunk's
328582
    # entries using both /home/centos/artwork/trunk/... or just
328582
    # trunk/..., the /home/centos/artwork/ part is automatically added
328582
    # here. 
0c579a
    if [[ $LOCATION =~ '^(trunk|branches|tags)/.+$' ]];then
4d6690
        LOCATION=${CLI_WRKCOPY}/$LOCATION 
328582
    fi
328582
0c579a
    # Print target location.
0c579a
    echo $LOCATION
328582
328582
}