diff options
author | Brian Feldman <green@FreeBSD.org> | 2000-10-17 14:46:04 +0000 |
---|---|---|
committer | Brian Feldman <green@FreeBSD.org> | 2000-10-17 14:46:04 +0000 |
commit | 11a2dbd3707162efa1e8ac86ed6494ac03fadebd (patch) | |
tree | 77b0942f3b5a8b96a3f804dd52634c4185adef2a | |
parent | 350ebfbe3ef5f0d4dd882b145f583f796702ba53 (diff) | |
download | freebsd-ports-11a2dbd3707162efa1e8ac86ed6494ac03fadebd.zip |
Add plist, a script to automate the generation of a pkg-plist.
-rw-r--r-- | Tools/scripts/README | 1 | ||||
-rwxr-xr-x | Tools/scripts/plist | 64 |
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 |