aboutsummaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2004-03-21 02:52:33 +0800
committermat <mat@FreeBSD.org>2004-03-21 02:52:33 +0800
commit2c76290addf7e9927d740dc71ba7a3e03dd40328 (patch)
treeb4efebadaac2d76335ddf8b8fdb9395d651ba2ca /Tools
parent9190d4e8a63a165e5d667a1daf793b95fd12f8ae (diff)
downloadfreebsd-ports-gnome-2c76290addf7e9927d740dc71ba7a3e03dd40328.tar.gz
freebsd-ports-gnome-2c76290addf7e9927d740dc71ba7a3e03dd40328.tar.zst
freebsd-ports-gnome-2c76290addf7e9927d740dc71ba7a3e03dd40328.zip
Fix a bug arising when you added a port which should have been at the end of
<category>/Makefile, and ended up at the begining Approved by: will
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/addport13
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";