diff options
author | garga <garga@FreeBSD.org> | 2005-10-05 00:26:37 +0800 |
---|---|---|
committer | garga <garga@FreeBSD.org> | 2005-10-05 00:26:37 +0800 |
commit | 89eaede6652d613a62b74643477e82079cb5f0bc (patch) | |
tree | f395e948d7cb190d5efabd29287e908c5afc4bd6 /Tools/scripts | |
parent | 971cb77a931a9cd6867ad0dd0b2601a516fb9763 (diff) | |
download | freebsd-ports-gnome-89eaede6652d613a62b74643477e82079cb5f0bc.tar.gz freebsd-ports-gnome-89eaede6652d613a62b74643477e82079cb5f0bc.tar.zst freebsd-ports-gnome-89eaede6652d613a62b74643477e82079cb5f0bc.zip |
- Add a new option -L, it works like -l but uses pkg-descr to create
commit message.
Approved by: will (maintainer)
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/addport | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/Tools/scripts/addport b/Tools/scripts/addport index c3b2d8de091d..351d9479f564 100755 --- a/Tools/scripts/addport +++ b/Tools/scripts/addport @@ -56,9 +56,11 @@ sub lastcomment(); my %opts; -getopts('ac:d:fgh:il:M:mns:tu:', \%opts); +getopts('ac:d:fgh:il:L:M:mns:tu:', \%opts); -my $autofill = $opts{'l'}; +my $autofill_l = $opts{'l'}; +my $autofill_L = $opts{'L'}; +my $autofill = ($autofill_l ? $autofill_l : $autofill_L); my $c = $opts{'c'} if ($opts{'c'} ne ""); my $nomodules = $opts{'g'}; my $distdir = $opts{'s'} if ($opts{'s'} ne ""); @@ -246,10 +248,17 @@ foreach my $thisdir (@dirs) { } else { ## Set up the autofill file. # Read COMMENT for part of the commit message. - chomp($pkgcomment = `$make $passenv -V COMMENT`); - # Change the first character to lowercase to make it fit with the - # rest of the commit message, only if the second is not upper case. - $pkgcomment =~ s/(^.)(?![A-Z])/\l$1/; + if ($autofill_l) { + chomp($pkgcomment = `$make $passenv -V COMMENT`); + # Change the first character to lowercase to make it fit with the + # rest of the commit message, only if the second is not upper case. + $pkgcomment =~ s/(^.)(?![A-Z])/\l$1/; + $pkgcomment .= "."; + $pkgcomment .= "\n\n" if ($autofill != -1); + } else { + $pkgcomment = `cat pkg-descr`; + $pkgcomment .= "\n" if ($autofill != -1); + } # Read Makefile to find necessary variables. open(MAKEFILE, "Makefile") or die("Can't open Makefile for reading: $!"); while(<MAKEFILE>) { @@ -258,19 +267,21 @@ foreach my $thisdir (@dirs) { ($portversion) = (m/^PORTVERSION=\s+(\w.*)$/) if (/^PORTVERSION=/); } close(MAKEFILE); - $pkgcomment .= "."; - $pkgcomment .= "\n\n" if ($autofill != -1); # Write out the data to the comment file. open(AUTOFILL, "> $tmpdir/commitfile") or die("Can't open $tmpdir/commitfile for writing: $!"); - # pretty print; wrap @ 72 characters - $tmp = "Add $portname $portversion, $pkgcomment"; - $wrapat = 72; - while($wrapat > 1) { - $tmp2 = $tmp; - $tmp =~ s/(.{$wrapat}([^ ]+)?) /$1\n/g; - last unless $tmp =~ /^[^\n]{73}/; - $wrapat--; - $tmp = $tmp2; + if ($autofill_l) { + # pretty print; wrap @ 72 characters + $tmp = "Add $portname $portversion, $pkgcomment"; + $wrapat = 72; + while($wrapat > 1) { + $tmp2 = $tmp; + $tmp =~ s/(.{$wrapat}([^ ]+)?) /$1\n/g; + last unless $tmp =~ /^[^\n]{73}/; + $wrapat--; + $tmp = $tmp2; + } + } else { + $tmp = $pkgcomment; } print AUTOFILL $tmp; print AUTOFILL "PR: ports/$autofill\n" if ($autofill != -1); @@ -426,6 +437,8 @@ OPTIONS The PR number must be passed to -l. If there is no PR (i.e., self-created or submitted in private email), use PR# -1. + -L PR# Like -l but it'll generate commit message based + on pkg-descr -m Do not checkout ports/Mk (needed for support of portlinting etc). -n Do not actually commit anything. |