diff options
author | Mathieu Arnold <mat@FreeBSD.org> | 2004-03-20 18:52:33 +0000 |
---|---|---|
committer | Mathieu Arnold <mat@FreeBSD.org> | 2004-03-20 18:52:33 +0000 |
commit | ba74778208bf1facab099b433e0315ff9cd92bdf (patch) | |
tree | c5f04efbd5e9b5493fd3530a2e212b1b845c1fc9 /Tools/scripts | |
parent | a4e1bd2add37c06be6601d6ab1877ee5acbf0b15 (diff) | |
download | ports-ba74778208bf1facab099b433e0315ff9cd92bdf.tar.gz ports-ba74778208bf1facab099b433e0315ff9cd92bdf.zip |
Notes
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/addport | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Tools/scripts/addport b/Tools/scripts/addport index e1a06c417695..a5605d0789b8 100755 --- a/Tools/scripts/addport +++ b/Tools/scripts/addport @@ -307,15 +307,22 @@ foreach my $thisdir (@dirs) { # now let's insert it my $cmd; - if ($port eq "") { + if (scalar @ports == 0) { # there were no previous SUBDIR += lines, so we're going to # put ourselves after the last comment (we can't be after a # .include <bsd.port.subdir.mk> for example). my $lastcommentnum = &lastcomment; $cmd = "$lastcommentnum\n+\ni\n"; } else { - # OK, append ourselves in the right place, so things *stay* sorted. - $cmd = "/^ SUBDIR += $port/\ni\n"; + if ($port eq "") { + # there were previous SUBDIR lines, but none was greater than we are, + # means, we're the last port, so, add ourselves after the last port + $port = $ports[$#ports]; + $cmd = "/^ SUBDIR += $port/\na\n"; + } else { + # OK, append ourselves in the right place, so things *stay* sorted. + $cmd = "/^ SUBDIR += $port/\ni\n"; + } } print "Inserting new port into $category/Makefile...\n"; open(ED, "|ed Makefile") || die "Cannot start ed to actually insert module\n"; |