NetBSD-5.0.2/dist/ipf/README.NetBSD

#
# $NetBSD: README.NetBSD,v 1.2 2008/10/20 12:09:15 martti Exp $
#
# Author: Martti Kuparinen <martti@NetBSD.org>
#
# This file contains copy-pastable commands to import a new IPFilter release
# into the NetBSD repository. Before importing the code into the official
# NetBSD repository, you'll import the code into your own local test
# repository, resolve the conflicts and make sure everything works as expected.
#
# Steps in this document:
#  1) Get the IPFilter dist file and a copy of the CVS repository
#  2) Create a local test repository for the test imports
#  3) Import the new IPFilter release into the test repository
#  4) Resolve conflicts and make other adjustments
#  5) Save the required modifications
#  6) Re-create a local test repository for the final test import
#  7) Import the new IPFilter release into the test repository
#  8) Apply the fixes
#  9) Compile everything and make sure the new version really works
# 10) Update your /usr/src (cd /usr/src && cvs update -dPA)
# 11) Import the new IPFilter release into the NetBSD repository
# 12) Apply the fixes
# 13) Update your /usr/src one more time (cd /usr/src && cvs update -dPA)
# 14) Compile and install everything
# 15) Update src/doc/3RDPARTY and src/doc/CHANGES
# 16) Send an announcement to current-users
#

###############################################################################
###############################################################################
# COMMON SETTINGS FOR EVERYTHING BELOW
###############################################################################
###############################################################################

export NETBSDUSERNAME="fixthis"
export VERSION="4.1.31"
export VEROLD="v4-1-29"
export VERNEW="v4-1-31"
export VERTAG="`echo ${VERSION} | sed 's+\.+_+g'`"
export ORIG="${HOME}/netbsd/orig"
export WORK="${HOME}/netbsd/work"
export FIXES="${HOME}/netbsd/fixes/${VERSION}"
export EXTRACTED="/tmp/destdir"
export TGZ="${ORIG}/ip_fil${VERSION}.tar.gz"
export IPF="/tmp/ip_fil${VERSION}"
export RSYNC_RSH="ssh -4"
export RSYNC="rsync -avzr --delete"

###############################################################################
###############################################################################
# Fetch the official IPF distfile
###############################################################################
###############################################################################

cd ${ORIG}
ftp http://coombs.anu.edu.au/~avalon/ip_fil${VERSION}.tar.gz

###############################################################################
###############################################################################
# GET COPY OF THE CVS REPOSITORY FOR LOCAL TEST IMPORTS
###############################################################################
###############################################################################

RSYNC_RSH="ssh -4"
RSYNC="rsync -avzr --delete -e ssh"
S="${NETBSDUSERNAME}@cvs.netbsd.org::cvsroot"
D="${ORIG}/cvsroot"

${RSYNC} ${S}/src/ ${D}/src
${RSYNC} --exclude 'commitlog*' --exclude 'history*' ${S}/CVSROOT/ ${D}/CVSROOT

###############################################################################
###############################################################################
# TEST IMPORT 1
###############################################################################
###############################################################################

# Get a new repository
mkdir -p ${WORK}
${RSYNC} ${ORIG}/cvsroot ${WORK}
rm -f ${WORK}/cvsroot/CVSROOT/commitinfo*
rm -f ${WORK}/cvsroot/CVSROOT/loginfo*
touch ${WORK}/cvsroot/CVSROOT/commitinfo
touch ${WORK}/cvsroot/CVSROOT/loginfo
sed 's+/cvslock+/tmp/cvslock+' < ${WORK}/cvsroot/CVSROOT/config \
  > ${WORK}/cvsroot/CVSROOT/config.1
mv -f ${WORK}/cvsroot/CVSROOT/config.1 ${WORK}/cvsroot/CVSROOT/config
mkdir -p /tmp/cvslock
export CVSROOT="${WORK}/cvsroot"


# Checkout a working copy 
cd ${WORK}
rm -rf src
cvs co -P src

or

cd ${WORK}/src
rm -rf dist/ipf regress/sys/kern sys/lkm sys/dist/ipf sys/netinet usr.sbin/ipf
cvs update -dPA

or

cd ${WORK}/src
rm -rf dist/ipf regress/sys/kern sys/lkm sys/dist/ipf sys/netinet usr.sbin/ipf
cvs update -dPA dist/ipf regress/sys/kern sys/lkm sys/dist/ipf \
  sys/netinet usr.sbin/ipf


# Prepare the files for import
rm -rf ${IPF}
tar xpzf ${TGZ} -C `dirname ${IPF}`
cd ${IPF}
rm -rf ${EXTRACTED}
mkdir -p ${EXTRACTED}
cd ${EXTRACTED}
/usr/src/dist/ipf/ipf2netbsd ${IPF} ${EXTRACTED}


# cvs tag
cd ${WORK}/src
for i in dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl \
	regress/sys/kern/ipf usr.sbin/ipf
do
	(cd $i && cvs tag BEFORE-IPF-${VERTAG})
done


# Import the new version
cd ${EXTRACTED}/src
cvs import -I ! -I CVS -m "Import IPFilter ${VERSION}" src DARRENR ${VERNEW}


# src/dist/ipf
cd ${WORK}/src/dist/ipf
cvs update -kk -j${VEROLD} -j${VERNEW} -d
A=`cvs update | grep ^C | awk '{ print $2 }'`
cvs update | grep ^C
##vim $A
##for i in $A; do mkdir -p ${FIXES}/1/src/dist/ipf/`dirname $i`; done
##for i in $A; do cp $i ${FIXES}/1/src/dist/ipf/$i; done
cvs diff -u -kk -rDARRENR $A | less
cvs diff -u -kk -rDARRENR | less

# src/sys/dist/ipf
cd ${WORK}/src/sys/dist/ipf 
cvs update -kk -j${VEROLD} -j${VERNEW} -d
B=`cvs update | grep ^C | awk '{ print $2 }'`
cvs update | grep ^C
##vim $B
##for i in $B; do mkdir -p ${FIXES}/1/src/sys/dist/ipf/`dirname $i`; done
##for i in $B; do cp $i ${FIXES}/1/src/sys/dist/ipf/$i; done
cvs diff -u -rDARRENR $B | less
cvs diff -u -rDARRENR | less

# src/sys/lkm/netinet/if_ipl
cd ${WORK}/src/sys/lkm/netinet/if_ipl
cvs update -kk -j${VEROLD} -j${VERNEW} -d 
C=`cvs update | grep ^C | awk '{ print $2 }'`
cvs update | grep ^C
##vim $C
##for i in $C; do mkdir -p ${FIXES}/1/src/sys/lkm/netinet/if_ipl/`dirname $i`; done
##for i in $C; do cp $i ${FIXES}/1/src/sys/lkm/netinet/if_ipl/$i; done
cvs diff -u -rDARRENR | less

# src/regress/sys/kern/ipf
cd ${WORK}/src/regress/sys/kern/ipf
cvs update -kk -j${VEROLD} -j${VERNEW} -d
D=`cvs update | grep ^C | awk '{ print $2 }'`
cvs update | grep ^C
##vim $D
##for i in $D; do mkdir -p ${FIXES}/1/src/regress/sys/kern/ipf/`dirname $i`; done
##for i in $D; do cp $i ${FIXES}/1/src/regress/sys/kern/ipf/$i; done
cvs diff -u -rDARRENR | less


# Commit changes
cd ${WORK}/src
cvs ci -m "Upgraded IPFilter to ${VERSION}" \
  dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl regress/sys/kern/ipf
cvs update -dPA dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl \
  regress/sys/kern/ipf

# See the changes
cd ${WORK}/src
cvs diff -u -kk -rDARRENR \
  dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl regress/sys/kern/ipf \
  usr.sbin/ipf | less

###############################################################################
###############################################################################
# TEST IMPORT 2
###############################################################################
###############################################################################

# Settings
export WORK="${HOME}/netbsd/work"
export CVSROOT="${WORK}/cvsroot"

# Get a new repository
mkdir -p ${WORK}
${RSYNC} ${ORIG}/cvsroot ${WORK}
rm -f ${WORK}/cvsroot/CVSROOT/commitinfo*
rm -f ${WORK}/cvsroot/CVSROOT/loginfo*
touch ${WORK}/cvsroot/CVSROOT/commitinfo
touch ${WORK}/cvsroot/CVSROOT/loginfo
sed 's+/cvslock+/tmp/cvslock+' < ${WORK}/cvsroot/CVSROOT/config \
  > ${WORK}/cvsroot/CVSROOT/config.1
mv -f ${WORK}/cvsroot/CVSROOT/config.1 ${WORK}/cvsroot/CVSROOT/config
mkdir -p /tmp/cvslock
export CVSROOT="${WORK}/cvsroot"

cd ${WORK}/src
rm -rf dist/ipf regress/sys/kern sys/lkm sys/dist/ipf sys/netinet usr.sbin/ipf
cvs update -dPA dist/ipf regress/sys/kern sys/lkm sys/dist/ipf \
  sys/netinet usr.sbin/ipf

# cvs tag
cd ${WORK}/src
for i in dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl \
        regress/sys/kern/ipf usr.sbin/ipf
do
        (cd $i && cvs tag BEFORE-IPF-${VERTAG})
done

# Prepare the files for import
rm -rf ${IPF}
tar xpzf ${TGZ} -C `dirname ${IPF}`
cd ${IPF}
rm -rf ${EXTRACTED}
mkdir -p ${EXTRACTED}
cd ${EXTRACTED}
/usr/src/dist/ipf/ipf2netbsd ${IPF} ${EXTRACTED}

# Import the new version
cd ${EXTRACTED}/src
cvs import -I ! -I CVS -m "Import IPFilter ${VERSION}" src DARRENR ${VERNEW}

# Merge and fix conflicts
cd ${WORK}/src/dist/ipf
cvs update -kk -j${VEROLD} -j${VERNEW} -d
cvs update | grep ^C

cd ${WORK}/src/sys/dist/ipf 
cvs update -kk -j${VEROLD} -j${VERNEW} -d
cvs update | grep ^C

cd ${WORK}/src/sys/lkm/netinet/if_ipl
cvs update -kk -j${VEROLD} -j${VERNEW} -d 
cvs update | grep ^C

cd ${WORK}/src/regress/sys/kern/ipf
cvs update -kk -j${VEROLD} -j${VERNEW} -d
cvs update | grep ^C

cd ${FIXES}/1 && tar cf - * | tar xvf - -C ${WORK}
cd ${WORK}/src
cvs ci -m "Upgraded IPFilter to ${VERSION}" \
  dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl regress/sys/kern/ipf
cvs update -dPA dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl \
  regress/sys/kern/ipf

cd ${FIXES}/2 && tar cf - * | tar xvf - -C ${WORK}
cd ${WORK}/src
cvs ci -m "Sync with official IPFilter" \
  dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl regress/sys/kern/ipf

# Now build and verify everything before doing the real import...

###############################################################################
###############################################################################
# FINAL IMPORT INTO THE NETBSD REPOSITORY
###############################################################################
###############################################################################

# Settings
export WORK="/usr"
export CVSROOT="${NETBSDUSERNAME}@cvs.netbsd.org:/cvsroot"

# Update the local copy first
cd ${WORK}/src
cvs update -dPA dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl \
  regress/sys/kern/ipf

# cvs tag
cd ${WORK}/src
for i in dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl \
        regress/sys/kern/ipf usr.sbin/ipf
do
        (cd $i && cvs tag BEFORE-IPF-${VERTAG})
done

# Prepare the files for import
rm -rf ${IPF}
tar xpzf ${TGZ} -C `dirname ${IPF}`
cd ${IPF}
rm -rf ${EXTRACTED}
mkdir -p ${EXTRACTED}
cd ${EXTRACTED}
/usr/src/dist/ipf/ipf2netbsd ${IPF} ${EXTRACTED}

# Import the new version
cd ${EXTRACTED}/src
cvs import -I ! -I CVS -m "Import IPFilter ${VERSION}" src DARRENR ${VERNEW}

# Merge and fix conflicts
cd ${WORK}/src/dist/ipf
cvs update -kk -j${VEROLD} -j${VERNEW} -d
cvs update | grep ^C

cd ${WORK}/src/sys/dist/ipf 
cvs update -kk -j${VEROLD} -j${VERNEW} -d
cvs update | grep ^C

cd ${WORK}/src/sys/lkm/netinet/if_ipl
cvs update -kk -j${VEROLD} -j${VERNEW} -d 
cvs update | grep ^C

cd ${WORK}/src/regress/sys/kern/ipf
cvs update -kk -j${VEROLD} -j${VERNEW} -d
cvs update | grep ^C

cd ${FIXES}/1 && tar cf - * | tar xvf - -C ${WORK}
cd ${WORK}/src
cvs ci -m "Upgraded IPFilter to ${VERSION}" \
  dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl regress/sys/kern/ipf
cvs update -dPA dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl \
  regress/sys/kern/ipf

cd ${FIXES}/2 && tar cf - * | tar xvf - -C ${WORK}
cd ${WORK}/src
cvs ci -m "Sync with official IPFilter" \
  dist/ipf sys/dist/ipf sys/lkm/netinet/if_ipl regress/sys/kern/ipf

# fix doc/3RDPARTY and doc/CHANGES
# send mail to current-users@


HEADSUP
=======
Hi!

I have just upgraded IPFilter to the latest version (4.1.31) on
NetBSD -current. You must recompile kernel and the ipf tools to
use the new version:

cd /usr/src
./build.sh tools kernel=GENERIC
./build.sh releasekernel=GENERIC
(cd share/mk && make install)
(cd sys && make includes)
(cd usr.sbin/ipf && make dependall install)

After reboot you may want to check the version number and run the
regression tests:

ipf -V
(cd regress/sys/kern/ipf && make && make clean)

If you detect errors (or have improvements), please send a problem
report with the send-pr tool.


Changes since 4.1.29
====================
<TBD>