Skip site navigation (1)Skip section navigation (2)
Date:      08 Oct 2000 05:20:45 -0700
From:      asami@FreeBSD.org (Satoshi - Ports Wraith - Asami)
To:        ports@FreeBSD.org
Subject:   Re: cvs commit: CVSROOT avail
Message-ID:  <vqcu2an8qxu.fsf@silvia.hip.berkeley.edu>
In-Reply-To: asami@FreeBSD.org's message of "08 Oct 2000 04:56:13 -0700"
References:  <200010081150.EAA04996@freefall.freebsd.org> <vqczokf8s2q.fsf@silvia.hip.berkeley.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for your patience! :)

This is what I posted to -current and -stable.  A more detailed
description for you guys follows the mail.

=======
 > From: asami@FreeBSD.org (Satoshi - Ports Wraith - Asami)
 > Date: 08 Oct 2000 04:56:13 -0700
 > To: current@FreeBSD.org, stable@FreeBSD.org
 > 
 > Well, it only took 17 hours. :)
 > 
 > I tried my best to be careful but I'm sure there are some ports that
 > broke as a result, so please be gentle!
 > 
 > By the way, if you are expecting CVS to suddenly run faster, don't be
 > disappointed by it running as slow as ever.  The speedup will only
 > come when the Attics are cleaned (a few months later) by the CVS
 > meisters.
 > 
 > -PW
 > ===
 > From: Satoshi Asami <asami@FreeBSD.org>
 > Date: Sun, 8 Oct 2000 04:50:45 -0700 (PDT)
 > X-FreeBSD-CVS-Branch: HEAD
 > 
 > asami       2000/10/08 04:50:45 PDT
 > 
 >   Modified files:
 >     .                    avail 
 >   Log:
 >   The conversion is over.
 >   
 >   Revision  Changes    Path
 >   1.128     +2 -2      CVSROOT/avail
=======

So far I have only checked "make index" (s^pkg-descr^pkg/DESCR^ shows
only one differences, databases/mytop which was committed with the new
layout prematurely) and a couple of small ports by hand.  I've
unlocked the tree because all the massive repo-copies are done.

I've just started a package build so errors will start showing up at
the errorlogs/4-latest page soon.  If you find something interesting,
go ahead and fix it if it doesn't involve a file moving.  If it does,
please ask me for a repo copy.

By the way, this is what I've done, for the record.

(1) Renamed all files/patch-* to something else (usually
    extra-patch-*) and changed Makefiles or whatever that are using
    them.

(2) Repo-copied all patches/patch-* to files,
    pkg/{COMMENT,DESCR,PLIST,INSTALL,DEINSTALL,REQ,MESSAGE} to
    pkg-{comment,etc.}, and files/md5 to distinfo.  (The copyfiles
    script -- see below.)

(3) Moved files under pkg/ that's not handled in (2) (usually a
    conditional plist) to the main directory, add a pkg- prefix and
    fixed the Makefiles.  In very rare cases, they were just
    informative files so they were copied to files/ instead.  (The
    renameplist script is attached below.)

(4) Moved patches under patches/ that's not named patch-* to files/.
    Fix up Makefile if they are used.

(5) Checked all places in Makefiles where PATCHDIR or PKGDIR appear in
    the Makefiles, and fixed them as necessary.  Most of these are
    slave ports specifying some directory names explicitly
    ("PATCHDIR=${.CURDIR}/patches" -> "PATCHDIR=${.CURDIR}/files") or
    simple name changes ("cat ${PKGDIR}/MESSAGE" -> "cat
    ${PKGMESSAGE}").  (As you can see, something like the latter
    shouldn't have been necessary if the Makefile was written properly
    in the first place. ;)

(6) Checked all Makefiles that has "/patches/" or "/pkg/" spelled out
    and fixed them as necessary.

(7) Checked all places in Makefiles where MD5_FILE is defined and
    fixed them.

Roughly in this order.

And here are the two scripts.  Not particularly pretty, but could be
useful in the future.

===<copyfiles>===
#!/bin/sh

doit=0

if [ $# -gt 0 ]; then
  if [ "x$1" = "x-doit" ]; then
    doit=1
    shift
  fi
fi

if [ $# != 1 ]; then
  echo "usage: $0 category"
  exit 1
fi

repo=/home/ncvs/ports

cd $HOME/tmp/ports/$1 || exit 1

for port in *; do
  if [ ! -d $port -o "x$port" = "xCVS" -o "x$port" = "xpkg" ]; then continue; fi
  if cd $port; then
    echo "cd $port"
    if [ -f files/md5 ]; then
      if [ ! -f $repo/$1/$port/files/md5,v ]; then
	echo "error: $repo/$1/$port/files/md5,v does not exist"
	exit 1
      fi
      echo "cp -p $repo/$1/$port/files/md5,v /home/ncvs/ports/$1/$port/distinfo,v"
      if [ "$doit" = 1 ]; then
        cp -p $repo/$1/$port/files/md5,v /home/ncvs/ports/$1/$port/distinfo,v
      fi
      cd files
      echo "cvs remove -f md5"
      if [ "$doit" = 1 ]; then
        cvs remove -f md5
      fi
      cd ..
    fi
    if [ -d pkg ] && cd pkg; then
      echo "cd pkg"
      for j in *; do
	if [ -f $j ]; then
	  file=$(echo $j | tr '[:upper:]' '[:lower:]');
	  case "x$file" in
	    xcomment|xdescr|xplist|xinstall|xdeinstall|xreq|xmessage)
	      ;;
	    *)
	      echo "error: file $j unknown"
	      exit 1
	      ;;
	  esac
	  if [ ! -f $repo/$1/$port/pkg/$j,v ]; then
	    echo "error: $repo/$1/$port/pkg/$j,v does not exist"
	    exit 1
	  fi
	  echo "cp -p $repo/$1/$port/pkg/$j,v /home/ncvs/ports/$1/$port/pkg-$file,v"
	  if [ "$doit" = 1 ]; then
	    cp -p $repo/$1/$port/pkg/$j,v /home/ncvs/ports/$1/$port/pkg-$file,v
	  fi
	else
	  if [ "x$j" != "xCVS" ]; then
	    echo "non-file $j ignored"
	  fi
	fi
      done
      cd ..
      echo "cvs remove -Rf pkg"
      if [ "$doit" = 1 ]; then
        cvs remove -Rf pkg
      fi
    fi
    if [ -d patches ] && cd patches; then
      echo "cd patches"
      if [ ! -d $repo/$1/$port/files ]; then
	echo "mkdir -p $repo/$1/$port/files"
	if [ "$doit" = 1 ]; then
	  mkdir -p $repo/$1/$port/files
	fi
      fi
      for file in *; do
	if [ -f $file ]; then
	  case "x$file" in
	    xpatch-*)
	      ;;
	    *)
	      echo "error: file $file unknown"
	      exit 1
	      ;;
	  esac
	  if [ ! -f $repo/$1/$port/patches/$file,v ]; then
	    echo "error: $repo/$1/$port/patches/$file,v does not exist"
	    exit 1
	  fi
	  echo "cp -p $repo/$1/$port/patches/$file,v /home/ncvs/ports/$1/$port/files/$file,v"
	  if [ "$doit" = 1 ]; then
	    cp -p $repo/$1/$port/patches/$file,v /home/ncvs/ports/$1/$port/files/$file,v
	  fi
	else
	  if [ "x$file" != "xCVS" ]; then
	    echo "non-file $file ignored"
	  fi
	fi
      done
      cd ..
      echo "cvs remove -Rf patches"
      if [ "$doit" = 1 ]; then
        cvs remove -Rf patches
      fi
    fi
    cd ..
  fi
done

if [ "$doit" = 1 ]; then
  cd $HOME/tmp/ports/$1
  cvs commit -m "Convert category $1 to new layout."  
  cvs -q update
  echo "running another cvs update"
  cvs -q update
fi
===<copyfiles>===

copyfiles is supposed to be called with the category name.  It will
exit when it finds a file it can't handle.  Basically it's the (3) and
(4) above.  Fix them until it stops complaining, then call it with the
"-doit" option.

===<renameplist>===
#!/bin/sh
# renameplists
tolower=0
if [ $# -gt 0 ]; then
  if [ "x$1" = "x-tolower" ]; then
    tolower=1
    shift
  fi
fi
if [ $# != 0 ]; then
  echo "$0 (in port directory)"
  exit 1
fi

dir=$(pwd | sed -e "s^$(dirname $(dirname $(pwd)))/^^")

cd $HOME/tmp/ports/$dir/pkg

for i in PLIST?*; do
  j=$(echo $i | sed -e 's/PLIST//')
  if [ $tolower = 1 ]; then
    new=$(echo $j | tr '[:upper:]' '[:lower:]')
  else
    new=$j
  fi
  cp -p /home/ncvs/ports/$dir/pkg/PLIST$j,v /home/ncvs/ports/$dir/pkg-plist$new,v
  cvs remove -f $i
done

cd ..
cvs -q update
===<renameplist>===

renameplist is just a stupid script that will repo copy
pkg/PLIST<something> to pkg-plist<something>, then cvs remove the
originals.  You still need to modify the Makefile and commit the
change along with the (uncommitted) cvs remove.  There is a "-tolower"
option to convert the "<something>" part to all lowercase (I believe
some porters used all-uppercase name just because PLIST is
all-uppercase -- looks kinda ugly with the "pkg-plist" prefix).

With these two scripts and a lot of emacs keyboard macros, I was able
to convert the entire tree in 17 hours.

Ok, enough rambling.  Good night. :)

-PW


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?vqcu2an8qxu.fsf>