<commit_before>#!/bin/sh
######################################################################
# A script for upgrading Forrest's jars with those from Cocoon.  Use at own
# risk!  Make sure you build Cocoon before running this.  If your cocoon-2.1
# directory is not on the same level as xml-forrest/, set the COCOON variable
# below.
#
BASE=$PWD/`dirname $0`
## MUST BE OVERRIDDEN:
COCOON=$BASE/../../../cocoon-2.1
FORREST=$BASE/../..
NEKODTD_VERSION=0.1.6
NEKODTD_HOME=$BASE/../../../nekodtd-$NEKODTD_VERSION
NEKOPULL_VERSION=0.2.2
NEKOPULL_HOME=$BASE/../../../nekopull-$NEKOPULL_VERSION

## CAN be overridden:
JARSUFFIX=`date +%Y%m%d`
JARSUFFIX=m2

## Decide what kind of update to perform.  'real' copies upgraded jars to
## lib/core/, whereas 'testing' copies them to the distribution in
## build/dist/shbat/*
UPGRADE_TYPE=testing
UPGRADE_TYPE=real
#
######################################################################

CLIB=$COCOON/lib/*
CBUILD=$COCOON/build/cocoon-2.1*
CBLOCKS=$CBUILD/blocks

FDIST=$FORREST/build/dist/shbat

## Determines where to copy new jars to:

if [ "$UPGRADE_TYPE" = "real" ]; then
  FLIB=$FORREST/lib/core
  FLIB_ENDORSED=$FORREST/lib/endorsed
elif [ "$UPGRADE_TYPE" = "testing" ]; then
  FLIB=$FDIST/WEB-INF/lib
  FLIB_ENDORSED=$FDIST/lib/endorsed
fi

function checkdir()
{
  if [ ! -d "$1" ]; then 
    echo "Directory $1 does not exist. Please check the \$$2 variable in $0"
    exit
  fi
}

function sanity_check()
{
  checkdir "$FORREST" FORREST
  checkdir "$COCOON" COCOON
  checkdir "$FLIB" FLIB
  checkdir "$NEKODTD_HOME" NEKODTD_HOME
  checkdir "$NEKOPULL_HOME" NEKOPULL_HOME
#
}

function copy()
{
  pushd . 
  cd $FLIB
  case $UPGRADE_TYPE in
    "testing")
    rm $1*
    ;;
    "real")
    echo "CVS removing `echo $1*`"
    [ ! -z "`echo $1*`" ] && cvsdo remove -f $1*
    ;;
  esac

  cp $CLIB/$1* .

  if [ "$UPGRADE_TYPE" = "real" ]; then
    echo "CVS adding `echo $1*`"
    cvs add -kb $1* &
  fi
  popd
}

function bzcopy()
{
  pushd . 
  cd $FLIB
  case $UPGRADE_TYPE in
    "testing")
    rm cocoon-$1-block-*.jar
    ;;
    "real")
    echo "CVS removing $1*"
    cvsdo remove -f cocoon-$1-block-*.jar
    ;;
  esac

  cp $CBLOCKS/$1-block.jar cocoon-$1-block-$JARSUFFIX.jar

  if [ "$UPGRADE_TYPE" = "real" ]; then
    echo "CVS adding `echo cocoon-$1-block-*.jar`"
    cvs add -kb cocoon-$1-block-*.jar &
  fi

  popd
}

function bcopy()
{
  rm $FLIB/$1*
  cp $COCOON/src/blocks/*/lib/$1* $FLIB/
}

function upgrade_neko()
{
  pushd . 
  cd $FLIB
  case $UPGRADE_TYPE in
    "testing")
    rm neko{dtd,pull}*
    ;;
    "real")
    cvsdo remove -f neko{dtd,pull}*
    ;;
  esac

  cp $NEKODTD_HOME/nekodtd.jar nekodtd-$NEKODTD_VERSION.jar
  cp $NEKOPULL_HOME/nekopull.jar nekopull-$NEKOPULL_VERSION.jar

  if [ "$UPGRADE_TYPE" = "real" ]; then
    cvs add -kb neko{dtd,pull}-* &
  fi
  popd

}

function upgrade_endorsed()
{
  pushd . 
  cd $FLIB_ENDORSED
  case $UPGRADE_TYPE in
    "testing")
    rm xalan* xerces* xml-apis*
    ;;
    "real")
    cvsdo remove -f xalan* xerces* xml-apis*
    rm xalan* xerces* xml-apis*
    ;;
  esac

  cp $CLIB/{xalan,xerces,xml-apis}* .

  if [ "$UPGRADE_TYPE" = "real" ]; then
    cvs add -kb {xalan,xerces,xml-apis}* &
  fi
  popd

}


echo "Performing $UPGRADE_TYPE upgrade. New jars copied to:"
echo "  $FLIB"
echo "  $FLIB_ENDORSED"


sanity_check

upgrade_neko
upgrade_endorsed
<commit_msg>Remove CVS stuff, as it doesn't work with unmodified files :/<commit_after>#!/bin/sh
######################################################################
# A script for upgrading Forrest's jars with those from Cocoon.  Use at own
# risk!  Make sure you build Cocoon before running this.  If your cocoon-2.1
# directory is not on the same level as xml-forrest/, set the COCOON variable
# below.
#
BASE=$PWD/`dirname $0`
## MUST BE OVERRIDDEN:
COCOON=$BASE/../../../cocoon-2.1
FORREST=$BASE/../..
NEKODTD_VERSION=0.1.6
NEKODTD_HOME=$BASE/../../../nekodtd-$NEKODTD_VERSION
NEKOPULL_VERSION=0.2.2
NEKOPULL_HOME=$BASE/../../../nekopull-$NEKOPULL_VERSION

## CAN be overridden:
JARSUFFIX=`date +%Y%m%d`
JARSUFFIX=m2

## Decide what kind of update to perform.  'real' copies upgraded jars to
## lib/core/, whereas 'testing' copies them to the distribution in
## build/dist/shbat/*
UPGRADE_TYPE=testing
UPGRADE_TYPE=real
#
######################################################################

CLIB=$COCOON/lib/*
CBUILD=$COCOON/build/cocoon-2.1*
CBLOCKS=$CBUILD/blocks

FDIST=$FORREST/build/dist/shbat

## Determines where to copy new jars to:

if [ "$UPGRADE_TYPE" = "real" ]; then
  FLIB=$FORREST/lib/core
  FLIB_ENDORSED=$FORREST/lib/endorsed
elif [ "$UPGRADE_TYPE" = "testing" ]; then
  FLIB=$FDIST/WEB-INF/lib
  FLIB_ENDORSED=$FDIST/lib/endorsed
fi

function checkdir()
{
  if [ ! -d "$1" ]; then 
    echo "Directory $1 does not exist. Please check the \$$2 variable in $0"
    exit
  fi
}

function sanity_check()
{
  checkdir "$FORREST" FORREST
  checkdir "$COCOON" COCOON
  checkdir "$FLIB" FLIB
  checkdir "$NEKODTD_HOME" NEKODTD_HOME
  checkdir "$NEKOPULL_HOME" NEKOPULL_HOME
#
}

function copy()
{
  pushd . 
  cd $FLIB
  rm $1*

  cp $CLIB/$1* .

  if [ "$UPGRADE_TYPE" = "real" ]; then
    echo "cvs add -kb `echo $1*`"
  fi
  popd
}

function bzcopy()
{
  pushd . 
  cd $FLIB
  rm cocoon-$1-block-*.jar

  cp $CBLOCKS/$1-block.jar cocoon-$1-block-$JARSUFFIX.jar

  if [ "$UPGRADE_TYPE" = "real" ]; then
    echo "CVS adding `echo cocoon-$1-block-*.jar`"
  fi

  popd
}

function bcopy()
{
  rm $FLIB/$1*
  cp $COCOON/src/blocks/*/lib/$1* $FLIB/
}

function upgrade_neko()
{
  pushd . 
  cd $FLIB
  rm neko{dtd,pull}*

  cp $NEKODTD_HOME/nekodtd.jar nekodtd-$NEKODTD_VERSION.jar
  cp $NEKOPULL_HOME/nekopull.jar nekopull-$NEKOPULL_VERSION.jar

  if [ "$UPGRADE_TYPE" = "real" ]; then
    echo "cvs add -kb `echo neko{dtd,pull}-*`"
  fi
  popd

}

function upgrade_endorsed()
{
  pushd . 
  cd $FLIB_ENDORSED
  rm xalan* xerces* xml-apis*

  cp $CLIB/{xalan,xerces,xml-apis}* .

  if [ "$UPGRADE_TYPE" = "real" ]; then
    echo "cvs add -kb `echo {xalan,xerces,xml-apis}*`"
  fi
  popd

}


echo "Performing $UPGRADE_TYPE upgrade. New jars copied to:"
echo "  $FLIB"
echo "  $FLIB_ENDORSED"


sanity_check

upgrade_neko
upgrade_endorsed

{'fraction_non_alphanumeric': 0.18824094841396988, 'fraction_numerical': 0.009772508811278436, 'mean_word_length': 3.4371002132196162, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '400098', 'n_tokens_mistral': 2649, 'n_tokens_neox': 2515, 'n_words': 581}