Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Oct 2000 13:34:08 +0200
From:      Johann Visagie <wjv@cityip.co.za>
To:        Carlos A M dos Santos <casantos@cpmet.ufpel.tche.br>
Cc:        ports@freebsd.org
Subject:   Re: Script to genarate PLIST?
Message-ID:  <20001012133408.A10314@fling.sanbi.ac.za>
In-Reply-To: <20001012120017.A97048@fling.sanbi.ac.za>; from wjv@cityip.co.za on Thu, Oct 12, 2000 at 12:00:17PM %2B0200
References:  <Pine.BSF.4.21.0010101319480.1220-100000@gate.cpmet.ufpel.tche.br> <39E47200.7125F0BF@thehousleys.net> <20001012120017.A97048@fling.sanbi.ac.za>

next in thread | previous in thread | raw e-mail | index | archive | help

--mojUlQ0s9EVzWg2t
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I wrote on 2000-10-12 (Thu) at 12:00:17 +0200:
> 
> Specifically, I'd pipe the find command that adds the files to $PLIST through
> sort(1) first (cuts down the size of future diff files), and the output of
> the find that adds the directories to $PLIST through "sort -r" (pretty much
> ensures the directories are removed in a sane order when deinstalling).
> 
> Hmm, and add something to remove man pages from $PLIST, I suppose.  :-)  Let
> me see what I can do...

Attached, a quick & dirty script to do the above.  Pretty much copied from
the Porter's Handbook except for the bit to remove the man pages.  Caution:
non-foolproof, no sanity checks, use at own risk, etc.

-- Johann

--mojUlQ0s9EVzWg2t
Content-Type: application/x-sh
Content-Disposition: attachment; filename="makeplist.sh"

#!/bin/sh
#
# makeplist.sh
# - Automated package list creation script for FreeBSD.
# - Closely based on Chapter 17 of the FreeBSD Porter's Handbook.
# - Must be executed from within the port's directory.
# - Caution:  This isn't foolproof, so take care.

PATH=/sbin:/bin:/usr/bin


### Set some variables ###

curdir=`pwd`			# Assume we're in the port's dir
portname=`basename $curdir`
plist=`make -V PLIST`.new	# Output file becomes ${PLIST}.new
olddirs=/var/tmp/OLD-DIRS

# Create a whitespace-separated list of the port's manpages
manpages=
for section in 1 2 3 4 5 6 7 8 9 L N; do
  manpages="$manpages `make -V MAN$section`"
done

# Build a string from the manpage list to be used in find(1) later
findstring=
if [ "X$manpages" != X"" ]; then
  for manpage in $manpages; do
    findstring=$findstring" -name ${manpage}.gz"
  done
  findstring=`echo $findstring | sed -e 's/\(.\) -name/\1 -o -name/g'`
  findstring='-a ! ( '$findstring' )'
fi


### Clean up garbage from previous runs ###

if [ -d /var/tmp/$portname ]; then
  echo "==> Removing existing /var/tmp/$portname"
  rm -rf /var/tmp/$portname
fi
if [ -f $olddirs ]; then
  echo "==> Removing existing $olddirs"
  rm -f $olddirs
fi


### Create the tree under /var/tmp, and install to it ###

echo "==> Creating tree in /var/tmp/$portname"
mkdir /var/tmp/$portname
mtree -U -f /etc/mtree/BSD.local.dist -d -e -p /var/tmp/$portname > /dev/null

echo "==> Doing a make depends"
make depends PREFIX=/var/tmp/$portname

echo "==> Creating $olddirs"
(cd /var/tmp/$portname && find * -type d) > $olddirs

echo "==> Doing make install to /var/tmp/$portname"
make install PREFIX=/var/tmp/$portname


### Create the new ${PLIST}

echo "==> Creating `basename $plist`"
(cd /var/tmp/$portname && find * \! -type d $findstring ) | sort > $plist
(cd /var/tmp/$portname && find * -type d) | comm -13 $olddirs - | \
  sed -e 's#^#@dirrm #' | sort -r >> $plist


### Clean up ###

echo "==> Deinstalling and cleaning up"
make deinstall
if [ -d /var/tmp/$portname ]; then
  rm -rf /var/tmp/$portname
fi
rm -f $olddirs

echo "==> Done:  New package list is `basename $plist`"

--mojUlQ0s9EVzWg2t--


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?20001012133408.A10314>