freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Freetype] DNS and CVS changes for freetype.org


From: Werner LEMBERG
Subject: Re: [Freetype] DNS and CVS changes for freetype.org
Date: Sat, 24 Feb 2001 17:26:27 +0100 (CET)

>        2. The CVSROOT is going to change (a few days later) from:
> 
>                   :pserver:address@hidden:/cvsroot
> 
>           to:
> 
>                   :pserver:address@hidden:/cvs/freetype

For Unix users: To avoid a new checkout of all modules I suggest to
use the attached newcvsroot script.

  Example:

    newcvsroot :pserver:address@hidden:/cvs/freetype \
               freetype2 freetype2


      Werner
#! /bin/sh

# newcvsroot version 2.0

# Copyright (C) 2000, Free Software Foundation

# This script is Free Software, and it can be copied, distributed and
# modified as defined in the GNU General Public License.  A copy of
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html

# by Alexandre Oliva <address@hidden>
# based on previous implementation by Roland McGrath <address@hidden>

# This scripts allows a checked-out CVS tree to be pointed to a
# renamed or moved CVS server, root or module.  Meanwhile, it can
# transform all CVS/Repository files in absolute or relative, if
# either `-a' or `-r' are given.  By default, absolute files remain
# absolute, and relative ones remain relative.

# newcvsroot verifies that each sub-directory of the given directory
# actually lies within the Root and Repository of the given directory,
# and skips them, printing a warning message, if they don't match.
# This sanity check can be skipped using --force.  In this case,
# CVS/Repository will be adjusted based on the checked-out tree.

# usage: newcvsroot [-a|-r] root module dir
#    or  newcvsroot [-v] [-h]

# -a      --absolute    make all CVS/Repository files absolute
# -r      --relative    make all CVS/Repository files relative to CVS/Root
# -f      --force       skip sanity checks
# -V      --verbose     print what is being done
# -n      --dry-run     just print what would be done
# -v      --version     print version information
# -h,-?   --help        print short or long help message

# root is the new CVSROOT of the CVS repository
# module is the new module name
# dir is the checked-out CVS tree that should be modified

name=newcvsroot
mode=preserve
force=false
show=:
do=eval

repeat="test $# -gt 0"
while $repeat; do
  case "$1" in
    -v|--version)
        sed '/^# '$name' version /,/^# Heavily modified by/ { s/^# //; p; }; d' 
< $0
        exit 0
        ;;
    -\?|-h)
        sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 &&
        echo
        echo "run \`$name --help | more' for full usage"
        exit 0
        ;;
    --help)
        sed '/^# '$name' version /,/^[^#]/ { /^[^#]/ d; s/^# //; p; }; d' < $0
        exit 0
        ;;
    -f|--force)
        force=:
        shift
        ;;
    -n|--dry-run)
        show=echo
        do=:
        shift
        ;;
    -V|--verbose)
        show=echo
        shift
        ;;
    -r|--relative)
        if test "$mode" != preserve && test "$mode" != relative; then
          echo "$name: $1: conflicting mode specification" >&2
          exit 1
        fi
        mode=relative
        shift
        ;;
    -a|--absolute)
        if test "$mode" != preserve && test "$mode" != absolute; then
          echo "$name: $1: conflicting mode specification" >&2
          exit 1
        fi
        mode=absolute
        shift
        ;;
    *)
        repeat=false
        ;;
   esac
done

if test $# != 3; then
        sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 &&
        echo
        echo "run \`$name --help | more' for full usage"
        exit 0
fi

newroot=$1
module=$2
dir=$3
cd "$3" || exit 0

if test ! -d CVS || test ! -f CVS/Root || test ! -f CVS/Repository; then
  echo "$name: $dir doesn't look like a checked-out CVS tree" >&2
  exit 1
fi

oldroot=`cat CVS/Root`
oldreporoot=`echo "$oldroot" | sed 's,.*:,,'`
oldreporootrx=`echo "$oldreporoot" | sed s,.,.,g`
oldrepo=`cat CVS/Repository`

case $oldrepo in
"$oldreporoot" | "$oldreporoot"/*)
  oldrepofull=$oldrepo
  oldreporela=`echo "$oldrepo" | sed "s,$oldreporootrx/*,,"`
  ;;
/*)
  echo "$name: $dir/CVS/Root and $dir/CVS/Repository don't match" >&2
  exit 1
  ;;
"")
  oldrepofull=$oldreporoot
  oldreporela=
  ;;
*)
  oldrepofull=$oldreporoot/$oldrepo
  oldreporela=$oldrepo
  ;;
esac

case $oldrepofull in
/) oldrepofullslash=$oldrepofull ;;
*) oldrepofullslash=$oldrepofull/ ;;
esac

case $oldreporela in
"") oldreporelaslash=$oldreporela ;;
*)  oldreporelaslash=$oldreporela/ ;;
esac

oldrepofullrx=`echo "$oldrepofull" | sed s,.,.,g`
oldreporelarx=`echo "$oldreporela" | sed s,.,.,g`

newrepofull=`echo "$newroot" | sed 's,.*:,,'`
if test "x$module" = x.; then
  newreporela=
else
  newrepofull=$newrepofull/$module
  newreporela=$module
fi

case $mode in
preserve) ;;
absolute) newreporela=$newrepofull ;;
relative) newrepofull=$newreporela ;;
*) echo "$name: internal error: unknown operation mode $mode" >&2
   exit 1 ;;
esac

find . -type d -name CVS -print |
sed 's,^\./,,' |
while read d; do
  if $force; then
    newrepodir=`echo "$d" | sed 's,/*CVS$,,'`
    newrepobase=$newrepofull
  else
    if test ! -f $d/Root || test ! -f $d/Repository; then
      echo "$name: $dir/$d doesn't seem like a valid CVS directory, skipping" 
>&2
      continue
    fi
    case `cat $d/Root` in
    "$oldroot") ;;
    *) echo "$name: $dir/$d/Root differs from $d/CVS/Root, skipping" >&2
       continue ;;
    esac
    case `cat $d/Repository` in
    "$oldrepofull" | "$oldrepofullslash"*)
      newrepodir=`cat "$d/Repository" | sed s,$oldrepofullrx/*,,`
      newrepobase=$newrepofull
      ;;
    "$oldreporela" | "$oldreporelaslash"*)
      newrepodir=`cat "$d/Repository" | sed s,$oldreporelarx/*,,`
      newrepobase=$newreporela
      ;;
    /*)
      echo "$name: $dir/$d/Repository outside $oldrepofull, skipping" >&2
      continue ;;
    *)
      echo "$name: $dir/$d/Repository outside $oldreporela, skipping" >&2
      continue ;;
    esac
  fi    
  if test "x$newrepodir" != x &&
     test "x$newrepobase" != x &&
     test "x$newrepobase" != x/; then
    newrepodir=$newrepobase/$newrepodir
  else
    newrepodir=${newrepobase}$newrepodir
  fi
  case `cat "$d/Root"` in
  "$newroot") ;;
  *)
    $show echo "$newroot > $d/Root"
    $do echo '$newroot > $d/Root'
    ;;
  esac
  case `cat "$d/Repository"` in
  "$newrepodir") ;;
  *)
    $show echo "$newrepodir > $d/Repository"
    $do echo '$newrepodir > $d/Repository'
    ;;
  esac
done

exit 0

reply via email to

[Prev in Thread] Current Thread [Next in Thread]