1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

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
This commit is contained in:
Mathieu Arnold 2004-03-20 18:52:33 +00:00
parent a4e1bd2add
commit ba74778208
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=104765

View File

@ -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";