diff options
author | Akinori MUSHA <knu@FreeBSD.org> | 2004-03-14 11:48:40 +0000 |
---|---|---|
committer | Akinori MUSHA <knu@FreeBSD.org> | 2004-03-14 11:48:40 +0000 |
commit | 3d30f7c9c70c39d795c07e9fc53be613f9f42cd9 (patch) | |
tree | 3cac761d35ed129fca8f0381a114b2aadbc52058 /Tools | |
parent | 7b1f7cb48c3027f08dd4bea4892e26c8f04de690 (diff) | |
download | ports-3d30f7c9c70c39d795c07e9fc53be613f9f42cd9.tar.gz ports-3d30f7c9c70c39d795c07e9fc53be613f9f42cd9.zip |
Notes
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/de-pkg-comment | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/Tools/scripts/de-pkg-comment b/Tools/scripts/de-pkg-comment deleted file mode 100755 index b82991908efc..000000000000 --- a/Tools/scripts/de-pkg-comment +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env ruby -# -# de-pkg-comment - converts pkg-comment to COMMENT -# (public domain) -# -# Usage: -# de-pkg-comment portdir ... -# -# Notes: -# - Local changes may be backed out and the previous file is renamed -# to .#* if conversion fails. -# - It requires a port have a MAINTAINER line. -# - It does not touch master/slave ports automatically; just shows -# some hints. -# - Do not commit resulted files without checking the diffs. -# -# MAINTAINER= knu@FreeBSD.org -# -# $FreeBSD$ -# - -begin - require 'features/ruby18' -rescue LoadError; end - -if ARGV.empty? - STDERR.puts "usage: #{$0} portdir ..." - exit 64 -end - -def error(message) - STDERR.puts("#{$dir}: #{message}") -end - -def info(message) - STDOUT.puts("#{$dir}: #{message}") -end - -def backout(message) - error(message) - info("Backing out all modifications.") - system 'cvs', '-Q', 'up', '-CdP' -end - -def cvs_up(*files) - system *['cvs', '-q', 'up', '-dP', *files] -end - -def cvs_rm(*files) - system *['cvs', '-Q', 'rm', '-f', *files] -end - -ARGV.each { |$dir| - if !File.directory?($dir) - error("Not a directory.") - next - end - - Dir.chdir($dir) { - if !File.directory?('CVS') - error("Not a CVS working directory.") - next - end - - info("Running cvs update") - cvs_up() - - makefile = 'Makefile' - - if !File.exist?(makefile) - error("No Makefile is found.") - next - end - - commentfile = `make -V COMMENTFILE`.chomp - - if !File.exist?(commentfile) - error("No need to convert.") - next - end - - comment = nil - commentfile_defined = false - maintainer_defined = false - - info("Modifying #{makefile}") - - open(makefile, 'r+') { |rw| - contents = [] - - rw.each { |line| - contents << line - - case line - when /^MAINTAINER\s*(\??=)/ - maintainer_defined = true - - assign = $1 - - if assign == '?=' - info("Looks like a master port. Please check for slave ports.") - end - - open(commentfile) { |f| - comment = f.gets.strip - quoted_comment = comment.gsub(/#/, '\\#').gsub(/\$/, '$$') - contents << "COMMENT#{assign}\t#{quoted_comment}\n" - } - when /^COMMENTFILE\s*([?!:]?=)/ - info("COMMENTFILE is defined. Please check out and edit manually.") - commentfile_defined = true - when /^MASTERDIR\s*([?!:]?=)/ - masterport = File.expand_path(`make -V MASTERDIR`.chomp) - masterport.sub!(%r".*(?:^|/)([^/]+/[^/]+)$", '\1') - - info("Looks like a slave port. Please look into the master port (#{masterport}) also.") - end - } - - rw.rewind - rw.puts contents - } - - if !maintainer_defined - backout("No MAINTAINER line is found!") - next - end - - newcomment = `make -V COMMENT`.chomp - - if newcomment != comment - backout("Failed to convert!") - next - end - - unless commentfile_defined - info("Removing #{commentfile}") - cvs_rm(commentfile) - end - - info("Running cvs update again") - cvs_up() - - info("Done.") - } -} |