Add plist, a script to automate the generation of a pkg-plist.
This commit is contained in:
parent
350ebfbe3e
commit
11a2dbd370
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=33935
@ -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
|
||||
|
64
Tools/scripts/plist
Executable file
64
Tools/scripts/plist
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user