- system("$make -C /usr/ports INDEXDIR=$tmpdir fetchindex") && errx(1, "Could not fetch INDEX file.");
- my @namepart;
- foreach (split(/\,/, $dir)) {
- s/^.*\///;
- foreach (split(/[-_]/)) {
- next if length () <=2 or /^rubygem$/;
- push(@namepart, $_);
- }
- }
- open(INDEXFILE, "< $indexfile") or errx(1, "$indexfile unreadable.");
- while (my $line = <INDEXFILE>) {
- $line =~ m,^[^|]*\|/usr/ports/[^/]*/([^|]*)\|,;
- $line = $1;
- 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);
-foreach my $i (@dirs) { $i = abs_path($i); }
-my $portname; my $wrapat;
-foreach my $thisdir (@dirs) {
- # make double sure where we are..
- chdir $thisdir;
- # do some dir sanity checking first
- errx(1, "Please specify valid directories to import new ports from.") if $thisdir eq "";
- errx(1, "$thisdir is either not a directory or does not exist.") if (! -d $thisdir);
-
- print "Working with port directory $thisdir.\n";
-
- $portname = `basename $thisdir`; # avoid problems with dirs containing `/' in cvs
- chomp $portname;
- warnx("Port directory contains upper-case character! Please try using an all lower-case name to make everybody's life a bit easier.") if ($portname =~ /[A-Z]/);
- if ($interactive) {
- if (prompt("Port directory name will be $portname in SVN Repo. OK? ")) {
- do {
- $portname = query("Preferred name for port directory? ");
- } while (prompt("Is the new name $portname OK? "));
- }
- }
-
- chdir $thisdir or err(1, "$thisdir");
-
- # now run the tests on this baby.
- for (@commands) {
- system("$_") && errx(1, "'$_' had problems. aborting.");
- }
-
- # Get the category name and make it suitable for use with svn
- my @categories = split(/ /, `$make -VCATEGORIES`);
- my $category = $categories[0];
- if ($interactive) {
- if (prompt("Port $portname will be put in category $category. OK? " )) {
- do {
- $category = query("Preferred category for $portname? ");
- } while (prompt("Is the new category $category OK? "));
- }
- }
- chomp $category;
-
- # Do commitfile checking but only if the user did not request automatic filling.