|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
742c46 |
# manual_deleteEntry.sh -- This function removes a documentation entry
|
|
|
5285d6 |
# from documentation directory structure.
|
|
|
4c79b5 |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
# modify it under the terms of the GNU General Public License as
|
|
|
7cd8e9 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
7cd8e9 |
# License, or (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is distributed in the hope that it will be useful, but
|
|
|
4c79b5 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
4c79b5 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4c79b5 |
# USA.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
742c46 |
function manual_deleteEntry {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
local ENTRIES=''
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Check if the entry has been already removed.
|
|
|
638bf8 |
cli_checkFiles $ENTRY 'f'
|
|
|
4c79b5 |
|
|
|
449927 |
# Initiate list of entries to remove using the entry specified in
|
|
|
449927 |
# the command line.
|
|
|
449927 |
ENTRIES=${ENTRY}
|
|
|
449927 |
|
|
|
449927 |
# Verify existence of dependent entries. Dependent entries are
|
|
|
449927 |
# stored inside a directory with the same name of the entry you
|
|
|
449927 |
# are trying to remove.
|
|
|
449927 |
if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]];then
|
|
|
449927 |
|
|
|
449927 |
# If such directory doesn't exists, the related entry doesn't
|
|
|
449927 |
# have dependent entries, but if it exists is because there is
|
|
|
449927 |
# at least one dependent entry inside it, in this case add
|
|
|
449927 |
# dependent all dependent entries. This is required in order
|
|
|
449927 |
# for menus, nodes and cross-references to be updated correctly.
|
|
|
449927 |
ENTRIES="${ENTRIES} $(cli_getFilesList "${ENTRY_DIR}/${ENTRY_FILE}" ".*\.texi")"
|
|
|
449927 |
|
|
|
449927 |
# Also, add the directory that stores dependent entries. This
|
|
|
449927 |
# is required since directories by themselves are not
|
|
|
449927 |
# considered entries by themselves and so they aren't put on
|
|
|
449927 |
# the list of entries. We don't want to have dependent
|
|
|
449927 |
# directories still there, when there is no parent entry for
|
|
|
449927 |
# them.
|
|
|
449927 |
ENTRIES="${ENTRIES} ${ENTRY_DIR}/${ENTRY_FILE}"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
449927 |
# Prepare list of entries for action preamble.
|
|
|
449927 |
ENTRIES=$(echo $ENTRIES | tr ' ' "\n" | sort | uniq)
|
|
|
5285d6 |
|
|
|
638bf8 |
# Print action preamble.
|
|
|
638bf8 |
cli_printActionPreamble "$ENTRIES" 'doDelete' 'AsResponseLine'
|
|
|
638bf8 |
|
|
|
449927 |
# Process list of entries in order to remove files.
|
|
|
4c79b5 |
for ENTRY in $ENTRIES;do
|
|
|
4c79b5 |
|
|
|
449927 |
# Print action message.
|
|
|
449927 |
cli_printMessage "$ENTRY" "AsDeletingLine"
|
|
|
449927 |
|
|
|
449927 |
# Remove documentation entry using regular subversion
|
|
|
449927 |
# commands. Do not use regular rm command here, use
|
|
|
449927 |
# subversion del command instead. Otherwise, even the file is
|
|
|
449927 |
# removed, it will be brought back when the final
|
|
|
449927 |
# cli_commitRepoChange be executed. Remember there is a
|
|
|
449927 |
# subversion update there, no matter what you remove using
|
|
|
449927 |
# regular commands, when you do update the directory structure
|
|
|
449927 |
# on the working copy the removed files (not removed in the
|
|
|
449927 |
# repository, nor marked to be removed) are brought down to
|
|
|
449927 |
# the working copy again.
|
|
|
449927 |
svn del "$ENTRY" --quiet
|
|
|
638bf8 |
|
|
|
449927 |
done
|
|
|
4456e8 |
|
|
|
449927 |
# Print separator line.
|
|
|
449927 |
cli_printMessage '-' 'AsSeparatorLine'
|
|
|
449927 |
|
|
|
449927 |
# Print action message.
|
|
|
449927 |
cli_printMessage "Updating definition of menus, nodes and cross-references." 'AsResponseLine'
|
|
|
449927 |
|
|
|
449927 |
# Process list of entries in order to update menus, nodes and
|
|
|
449927 |
# cross references. Since we are verifying entry status before
|
|
|
449927 |
# remove the we cannot update the information in the same loop we
|
|
|
449927 |
# remove files. This would modify some file before be removed and
|
|
|
449927 |
# that would stop script execution. Similary, if we do update
|
|
|
449927 |
# menus, nodes and cross references before removing files it would
|
|
|
449927 |
# be needed to remove farther status verification in order for the
|
|
|
449927 |
# script to continue its execution. Thereby, I can't see a
|
|
|
449927 |
# different way but removing files first using status verification
|
|
|
449927 |
# and later go through entities list again to update menus, nodes
|
|
|
449927 |
# and cross references from remaining files.
|
|
|
449927 |
for ENTRY in $ENTRIES;do
|
|
|
4456e8 |
|
|
|
449927 |
# Update menu and node definitions from manual sections to
|
|
|
449927 |
# reflect the changes.
|
|
|
4de5d4 |
manual_updateMenu "remove-entry"
|
|
|
4de5d4 |
manual_updateNodes
|
|
|
4456e8 |
|
|
|
449927 |
# Update cross reference definitions from manual to reflect
|
|
|
449927 |
# the changes.
|
|
|
742c46 |
manual_deleteCrossReferences
|
|
|
f8fb31 |
|
|
|
4456e8 |
done
|
|
|
4456e8 |
|
|
|
449927 |
# Remove entry menus and nodes from chapter definition to reflect
|
|
|
449927 |
# the fact it has been removed. This is mainly applied when one
|
|
|
449927 |
# of the chapters (e.g., trunk/, tags/, or branches/) is removed.
|
|
|
7f7f8f |
if [[ ! -d $MANUAL_CHAPTER_DIR ]];then
|
|
|
4de5d4 |
manual_updateChaptersMenu 'remove-entry'
|
|
|
4de5d4 |
manual_updateChaptersNodes
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
449927 |
# Print separator line.
|
|
|
449927 |
cli_printMessage '-' 'AsSeparatorLine'
|
|
|
449927 |
|
|
|
449927 |
# Rebuild output files to propagate recent changes.
|
|
|
5285d6 |
manual_updateOutputFiles
|
|
|
5285d6 |
|
|
|
4c79b5 |
}
|