summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorBrian Feldman <green@FreeBSD.org>2000-10-17 14:46:04 +0000
committerBrian Feldman <green@FreeBSD.org>2000-10-17 14:46:04 +0000
commit11a2dbd3707162efa1e8ac86ed6494ac03fadebd (patch)
tree77b0942f3b5a8b96a3f804dd52634c4185adef2a /Tools
parentFix plist (diff)
Add plist, a script to automate the generation of a pkg-plist.
Notes
Notes: svn path=/head/; revision=33935
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/README1
-rwxr-xr-xTools/scripts/plist64
2 files changed, 65 insertions, 0 deletions
diff --git a/Tools/scripts/README b/Tools/scripts/README
index 12309f6d16ae..48be3afb69a0 100644
--- a/Tools/scripts/README
+++ b/Tools/scripts/README
@@ -15,6 +15,7 @@ getpr - downloads a problem report from GNATS and attempts to extract
this probably needs to be checked for potential security problems.
gnomedepends - Analyse pkg/PLIST and give an advice as to which GNOME ports
should be listes in {RUN,LIB}_DEPENDS for this port
+plist - automate (mostly, at least) pkg-plist generation
prpatch - just does `patch $1 < pr-patch' (pr-patch is created by getpr)
prdone - checks in the port, attempting to fill out the commit message using
information from the problem report and then takes you into edit-pr
diff --git a/Tools/scripts/plist b/Tools/scripts/plist
new file mode 100755
index 000000000000..e8da00258c5c
--- /dev/null
+++ b/Tools/scripts/plist
@@ -0,0 +1,64 @@
+#!/usr/local/bin/ruby
+class Plist
+ def initialize(no_manpages = true, excl = nil)
+ @no_manpages = no_manpages
+ self.excludes = excl
+ self
+ end
+ def excludes
+ @excludes.dup
+ end
+ def excludes=(excl)
+ if !excl
+ @excludes = [
+ /^(bin|etc|include|info|lib|libexec|man|sbin|share)$/,
+ 'etc/rc.d',
+ /^lib\/perl5?(\/.*site_perl\/[[:digit:]]\.[[:digit:]]+)?$/,
+ /^lib\/xemacs(\/site-lisp)?$/,
+ /^man\//,
+ /^share\/(dict|doc|emacs|emacs\/site-lisp|examples|misc|skel)$/,
+ /^share\/nls($|\/)/
+ ]
+ else
+ @excludes = excl.to_a
+ end
+
+ end
+ def make(dir)
+ @root = dir.to_s + '/'
+ imake('', 0, '')
+ end
+ private
+ def imake(dir, level, prevwd)
+ thiswd = prevwd + dir # always ends in '/'
+ rootedwd = @root + thiswd
+ subs = []
+ Dir.foreach(rootedwd) {|dirent|
+ next if dirent =~ /^\.\.?$/
+ if test(?d, rootedwd + dirent)
+ subs.concat(imake(dirent + '/', level + 1, thiswd))
+ else
+ if thiswd !~ /^man\// || !@no_manpages
+ subs.push(thiswd + dirent)
+ end
+ end
+ }
+ thiswd.chop!
+ if level > 0 && !@excludes.find {|x| x === thiswd}
+ subs.push('@dirrm ' + thiswd)
+ end
+ return subs
+ end
+end
+
+if __FILE__ == $0
+ if ARGV.size != 1
+ $stderr.print <<-USAGE_EOF
+usage: #{$0} somepath
+ Generate a pkg-plist to stdout given a previously empty somepath which
+ a port has been installed into (PREFIX=somepath).
+USAGE_EOF
+ exit 1
+ end
+ puts Plist.new.make(ARGV[0]).join("\n")
+end