diff options
author | Chris Rees <crees@FreeBSD.org> | 2011-08-29 14:54:48 +0000 |
---|---|---|
committer | Chris Rees <crees@FreeBSD.org> | 2011-08-29 14:54:48 +0000 |
commit | 5d4b8b15b0225531c0c5c8006c2f61f7831a4055 (patch) | |
tree | 5b1bf692ae726f74f6d5b379b5d97bb72152c2f7 /Tools/scripts | |
parent | f3f797d93329e71d4061877671c98a54ecf07737 (diff) | |
download | ports-5d4b8b15b0225531c0c5c8006c2f61f7831a4055.tar.gz ports-5d4b8b15b0225531c0c5c8006c2f61f7831a4055.zip |
Add option (-y) to check for similarly named ports.
PR: ports/159841
Submitted by: crees (me)
Approved by: garga (maintainer)
Notes
Notes:
svn path=/head/; revision=280699
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/addport | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Tools/scripts/addport b/Tools/scripts/addport index 52eab83ae191..16e93b0af621 100755 --- a/Tools/scripts/addport +++ b/Tools/scripts/addport @@ -56,7 +56,7 @@ sub lastcomment(); my %opts; -getopts('abc:d:fh:il:L:M:mns:tu:', \%opts); +getopts('abc:d:fh:il:L:M:mns:tu:y', \%opts); my $autofill_l = $opts{'l'}; my $autofill_L = $opts{'L'}; @@ -76,6 +76,7 @@ my $interactive = $opts{'i'}; my $nomkdir = $opts{'m'}; my $addlchk = $opts{'a'}; my $nofetch = $opts{'f'}; +my $checkexist = $opts{'y'}; my $currentdir = abs_path("."); my %l10nprefix = ( 'chinese' => 'zh-', @@ -180,6 +181,38 @@ if ($dir eq "") { exit 1; } +# check the port doesn't exist already + +if ($checkexist) { + my $found = 0; + print ">> Checking out modules file to scan for duplicates..."; + system("$cvs -q co -p modules > $tmpdir/modules") && errx(1, "Could not checkout CVSROOT/modules."); + print " [DONE]\n"; + my @namepart; + foreach (split(/\,/, $dir)) { + s/^.*\///; + foreach (split(/[-_]/)) { + next if length () <=2 or /^rubygem$/; + push(@namepart, $_); + } + } + open(MODULES_FILE, "< $tmpdir/modules") or errx(1, "Modules file in $tmpdir unreadable."); + while (my $line = <MODULES_FILE>) { + next if $line =~ /^#/; + foreach my $dpart (@namepart) { + if ($line =~ /^[^ ]*\b$dpart\b/i) { + $line =~ s/\s+/ /g; + print "$dpart matches $line\n"; + $found = 1; + } + } + } + if ($found) { + prompt ("Possible duplicates found -- still OK?") + and errx(1, "Investigating duplicates"); + } +} + # make sure we're in the right place. chdir $currentdir; my @dirs = split(/\,/, $dir); @@ -447,6 +480,7 @@ OPTIONS for downloading distfiles. -t Do more port testing. Requires -a. -u user Use a different username (default: $u). + -y Check for similarly named ports. ENVIRONMENT VARIABLES $0 supports the following environment variables: |