From dd435dd1f22b4c83649b3ffc54e0fe922064aed7 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Nov 01 2013 04:23:35 +0000 Subject: Remove Vcs functionality from centos-art.sh script. - The vcs functionality was created to handle version control operations as part of the production process. Version control as part of production is not critical for production tasks and, in some cases, makes it slower. The current implementation of Vcs function isn't integrated to centos-art.sh script modular design. Because of this, it hasn't been used for a while and that time proves me it is not very much needed (e.g., as locale and render would be). This update removes the Vcs directory structure from modules directory. --- diff --git a/Automation/Modules/Vcs/Git/git.sh b/Automation/Modules/Vcs/Git/git.sh deleted file mode 100755 index 0f6bdd5..0000000 --- a/Automation/Modules/Vcs/Git/git.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# git.sh -- This function standardizes Git tasks inside the -# repository. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git { - - # Redefine positional parameters using ARGUMENTS. At this point, - # option arguments have been removed from ARGUMENTS variable and - # only non-option arguments remain in it. - eval set -- "$ARGUMENTS" - - # Don't realize action value verification here. There are actions - # like `copy' and `rename' that require two arguments from which - # the last one doesn't exist at the moment of executing the - # command. This will provoke the second action value verification - # to fail when indeed is should not. Thus, go to action names - # processing directly. - - # All git actions will be performed against the working copy. - # Otherwise, errors like `fatal: Not a git repository (or any of - # the parent directories): .git' or `Unable to determine absolute - # path of git directory' might occur. So, move from whenever you - # be right now up to the git working copy. - pushd ${TCAR_WORKDIR} > /dev/null - - # Execute action names. This is required in order to realize - # actions like copy and rename which need two values as argument. - # Otherwise, it wouldn't be possible to execute them because - # action values would be processed one a time. Thus, lets work - # with `$@' instead. - for ACTIONNAM in $ACTIONNAMS;do - $ACTIONNAM "$@" - done - - # Return to the place you were initially. - popd > /dev/null - -} diff --git a/Automation/Modules/Vcs/Git/git_commitRepoChanges.sh b/Automation/Modules/Vcs/Git/git_commitRepoChanges.sh deleted file mode 100755 index f965966..0000000 --- a/Automation/Modules/Vcs/Git/git_commitRepoChanges.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash -# -# git_commitRepoChanges.sh -- This function standardizes the way local -# changes are committed up to central repository. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_commitRepoChanges { - - local -a FILES - local -a INFO - local -a FILESNUM - local COUNT=0 - local STATUSOUT='' - local PREDICATE='' - local CHNGTOTAL=0 - local LOCATION=$(cli_checkRepoDirSource "${1}") - - # Verify source location absolute path. It should point to - # existent files or directories. They don't need to be under - # version control. - cli_checkFiles ${LOCATION} -e - - # Print action message. - cli_printMessage "`gettext "Checking changes in the working copy"`" --as-banner-line - - # Build list of files that have received changes in its version - # status. Be sure to keep output files off from this list. - # Remember, output files are not version inside the working copy, - # so they are not considered for evaluation here. But take care, - # sometimes output files are in the same format of source files, - # so we need to differentiate them using their locations. - STATUSOUT="$(${COMMAND} status --porcelain ${LOCATION})" - - # Process location based on its path information. Both - # by-extension and by-location exclusions are no longer needed - # here. They are already set in the `.git/info/exclude' file. - - # Define path to files considered recent modifications from - # working copy up to local repository. - FILES[0]=$(echo "$STATUSOUT" | egrep "^[[:space:]]M") - FILES[1]=$(echo "$STATUSOUT" | egrep "^\?\?") - FILES[2]=$(echo "$STATUSOUT" | egrep "^[[:space:]]D") - FILES[3]=$(echo "$STATUSOUT" | egrep "^[[:space:]]A") - FILES[4]=$(echo "$STATUSOUT" | egrep "^(A|M|R|C)( |M|D)") - - # Define description of files considered recent modifications from - # working copy up to local repository. - INFO[0]="`gettext "Modified"`" - INFO[1]="`gettext "Untracked"`" - INFO[2]="`gettext "Deleted"`" - INFO[3]="`gettext "Added"`" - INFO[4]="`gettext "Staged"`" - - while [[ $COUNT -ne ${#FILES[*]} ]];do - - # Define total number of files. Avoid counting empty line. - if [[ "${FILES[$COUNT]}" == '' ]];then - FILESNUM[$COUNT]=0 - else - FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) - fi - - # Calculate total amount of changes. - CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) - - # Build report predicate. Use report predicate to show any - # information specific to the number of files found. For - # example, you can use this section to show warning messages, - # notes, and so on. By default we use the word `file' or - # `files' at ngettext's consideration followed by change - # direction. - PREDICATE[$COUNT]=`ngettext "file in the working copy" \ - "files in the working copy" $((${FILESNUM[$COUNT]} + 1))` - - # Output report line. - cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" --as-stdout-line - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - - # Stage files - cli_printMessage "`gettext "Do you want to stage files?"`" --as-yesornorequest-line - ${COMMAND} add ${LOCATION} - - # See staged differences. - cli_printMessage "`gettext "Do you want to see staged files differences?"`" --as-yesornorequest-line - ${COMMAND} diff --staged ${LOCATION} | less - - # Commit staged files. - cli_printMessage "`gettext "Do you want to commit staged files differences?"`" --as-yesornorequest-line - ${COMMAND} commit ${LOCATION} - - # Push committed files. - cli_printMessage "`gettext "Do you want to push committed files?"`" --as-yesornorequest-line - ${COMMAND} push - -} diff --git a/Automation/Modules/Vcs/Git/git_copyRepoFile.sh b/Automation/Modules/Vcs/Git/git_copyRepoFile.sh deleted file mode 100755 index 28e9cab..0000000 --- a/Automation/Modules/Vcs/Git/git_copyRepoFile.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# git_copyRepoFile.sh -- This function standardizes the way files -# (including directories) are duplicated inside the working copy. This -# function is an interface for git's `copy' command. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_copyRepoFile { - - local SOURCE=$(cli_checkRepoDirSource ${1}) - local TARGET=$(cli_checkRepoDirSource ${2}) - - # Verify source location absolute path. It should point to - # existent files or directories. They don't need to be under - # version control. - cli_checkFiles ${SOURCE} -e - - # Print action reference. - if [[ -f ${SOURCE} ]];then - cli_printMessage "${TARGET}/$(basename ${SOURCE})" --as-creating-line - else - cli_printMessage "${TARGET}" --as-creating-line - fi - - # Copy source location to its target using version control. I - # didn't find a copy command for Git. If you know a better way to - # track a copy action through Git, set it here. - /bin/cp ${SOURCE} ${TARGET} - if [[ $? -eq 0 ]];then - ${COMMAND} add ${TARGET} - fi - -} diff --git a/Automation/Modules/Vcs/Git/git_deleteRepoFile.sh b/Automation/Modules/Vcs/Git/git_deleteRepoFile.sh deleted file mode 100755 index 3623084..0000000 --- a/Automation/Modules/Vcs/Git/git_deleteRepoFile.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# -# git_deleteRepoFile.sh -- This function standardizes the way -# centos-art.sh script deletes files and directories inside the -# working copy. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_deleteRepoFile { - - local TARGET=$(cli_checkRepoDirSource ${1}) - - # Print action reference. - cli_printMessage "${TARGET}" --as-deleting-line - - # Reset target to its default status before remove it from the - # work copy. - if [[ $(cli_runFnEnvironment vcs --status ${TARGET}) =~ '^(A|M|R)$' ]];then - ${COMMAND} reset HEAD ${TARGET} --quiet - fi - - # Remove target based on whether it is under version control or - # not. - if [[ $(cli_runFnEnvironment vcs --status ${TARGET}) =~ '^\?\?$' ]];then - # Target isn't under version control. - if [[ -d ${TARGET} ]];then - rm -r ${TARGET} - else - rm ${TARGET} - fi - else - # Target is under version control. - if [[ -d ${TARGET} ]];then - ${COMMAND} rm ${TARGET} -r --force --quiet - else - ${COMMAND} rm ${TARGET} --force --quiet - fi - fi - -} diff --git a/Automation/Modules/Vcs/Git/git_getRepoStatus.sh b/Automation/Modules/Vcs/Git/git_getRepoStatus.sh deleted file mode 100755 index b54bd51..0000000 --- a/Automation/Modules/Vcs/Git/git_getRepoStatus.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# git_getRepoStatus.sh -- This function requests the working copy -# using the status command and returns the first character in the -# output line, as described in git help status, for the LOCATION -# specified. Use this function to perform verifications based a -# repository LOCATION status. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_getRepoStatus { - - local LOCATION=$(cli_checkRepoDirSource "$1") - - # Verify source location absolute path. It should point either to - # existent files or directories both under version control inside - # the working copy. Otherwise, if it doesn't point to an existent - # file under version control, finish the script execution with an - # error message. - cli_checkFiles ${LOCATION} -e - - # Define regular expression pattern to retrieve the work tree - # status. This is the second character of the first column - # returned by `git status --porcelain' command. - local PATTERN='^(.)(.)[[:space:]]+.+$' - - # Output the work tree status. - ${COMMAND} status "$LOCATION" --porcelain \ - | sed -r "s/${PATTERN}/\2/" - -} diff --git a/Automation/Modules/Vcs/Git/git_isVersioned.sh b/Automation/Modules/Vcs/Git/git_isVersioned.sh deleted file mode 100755 index 0b8c814..0000000 --- a/Automation/Modules/Vcs/Git/git_isVersioned.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# git_isVersioned.sh -- This function determines whether a location is -# under version control or not. When the location is under version -# control, this function returns `0'. When the location isn't under -# version control, this function returns `1'. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_isVersioned { - - # Define the location absolute path we want to determine whether - # it is under version control or not. Only the first non-option - # argument passed to centos-art.sh command-line will be used. - local LOCATION=$(cli_checkRepoDirSource "${1}") - - # Use Git to determine whether the location is under version - # control or not. - local OUTPUT=$(${COMMAND} status --porcelain ${LOCATION} \ - | egrep "\?\? ${LOCATION}") - - # If there are unversioned files inside location, stop the script - # execution with an error message. All files must be under version - # control except those set in the `.git/info/exclude/' file. - if [[ ! -z ${OUTPUT} ]];then - cli_printMessage "${LOCATION} `gettext " contains untracked files."`" --as-error-line - fi - -} diff --git a/Automation/Modules/Vcs/Git/git_mkRepoDirectory.sh b/Automation/Modules/Vcs/Git/git_mkRepoDirectory.sh deleted file mode 100755 index fd9fe0b..0000000 --- a/Automation/Modules/Vcs/Git/git_mkRepoDirectory.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# git_mkRepoDirectory.sh -- This function standardizes the way -# centos-art.sh script creates directories inside the working copy. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_mkRepoDirectory { - - local TARGET=$(cli_checkRepoDirSource ${1}) - - # Print action reference. - cli_printMessage "${TARGET}" --as-creating-line - - # Copy source location to its target using version control. - /bin/mkdir ${TARGET} - ${COMMAND} add ${TARGET} - -} diff --git a/Automation/Modules/Vcs/Git/git_syncRepoChanges.sh b/Automation/Modules/Vcs/Git/git_syncRepoChanges.sh deleted file mode 100755 index c2aa395..0000000 --- a/Automation/Modules/Vcs/Git/git_syncRepoChanges.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# git_syncRepoChanges.sh -- This function standardizes the way changes -# are brought from central repository and merged into the local -# repository. It also standardizes the way local changes are send from -# the local repository up to central repository. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_syncRepoChanges { - - local LOCATION='' - local LOCATIONS="${@}" - - for LOCATION in $LOCATIONS;do - - # Verify whether the location is valid or not. - LOCATION=$(cli_checkRepoDirSource ${LOCATION}) - - # Verify source location absolute path. It should point either - # to existent files or directories both under version control - # inside the working copy. Otherwise, if it doesn't point to - # an existent file under version control, finish the script - # execution with an error message. - cli_checkFiles ${LOCATION} -e --is-versioned - - # Bring changes from the repository into the working copy. - git_updateRepoChanges ${LOCATION} - - # Check changes in the working copy. - git_commitRepoChanges ${LOCATION} - - done - -} diff --git a/Automation/Modules/Vcs/Git/git_updateRepoChanges.sh b/Automation/Modules/Vcs/Git/git_updateRepoChanges.sh deleted file mode 100755 index f24f399..0000000 --- a/Automation/Modules/Vcs/Git/git_updateRepoChanges.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# git_updateRepoChanges.sh -- This function standardizes the way -# changes are merged into the repository's local working copy. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function git_updateRepoChanges { - - # Print action message. - cli_printMessage "`gettext "Bringing changes from the repository into the working copy"`" --as-banner-line - - # Update working copy and retrieve update output. When we use - # git, it is not possible to bring changes for specific - # directories trees but the whole repository tree. So, we need to - # position the script in the local working copy directory and - # execute the pull command therein. - # - # NOTE: The `${COMMAND} pull' command triggers the error `Unable - # to determine absolute path of git directory' while fetch and - # merge equivalents seems to do what we expect without any visible - # error. - ${COMMAND} fetch - ${COMMAND} merge FETCH_HEAD - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion.sh b/Automation/Modules/Vcs/Subversion/subversion.sh deleted file mode 100755 index a534496..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# subversion.sh -- This function standardizes Subversion tasks inside -# the repository. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion { - - # Redefine positional parameters using ARGUMENTS. At this point, - # option arguments have been removed from ARGUMENTS variable and - # only non-option arguments remain in it. - eval set -- "$ARGUMENTS" - - # Don't realize action value verification here. There are actions - # like `copy' and `rename' that require two arguments from which - # the last one doesn't exist at the moment of executing the - # command. This will provoke the second action value verification - # to fail when indeed is should not. Thus, go to action names - # processing directly. - - # Execute action names. This is required in order to realize - # actions like copy and rename which need two values as argument. - # Otherwise, it wouldn't be possible to execute them because - # action values would be processed one a time. Thus, lets work - # with `$@' instead. - for ACTIONNAM in $ACTIONNAMS;do - $ACTIONNAM "$@" - done - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_commitRepoChanges.sh b/Automation/Modules/Vcs/Subversion/subversion_commitRepoChanges.sh deleted file mode 100755 index 84d0ce7..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_commitRepoChanges.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash -# -# subversion_commitRepoChanges.sh -- This function explores the -# working copy and commits changes up to central repository after -# checking changes and adding files which aren't under version -# control. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_commitRepoChanges { - - local -a FILES - local -a INFO - local -a FILESNUM - local COUNT=0 - local STATUSOUT='' - local PREDICATE='' - local CHNGTOTAL=0 - local LOCATION=$(cli_checkRepoDirSource "$1") - - # Verify source location absolute path. It should point either to - # existent files or directories both under version control inside - # the working copy. Otherwise, if it doesn't point to an existent - # file under version control, finish the script execution with an - # error message. - cli_checkFiles ${LOCATION} -e --is-versioned - - # Print action message. - cli_printMessage "`gettext "Checking changes in the working copy"`" --as-banner-line - - # Build list of files that have received changes in its version - # status. Be sure to keep output files off from this list. - # Remember, output files are not version inside the working copy, - # so they are not considered for evaluation here. But take care, - # sometimes output files are in the same format of source files, - # so we need to differentiate them using their locations. - - # Process location based on its path information. - if [[ ${LOCATION} =~ 'Documentation/Manuals/Texinfo)' ]];then - STATUSOUT="$(${COMMAND} status ${LOCATION} | egrep -v '(pdf|txt|xhtml|xml|docbook|bz2)$')\n$STATUSOUT" - elif [[ $LOCATION =~ 'Documentation/Manuals/Docbook' ]];then - STATUSOUT="$(${COMMAND} status ${LOCATION} | egrep -v '(pdf|txt|xhtml)$')\n$STATUSOUT" - elif [[ $LOCATION =~ 'Identity' ]];then - STATUSOUT="$(${COMMAND} status ${LOCATION} | egrep -v '(pdf|png|jpg|rc|xpm|xbm|tif|ppm|pnm|gz|lss|log)$')\n$STATUSOUT" - else - STATUSOUT="$(${COMMAND} status ${LOCATION})\n$STATUSOUT" - fi - - # Sanitate status output. Expand new lines, remove leading spaces - # and empty lines. - STATUSOUT=$(echo -e "$STATUSOUT" | sed -r 's!^[[:space:]]*!!' | egrep -v '^[[:space:]]*$') - - # Define path to files considered recent modifications from - # working copy up to central repository. - FILES[0]=$(echo "$STATUSOUT" | egrep "^M" | sed -r "s,^.+${TCAR_WORKDIR}/,,") - FILES[1]=$(echo "$STATUSOUT" | egrep "^\?" | sed -r "s,^.+${TCAR_WORKDIR}/,,") - FILES[2]=$(echo "$STATUSOUT" | egrep "^D" | sed -r "s,^.+${TCAR_WORKDIR}/,,") - FILES[3]=$(echo "$STATUSOUT" | egrep "^A" | sed -r "s,^.+${TCAR_WORKDIR}/,,") - - # Define description of files considered recent modifications from - # working copy up to central repository. - INFO[0]="`gettext "Modified"`" - INFO[1]="`gettext "Unversioned"`" - INFO[2]="`gettext "Deleted"`" - INFO[3]="`gettext "Added"`" - - while [[ $COUNT -ne ${#FILES[*]} ]];do - - # Define total number of files. Avoid counting empty line. - if [[ "${FILES[$COUNT]}" == '' ]];then - FILESNUM[$COUNT]=0 - else - FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) - fi - - # Calculate total amount of changes. - CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) - - # Build report predicate. Use report predicate to show any - # information specific to the number of files found. For - # example, you can use this section to show warning messages, - # notes, and so on. By default we use the word `file' or - # `files' at ngettext's consideration followed by change - # direction. - PREDICATE[$COUNT]=`ngettext "file in the working copy" \ - "files in the working copy" $((${FILESNUM[$COUNT]} + 1))` - - # Output report line. - cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" --as-stdout-line - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - - # When files have changed in the target location, show which these - # files are and request user to see such changes and then, for - # committing them up to the central repository. - if [[ ${FILESNUM[0]} -gt 0 ]];then - - cli_printMessage "`gettext "Do you want to see changes now?"`" --as-yesornorequest-line - ${COMMAND} diff ${LOCATION} | less - - # Commit changes up to central repository. - cli_printMessage "`gettext "Do you want to commit changes now?"`" --as-yesornorequest-line - ${COMMAND} commit ${LOCATION} - - fi - - # When there are unversioned files in the target location, show - # which these files are and request user to add such files into - # the working copy. - if [[ ${FILESNUM[1]} -gt 0 ]];then - - cli_printMessage '-' --as-separator-line - cli_printMessage "`gettext "Do you want to add unversioned files now?"`" --as-yesornorequest-line - for FILE in ${FILES[1]};do - ${COMMAND} add "${TCAR_WORKDIR}/$FILE" - done - - # Commit changes up to central repository. - cli_printMessage "`gettext "Do you want to commit changes now?"`" --as-yesornorequest-line - ${COMMAND} commit ${LOCATION} - - fi - - # When there are added files in the target location, show which - # these files are and request user to commit them up to central - # repository. - if [[ ${FILESNUM[3]} -gt 0 ]];then - cli_printMessage '-' --as-separator-line - cli_printMessage "`gettext "Do you want to commit changes now?"`" --as-yesornorequest-line - ${COMMAND} commit ${LOCATION} - fi - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_copyRepoFile.sh b/Automation/Modules/Vcs/Subversion/subversion_copyRepoFile.sh deleted file mode 100755 index 10729c5..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_copyRepoFile.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# subversion_copyRepoFile.sh -- This function standardizes the way -# files (including directories) are duplicated inside the working -# copy. This function is an interface for subversion's `copy' command. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_copyRepoFile { - - local SOURCE=$(cli_checkRepoDirSource ${1}) - local TARGET=$(cli_checkRepoDirSource ${2}) - - # Verify source location absolute path. It should point either to - # existent files or directories both under version control inside - # the working copy. Otherwise, if it doesn't point to an existent - # file under version control, finish the script execution with an - # error message. - cli_checkFiles ${SOURCE} -e --is-versioned - - # Print action reference. - if [[ -f ${SOURCE} ]];then - cli_printMessage "${TARGET}/$(basename ${SOURCE})" --as-creating-line - else - cli_printMessage "${TARGET}" --as-creating-line - fi - - # Copy source location to its target using version control. - ${COMMAND} copy ${SOURCE} ${TARGET} --quiet - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_deleteRepoFile.sh b/Automation/Modules/Vcs/Subversion/subversion_deleteRepoFile.sh deleted file mode 100755 index 5874af8..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_deleteRepoFile.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# subversion_deleteRepoFile.sh -- This function standardizes the way -# centos-art.sh script deletes files and directories inside the -# working copy. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_deleteRepoFile { - - local TARGET=$(cli_checkRepoDirSource ${1}) - - # Print action reference. - cli_printMessage "${TARGET}" --as-deleting-line - - # Verify target existence. Be sure it is under version control. - cli_checkFiles "${TARGET}" --is-versioned - - # Revert changes before deleting related files. - ${COMMAND} revert ${TARGET} --quiet --recursive - - # Delete source location. - ${COMMAND} delete ${TARGET} --quiet --force - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_getRepoStatus.sh b/Automation/Modules/Vcs/Subversion/subversion_getRepoStatus.sh deleted file mode 100755 index f4eb4bf..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_getRepoStatus.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# subversion_getRepoStatus.sh -- This function requests the working -# copy using the svn status command and returns the first character in -# the output line, as described in svn help status, for the LOCATION -# specified. Use this function to perform verifications based a -# repository LOCATION status. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_getRepoStatus { - - local LOCATION=$(cli_checkRepoDirSource "$1") - - # Verify source location absolute path. It should point either to - # existent files or directories both under version control inside - # the working copy. Otherwise, if it doesn't point to an existent - # file under version control, finish the script execution with an - # error message. - cli_checkFiles ${LOCATION} -e --is-versioned - - # Define regular expression pattern to retrieve first column, - # returned by subversion status command. This column is one - # character column as describes `svn help status' command. - local PATTERN='^( |A|C|D|I|M|R|X|!|~).+$' - - # Output specific state of location using subversion `status' - # command. - ${COMMAND} status "$LOCATION" -N --quiet | sed -r "s/${PATTERN}/\1/" - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_isVersioned.sh b/Automation/Modules/Vcs/Subversion/subversion_isVersioned.sh deleted file mode 100755 index 92f5a48..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_isVersioned.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# subversion_isVersioned.sh -- This function determines whether a -# location is under version control or not. When the location is under -# version control, this function returns `0'. When the location isn't -# under version control, this function returns `1'. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_isVersioned { - - # Define the location absolute path we want to determine whether - # it is under version control or not. Only the first non-option - # argument passed to centos-art.sh command-line will be used. - local LOCATION=$(cli_checkRepoDirSource "${1}") - - # Use Subversion to determine whether the location is under - # version control or not. - ${COMMAND} info ${LOCATION} > /dev/null 2>&1 - - # Verify Subversion's exit status. - if [[ $? -ne 0 ]];then - cli_printMessage "${LOCATION} `gettext "isn't under version control."`" --as-error-line - fi - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_mkRepoDirectory.sh b/Automation/Modules/Vcs/Subversion/subversion_mkRepoDirectory.sh deleted file mode 100755 index 2e28067..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_mkRepoDirectory.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# subversion_mkRepoDirectory.sh -- This function standardizes the way -# centos-art.sh script creates directories inside the working copy. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_mkRepoDirectory { - - local TARGET=$(cli_checkRepoDirSource ${1}) - - # Print action reference. - cli_printMessage "${TARGET}" --as-creating-line - - # Copy source location to its target using version control. - ${COMMAND} mkdir ${TARGET} --quiet - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_syncRepoChanges.sh b/Automation/Modules/Vcs/Subversion/subversion_syncRepoChanges.sh deleted file mode 100755 index 1171c4f..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_syncRepoChanges.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# subversion_syncRepoChanges.sh -- This function synchronizes both -# central repository and working copy directory structures by -# performing a subversion update command first and a subversion commit -# command later. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_syncRepoChanges { - - local LOCATION='' - local LOCATIONS="${@}" - - for LOCATION in $LOCATIONS;do - - # Verify whether the location is valid or not. - LOCATION=$(cli_checkRepoDirSource ${LOCATION}) - - # Verify source location absolute path. It should point either - # to existent files or directories both under version control - # inside the working copy. Otherwise, if it doesn't point to - # an existent file under version control, finish the script - # execution with an error message. - cli_checkFiles ${LOCATION} -e --is-versioned - - # Bring changes from the repository into the working copy. - subversion_updateRepoChanges ${LOCATION} - - # Check changes in the working copy. - subversion_commitRepoChanges ${LOCATION} - - done - -} diff --git a/Automation/Modules/Vcs/Subversion/subversion_updateRepoChanges.sh b/Automation/Modules/Vcs/Subversion/subversion_updateRepoChanges.sh deleted file mode 100755 index 5b24acb..0000000 --- a/Automation/Modules/Vcs/Subversion/subversion_updateRepoChanges.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# subversion_updateRepoChanges.sh -- This function realizes a -# subversion update command against the working copy in order to bring -# changes from the central repository into the working copy. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function subversion_updateRepoChanges { - - local -a FILES - local -a INFO - local -a FILESNUM - local COUNT=0 - local UPDATEOUT='' - local PREDICATE='' - local CHNGTOTAL=0 - local LOCATION=$(cli_checkRepoDirSource "$1") - - # Verify source location absolute path. It should point either to - # existent files or directories both under version control inside - # the working copy. Otherwise, if it doesn't point to an existent - # file under version control, finish the script execution with an - # error message. - cli_checkFiles ${LOCATION} -e --is-versioned - - # Update working copy and retrieve update output. - cli_printMessage "`gettext "Bringing changes from the repository into the working copy"`" --as-banner-line - UPDATEOUT=$(${COMMAND} update ${LOCATION} --quiet) - - # Define path of files considered recent modifications from - # central repository to working copy. - FILES[0]=$(echo "$UPDATEOUT" | egrep "^A" | sed -r "s,^.+${TCAR_WORKDIR},,") - FILES[1]=$(echo "$UPDATEOUT" | egrep "^D" | sed -r "s,^.+${TCAR_WORKDIR},,") - FILES[2]=$(echo "$UPDATEOUT" | egrep "^U" | sed -r "s,^.+${TCAR_WORKDIR},,") - FILES[3]=$(echo "$UPDATEOUT" | egrep "^C" | sed -r "s,^.+${TCAR_WORKDIR},,") - FILES[4]=$(echo "$UPDATEOUT" | egrep "^G" | sed -r "s,^.+${TCAR_WORKDIR},,") - - # Define description of files considered recent modifications from - # central repository to working copy. - INFO[0]="`gettext "Added"`" - INFO[1]="`gettext "Deleted"`" - INFO[2]="`gettext "Updated"`" - INFO[3]="`gettext "Conflicted"`" - INFO[4]="`gettext "Merged"`" - - while [[ $COUNT -ne ${#FILES[*]} ]];do - - # Define total number of files. Avoid counting empty line. - if [[ "${FILES[$COUNT]}" == '' ]];then - FILESNUM[$COUNT]=0 - else - FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) - fi - - # Calculate total amount of changes. - CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) - - # Build report predicate. Use report predicate to show any - # information specific to the number of files found. For - # example, you can use this section to show warning messages, - # notes, and so on. By default we use the word `file' or - # `files' at ngettext's consideration followed by change - # direction. - PREDICATE[$COUNT]=`ngettext "file from the repository" \ - "files from the repository" $((${FILESNUM[$COUNT]} + 1))` - - # Output report line. - cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" --as-stdout-line - - # Increase counter. - COUNT=$(($COUNT + 1)) - - done - -} diff --git a/Automation/Modules/Vcs/vcs.sh b/Automation/Modules/Vcs/vcs.sh deleted file mode 100755 index 7585198..0000000 --- a/Automation/Modules/Vcs/vcs.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# vcs.sh -- This function standardizes version control tasks inside -# the repository. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function vcs { - - local ACTIONNAM='' - local ACTIONNAMS='' - local ACTIONVAL='' - - # Verify whether version control actions should be performed or - # not inside the repository directory structure. - local ENABLED=$(cli_getConfigValue "${CLI_BASEDIR}/${CLI_NAME}.conf" "version_control" "enabled") - if [[ ! ${ENABLED} =~ '^(yes|ye|y|1)$' ]];then - return - fi - - # Initialize version control system to use inside the repository. - local PACKAGE=$(cli_getConfigValue "${CLI_BASEDIR}/${CLI_NAME}.conf" "version_control" "package") - - # Set possible values to packages used as version control system. - if [[ ${PACKAGE} =~ '^(git|subversion)$' ]];then - - # Initialize the absolute path to commands we'll use as - # version control system in the working copy. - case ${PACKAGE} in - - 'git' ) - COMMAND=/usr/bin/git - ;; - - 'subversion' ) - COMMAND=/usr/bin/svn - ;; - esac - - else - cli_printMessage "${PACKAGE} `gettext "isn't supported as version control system."`" --as-error-line - fi - - # Verify whether the related package is installed or not. - cli_checkFiles ${PACKAGE} --is-installed - - # Interpret arguments and options passed through command-line. - vcs_getOptions - - # Initialize function specific export id. - local EXPORTID="${CLI_FUNCDIRNAM}/$(cli_getRepoName ${PACKAGE} -d)/$(cli_getRepoName ${PACKAGE} -f)" - - # Export specific functionalities to the script environment. - cli_exportFunctions "${EXPORTID}" - - # Execute version control. - ${PACKAGE} - - # Unset specific functionalities from the script environment. - cli_unsetFunctions "${EXPORTID}" - -} diff --git a/Automation/Modules/Vcs/vcs_getOptions.sh b/Automation/Modules/Vcs/vcs_getOptions.sh deleted file mode 100755 index 3a0fcb6..0000000 --- a/Automation/Modules/Vcs/vcs_getOptions.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# -# vcs_getOptions.sh -- This function interprets option parameters -# passed to `vcs' functionality and calls actions accordingly. This -# function serves as interface to Subversion and Git -# sub-functionalities. -# -# Copyright (C) 2009-2013 The CentOS Project -# -# 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. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function vcs_getOptions { - - # Define short options we want to support. - local ARGSS="h,q" - - # Define long options we want to support. - local ARGSL="help,quiet,synchronize,update,commit,is-versioned,status,mkdir,copy,delete" - - # Redefine ARGUMENTS using getopt(1) command parser. - cli_parseArguments - - # Redefine positional parameters using ARGUMENTS variable. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - - case "$1" in - - -h | --help ) - cli_runFnEnvironment help --read --format="texinfo" "tcar-fs::scripts:bash-functions-vcs" - shift 1 - exit - ;; - - -q | --quiet ) - FLAG_QUIET="true" - shift 1 - ;; - - --synchronize ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_syncRepoChanges" - shift 1 - ;; - - --commit ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_commitRepoChanges" - shift 1 - ;; - - --update ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_updateRepoChanges" - shift 1 - ;; - - --is-versioned ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_isVersioned" - shift 1 - ;; - - --status ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_getRepoStatus" - shift 1 - ;; - - --copy ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_copyRepoFile" - shift 1 - ;; - - --mkdir ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_mkRepoDirectory" - shift 1 - ;; - - --delete ) - ACTIONNAMS="${ACTIONNAMS} ${PACKAGE}_deleteRepoFile" - shift 1 - ;; - - -- ) - # Remove the `--' argument from the list of arguments - # in order for processing non-option arguments - # correctly. At this point all option arguments have - # been processed already but the `--' argument still - # remains to mark ending of option arguments and - # beginning of non-option arguments. The `--' argument - # needs to be removed here in order to avoid - # centos-art.sh script to process it as a path inside - # the repository, which obviously is not. - shift 1 - break - ;; - esac - done - - # Redefine ARGUMENTS variable using current positional parameters. - cli_parseArgumentsReDef "$@" - -}