diff --git a/Scripts/Modules/Locale/Modules/Directories/directories.sh b/Scripts/Modules/Locale/Modules/Directories/directories.sh index 5284026..05ff094 100755 --- a/Scripts/Modules/Locale/Modules/Directories/directories.sh +++ b/Scripts/Modules/Locale/Modules/Directories/directories.sh @@ -33,7 +33,7 @@ function directories { # Sanitate non-option arguments to be sure they match the # directory conventions established by centos-art.sh script # against source directory locations in the working copy. - local DIRECTORY=$(tcar_checkRepoDirSource ${1}) + local DIRECTORY=$(tcar_checkWorkDirSource ${1}) # Define regular expression used by locale module to determine the # file extension that it can retrieve translatable strings from, diff --git a/Scripts/Modules/Locale/Modules/Files/files.sh b/Scripts/Modules/Locale/Modules/Files/files.sh index ecd8095..c5f46a8 100755 --- a/Scripts/Modules/Locale/Modules/Files/files.sh +++ b/Scripts/Modules/Locale/Modules/Files/files.sh @@ -28,7 +28,7 @@ function files { # Define absolute path of argument passed in the command-line. - local RENDER_FROM=$(tcar_checkRepoDirSource "${1}") + local RENDER_FROM=$(tcar_checkWorkDirSource "${1}") # Verify the argument passed in the command-line is a regular # file. diff --git a/Scripts/Modules/Locale/locale.sh b/Scripts/Modules/Locale/locale.sh index a85a553..6fbcd8c 100755 --- a/Scripts/Modules/Locale/locale.sh +++ b/Scripts/Modules/Locale/locale.sh @@ -61,7 +61,7 @@ function locale { # are files or directories. for ARGUMENT in ${TCAR_MODULE_ARGUMENT};do - local ARGUMENT=$(tcar_checkRepoDirSource "${ARGUMENT}") + local ARGUMENT=$(tcar_checkWorkDirSource "${ARGUMENT}") if [[ -f ${ARGUMENT} ]];then tcar_setModuleEnvironment -m "files" -t "child" -g "${ARGUMENT}" diff --git a/Scripts/Modules/Tuneup/tuneup.sh b/Scripts/Modules/Tuneup/tuneup.sh index 1d8b05a..1117882 100755 --- a/Scripts/Modules/Tuneup/tuneup.sh +++ b/Scripts/Modules/Tuneup/tuneup.sh @@ -36,7 +36,7 @@ function tuneup { # Sanitate non-option arguments to be sure they match the # directory conventions established by tcar.sh script # against source directory locations in the working copy. - local ARGUMENT=$(tcar_checkRepoDirSource ${ARGUMENT}) + local ARGUMENT=$(tcar_checkWorkDirSource ${ARGUMENT}) # Build list of files to process. if [[ -f ${ARGUMENT} ]];then diff --git a/Scripts/tcar_checkRepoDirSource.sh b/Scripts/tcar_checkRepoDirSource.sh deleted file mode 100755 index 91e18e3..0000000 --- a/Scripts/tcar_checkRepoDirSource.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -###################################################################### -# -# tcar - The CentOS Artwork Repository automation tool. -# Copyright © 2014 The CentOS Artwork SIG -# -# 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 2 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, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Alain Reguera Delgado -# 39 Street No. 4426 Cienfuegos, Cuba. -# -###################################################################### - -# Standardizes the path construction of directories inside the working -# copy, using absolute paths. This function transforms relative paths -# passed as non-option arguments to tcar.sh script command-line into -# absolute paths inside the working copy, based on whether you are -# using Subversion or Git as version control system. Further -# verifications, (e.g., whether they really exist as directories -# inside the working copy or not) should be realized outside this -# function. -# -# Use this function whenever you want to be sure non-option arguments -# passed to tcar.sh script command-line do always point to directories -# inside the working copy. Transforming relative paths into absolute -# paths, before processing them, is very useful when you need to -# execute the tcar.sh script as command (e.g., `tcar') anywhere on -# your workstation. -function tcar_checkRepoDirSource { - - local LOCATION=${1} - - # Remove any dot from arguments passed to tcar.sh script. - # This way it is possible to use a single dot to reflect the - # current location from which tcar.sh was executed. Notice - # that using a dot as argument is optional (e.g.: when you pass no - # argument to tcar command-line, the current location is - # used as default location). However, it might be useful to use a - # dot as argument when you want to include the current location in - # a list of arguments to process. Don't forget that dot slash can - # be used to refer locations relatively. - LOCATION=$(echo "${LOCATION}" | sed -r "s,^\.(/([[:alnum:]_/.-]+)?)?$,$(pwd)\1,g") - - # Remove the path to repository's base directory from location in - # order to avoid path duplications here. - LOCATION=$(echo "${LOCATION}" | sed "s,${TCAR_BASEDIR}/,,g") - - # When we use Git as version control system, there isn't a need of - # using the `trunk', `branches', `tags' convention we were using - # for Subversion. The working copy begins directly with the - # content of our repository (e.g., Documentation, Scripts, - # Identity and Locales). - # - # When we use Subversion as version control system, we follow the - # `trunk', `branches', `tags' convention to organize files inside - # the repository and need to redefine the source path in order to - # build the repository absolute path from the repository top level - # on. As convention, when you prepare your working copy through - # tcar.sh script, the absolute path to the `trunk/' - # directory is used as working copy. This is, path arguments - # provided to tcar.sh script will be interpreted from trunk/ - # directory level on. For example, the following command should - # work correctly in both Subversion and Git repositories: - # - # tcar render Documentation/Manuals/Docbook/Tcar-ug - # - # There isn't a need of verifying the paths built here. This is - # something we do later, using the tcar_checkFiles function. We - # don't do the file verification here to avoid malformed error - # messages when we reassign variable values using this function as - # reference (e.g., in order to prevent error messages from being - # stored inside variables.). - LOCATION=${TCAR_BASEDIR}/${LOCATION} - - # Remove trailing slashes passed as argument. The single slash - # form is used to refer the repository's root directory. The - # single slash form passed as argument of tcar.sh script is - # useful to execute commands over the - # entire repository tree. - echo "${LOCATION}" | sed -r -e 's,/+,/,g' -e 's,/+$,,g' - -} diff --git a/Scripts/tcar_checkWorkDirSource.sh b/Scripts/tcar_checkWorkDirSource.sh index 118460f..69f5c98 100755 --- a/Scripts/tcar_checkWorkDirSource.sh +++ b/Scripts/tcar_checkWorkDirSource.sh @@ -38,8 +38,8 @@ function tcar_checkWorkDirSource { fi # Remove both consecutive slashes and trailing slashes from final - # location. - echo "${LOCATION}" | sed -r -e 's,/+,/,g' -e 's,/+$,,g' + # location. Remove dot-slash, as well. + echo "${LOCATION}" | sed -r -e 's,/+,/,g' -e 's,/+$,,g' -e 's,\./,,g' # The single slash form doesn't point to repository's root # directory anymore. Instead, when a single slash is passed