Index: Mk/bsd.java.mk =================================================================== --- Mk/bsd.java.mk +++ Mk/bsd.java.mk @@ -7,9 +7,7 @@ # # For FreeBSD committers: # Please send all suggested changes to the maintainer instead of committing -# them to svn yourself. -# -# $FreeBSD$ +# them yourself. # .if !defined(Java_Include) Index: Tools/scripts/MOVEDlint.awk =================================================================== --- Tools/scripts/MOVEDlint.awk +++ Tools/scripts/MOVEDlint.awk @@ -25,8 +25,6 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $FreeBSD$ -# # MOVEDlint - check MOVED for consistency # # Usage: @@ -39,9 +37,7 @@ if (ARGC == 1) { ARGV[ARGC++] = portsdir "/MOVED" if (ENVIRON["BLAME"]) { - if (!system("test -d " portsdir "/.svn")) { - blame = "cd " portsdir "; svn blame MOVED 2>/dev/null" - } else if (!system("test -d " portsdir "/.git")) { + if (!system("test -r " portsdir "/.git")) { blame = "cd " portsdir "; git blame MOVED 2>/dev/null" } Index: Tools/scripts/README =================================================================== --- Tools/scripts/README +++ Tools/scripts/README @@ -8,7 +8,6 @@ MOVEDlint.awk - checks MOVED for common errors LEGALlint - checks LEGAL for common errors ardiff - compare two archives easily -addport - replacement for easy-import bad-pkgdescrs.sh - locate identical pkg descriptions bump_revision.pl - Small script to bump the PORTREVISION variable of ports which are depending on a port with a changed shared lib @@ -32,7 +31,6 @@ gnomedepends - Analyse pkg/PLIST and give an advice as to which GNOME ports should be listes in {RUN,LIB}_DEPENDS for this port mark_safe.pl - utility to set subsets of ports to MAKE_JOBS_(UN)SAFE=yes -mfh - Merge from head to a given branch neededlibs.sh - Extract direct library dependencies from binaries. portsearch - A utility for searching the ports tree. It allows more detailed search criteria than ``make search key='' and accepts Index: Tools/scripts/addport =================================================================== --- Tools/scripts/addport +++ /dev/null @@ -1,627 +0,0 @@ -#!/usr/bin/env perl -# -# addport - perl script that adds new ports to the -# FreeBSD Ports Collection. Replaces easy-import. -# -# Copyright (c) 2000 Will Andrews and Michael Haro -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# Original shell script & idea: Will Andrews -# Original conversion to Perl : Michael Haro -# Maintainer alumni : Renato Botelho -# -# Id: addport,v 1.2 2000/04/02 06:21:13 will Exp (original shell script) -# Id: addport,v 1.5 2000/04/22 22:19:43 mharo Exp (perl conversion) -# $FreeBSD$ -# -# MAINTAINER= crees@FreeBSD.org -# - -# Smartmatch operator (~~) used -require 5.10.1; - -use Cwd "abs_path"; -use Getopt::Std; -use Sys::Hostname; -use locale; -use strict; - -# Subroutine prototypes -sub warnx($); -sub err($$); -sub errx($$); -sub prompt($); -sub query($); -sub usage(); -sub contains($@); -sub lsports(); -sub lastcomment(); - -my %opts; - -getopts('ac:d:fh:il:L:mns:tu:y', \%opts); - -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 $distdir = $opts{'s'} if ($opts{'s'} ne ""); -my $dir = $opts{'d'}; -my $h = "repo.FreeBSD.org"; -$h = $opts{'h'} if ($opts{'h'} ne ""); -my $u = $ENV{USER}; -$u = $opts{'u'} if ($opts{'u'} ne ""); -my $more_testing = $opts{'t'}; -my $interactive = $opts{'i'}; -my $nomkdir = $opts{'m'}; -my $addlchk = $opts{'a'}; -my $nofetch = $opts{'f'}; -my $checkexist = $opts{'y'}; -my $currentdir = abs_path("."); -my %l10nprefix = ( - 'chinese' => 'zh-', - 'french' => 'fr-', - 'german' => 'de-', - 'hebrew' => 'iw-', - 'hungarian' => 'hu-', - 'japanese' => 'ja-', - 'korean' => 'ko-', - 'portuguese' => 'pt-', - 'russian' => 'ru-', - 'ukrainian' => 'uk-', - 'vietnamese' => 'vi-', -); - -my $tmpdir; -my $repo; -my $portsdir = $ENV{PORTSDIR} ? $ENV{PORTSDIR} : '/usr/ports'; -my $repo = $ENV{ADDPSVNROOT}? $ENV{ADDPSVNROOT} : "svn+ssh://$u\@$h/ports/head"; -my $make = "make"; -my $portlint = `which portlint`; chomp $portlint; -my $plint_args = "-N -a -c -t"; -my $perl = "perl"; -my $cp = "cp"; -my $mv = "mv"; -my $rm = "rm"; -chomp(my $svnlite = `which svnlite`); -my $svn = ($svnlite ? $svnlite : "svn"); -my $keyword = '\$FreeBSD\\\$'; -# vars required for commitfile -my $descr; my $portversion; my $pkgcomment; -my $tmp; my $pkgcommentlen; my $comment; my $maintainer = ""; -my $maintaineraddr; my $tmp2; my $offset; my $commitfile = ""; -my $moved = ""; -$tmp = $tmp2 = $offset = 0; - -# Check the editor. -my $edit = "/usr/bin/vi"; -$edit = $ENV{EDITOR} if ($ENV{EDITOR} ne ""); - -# Check svn version -my $svnversion = `$svn --version --quiet 2>/dev/null`; -chomp $svnversion; -if ($svnversion eq "") { - errx(1, "Subversion binary not found in \$PATH, aborting."); -} -my @svnversion = split(/\./, $svnversion); -if ($svnversion[0] == 1 && $svnversion[1] < 7) { - errx(1, "minimum Subversion version of 1.7 not met, aborting."); -} - -# stuff that always happens when we start -BEGIN { - $tmpdir=`mktemp -d -t ap`; - chomp $tmpdir; - if ($tmpdir eq "") { - errx(1,"making random tmpdir didn't work, aborting."); - } -} - -# stuff that always happens when we exit -END { - # only remove $tmpdir if it points to something in /tmp - # this is a silly little security thing - if (defined($rm) && defined($tmpdir)) { - system("$rm -rf $tmpdir") if ($tmpdir =~ m,/tmp/,); - } -} - -# setup the list of commands to run on the new port(s). -my @commands; -my $passenv = ""; -if ($addlchk && -f $portlint) { - $passenv = "DISTDIR=\"$distdir\"" if -d $distdir; - $passenv = $passenv . " PORTSDIR=\"$portsdir\"" if !$nomkdir; - push(@commands, "$make $passenv clean check-categories"); - push(@commands, "$portlint $plint_args"); - push(@commands, "$make $passenv FETCH_BEFORE_ARGS='-A' checksum") if !$nofetch; - if ($more_testing) { - push(@commands, "$make $passenv distclean"); - push(@commands, "$make $passenv build"); - push(@commands, "$make $passenv distclean"); - } - if (!$nomkdir) { - chdir $tmpdir; - print "Checking out Mk directory to ensure portlint correctness.\n"; - system("$svn co $repo/Mk Mk") && errx(1, "Could not checkout Mk directory"); - system("$svn co $repo/Templates Templates") && errx(1, "Could not checkout Templates directory"); - chdir $currentdir; - } -} - -if ($dir eq "") { - warnx("Need to specify a directory with -d argument!"); - usage(); - exit 1; -} - -# check the port doesn't exist already - -if ($checkexist) { - my $found = 0; - print ">> Fetching INDEX to scan for duplicates...\n"; - my $indexfile = "$tmpdir/" . `$make -C $portsdir -V INDEXFILE`; - 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 = ) { - $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. - if (!$autofill) { - if (-f $c) { - system("$mv $c $tmpdir/commitfile") && errx(1, "Oops, can't move commitfile!"); - print "\nRemember, you asked to use a commit file to read for the commit log.\n"; - print "This means you'll get a message saying the log message was unchanged or\n"; - print "not specified. Just tell it to continue and it will be committed.\n\n"; - $commitfile = "--file $tmpdir/commitfile"; - } - } else { - ## Set up the autofill file. - # Read COMMENT for part of the commit message. - 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); - } - chomp($maintaineraddr = `$make $passenv -V MAINTAINER`); - chomp($portversion = `$make $passenv -V PORTVERSION`); - # Read Makefile to find necessary variables. - open(MAKEFILE, "Makefile") or die("Can't open Makefile for reading: $!"); - while() { - chomp; - die ("Old style Makefile headers detected") if (/^# (?:[Nn]ew )?[Pp]orts collection [Mm]akefile/); - ($maintainer) = (m/^# Created by:\s+(\w.*)$/) if (/^# Created by/); - } - close(MAKEFILE); - $maintainer = $maintaineraddr unless ($maintainer); - # Write out the data to the comment file. - open(AUTOFILL, "> $tmpdir/commitfile") or die("Can't open $tmpdir/commitfile for writing: $!"); - 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: $autofill\n" if ($autofill != -1); - print AUTOFILL "Submitted by: $maintainer" if ($maintainer && $autofill != -1); - close(AUTOFILL); - print "Okay, a commit log message was automatically generated for you.\n"; - print "Now you will have a chance to edit it to make sure it's OK to use.\n"; - print "Here's the contents of the file:\n--start--\n"; - open(AUTOFILL, "$tmpdir/commitfile") or die("Can't open $tmpdir/commitfile for reading: $!"); - print while (); - close(AUTOFILL); - $tmp = prompt("\n--end--\nDo you wish to edit the file before continuing? "); - system("$edit $tmpdir/commitfile") if ($tmp == 0); - print "\nRemember, you asked to use a commit file to read for the commit log.\n"; - print "This means you'll get a message saying the log message was unchanged or\n"; - print "not specified. Just tell it to continue and it will be committed.\n\n"; - $commitfile = "--file $tmpdir/commitfile"; - } - - print "We're ready to commit.\n"; - print "Source directory: $thisdir\n"; - print "Target SVN Repo directory: ports/$category/$portname\n"; - prompt("Adding port $portname to $category OK? ") && errx(1, "user abort requested"); - - chdir $tmpdir or err(1, "$tmpdir"); - - # let's get our hands dirty. - if (! -d "ports") { - system("$svn co --depth empty $repo ports") && errx(1, "can't get ports root, aborting."); - } - chdir "ports" or err(1,"ports"); - if (! -d "$category") { - system("$svn up --depth files $category") && errx(1, "can't get temporary category directory, aborting."); - } - chdir $category or err(1,"$category"); - - # check for previous existence of port -- on the way use filthy - # home-made XML parser. - # Until svn revs are in the database, we'll use dates. - print "Checking for previous versions of $category/$portname... \n"; - my $previous_incarnation = "bogus"; - my $oldportlist = `/usr/bin/fetch -qo - http://people.FreeBSD.org/~crees/removed_ports/index.xml`; - if ($oldportlist !=~ /^fetch:[^:]+: Not Found/) { - foreach (split("\n", $oldportlist)) { - if (/^ +\$category\/$portname(?:\r([0-9]*)\<\/removed_revision\>)?\([^<]*)/) { - print "Found one!\n"; - if ($1 == "") { - $previous_incarnation = $2; - $previous_incarnation =~ s,/,-,g; - print "This port was last alive on $previous_incarnation.\n"; - $previous_incarnation = "\{$previous_incarnation\}"; - } else { - $previous_incarnation = $1 - 1; - print "The last living revision of this port was r$previous_incarnation.\n"; - } - last; - } - } - } else { - print "Could not fetch list-- perhaps the site is down."; - } - if ($previous_incarnation ne "bogus") { - print "Fetching older version... "; - system("$svn cp -q '$repo/$category/$portname\@$previous_incarnation' ."); - print "[DONE]\n"; - print "Removing irrelevant files and directories... "; - my @oldfiles = split("\0", `cd $portname && find . -type f -print0`); - my @olddirs = split("\0", `cd $portname && find . -type d -print0 | sort -r`); - my @newfiles = split("\0", `cd $thisdir && find . -type f -print0`); - my @newdirs = split("\0", `cd $thisdir && find . -type d -print0| sort -r`); - - foreach my $file (@oldfiles) { - system("cd $portname && $svn rm $file") - if !($file ~~ @newfiles) - } - - foreach my $directory (@olddirs) { - system("cd $portname && $svn rm $directory") - if !($directory ~~ @newdirs); - } - - print "[DONE]\n"; - - # Remove cvs2svn props if present - print "Removing cvs2svn props...\n"; - system("$svn propdel -qR cvs2svn:cvs-rev $portname"); - - $moved = "MOVED"; - print "Removing port's entry from $moved...\n"; - system("cd .. && $svn up -q $moved && sed -i '' -e '\\,^$category/$portname\|\|,d' $moved"); - - # Add note to log about readdition - system("echo '(Readdition of $category/$portname which was removed on $previous_incarnation)\n' > $tmpdir/commitfile.tmp && cat $tmpdir/commitfile >> $tmpdir/commitfile.tmp && mv $tmpdir/commitfile.tmp $tmpdir/commitfile") unless ($commitfile eq ""); - - } else { - print "[none found]\n"; - } - system("$cp -PRp $thisdir ."); - system("$svn add --force --depth empty `find $portname -type d | grep -v '^$portname/work'`") && errx(1, "svn add for dirs failed, aborting."); - - system("$svn add --force `find $portname -type f | grep -v '^$portname/work'`") && errx(1, "svn add for files failed, aborting."); - - # Find keywords in old files and strip - print "Stripping any keywords...\n"; - system("sed -i '' -e 's,\\\$Free" . "BSD:[^\$]*\\\$,\$Free" . "BSD\$,' \$(find $portname -type f)"); - - # find files with keywords in and propset - - print "Setting correct properties on files...\n"; - - my @portfiles = split("\0", `find $portname -type f -print0`); - my $portfiles = join(" ", @portfiles); - my @keywordfiles = split("\n", `grep -l $keyword $portfiles`); - foreach (@portfiles) { - if ($_ ~~ @keywordfiles) { - system("$svn -q propset svn:keywords FreeBSD=%H $_"); - system("$svn -q propdel fbsd:nokeywords $_"); - } else { - system("$svn -q propset fbsd:nokeywords on $_"); - system("$svn -q propdel svn:keywords $_"); - } - } - - # strip svn:executable if added-- not allowed - - system("cd $portname && $svn -qR propdel svn:executable"); - - # figure out where the port name belongs in category Makefile - my ($spaces, @ports) = &lsports; - errx(1, "Error: $portname already exists in $category\'s Makefile") if (&contains($portname, @ports)); - my $port = ""; - foreach my $tmp (sort(@ports)) { - if ($tmp gt $portname) { - $port = $tmp; - last; - } - } - - # now let's insert it - my $cmd; - 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 for example). - my $lastcommentnum = &lastcomment; - $cmd = "$lastcommentnum\n+\ni\n"; - } else { - 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 = "/^" . $spaces . "SUBDIR += $port/\na\n"; - } else { - # OK, append ourselves in the right place, so things *stay* sorted. - $cmd = "/^" . $spaces . "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"; - print ED "$cmd" . $spaces . "SUBDIR += $portname\n.\nw\nq\n"; - close(ED); - - # commit the actual port. - chdir "$tmpdir/ports" or err(1, "$tmpdir/ports"); - if ($opts{'n'}) { - print "Faking commit....\n"; - } else { - system("$svn ci $commitfile $moved $category/Makefile $category/$portname") && errx(1, "svn commit failed, aborting."); - } -} - -print <; - chomp $reply; - return $reply; -} - -sub usage() { -#addport,v \$Revision: 1.21 $ -print <, - -SYNOPSIS - $0 [-c commitfile] [-h host] [-l PR number | -L PR number] - [-s distdir] [-u user] [-afimnty] -d directory - - Where "directory" contains the comma-delimited list - of root directories of new ports that you wish to - add to the Ports Collection. The name of this directory - *WILL* matter in regards to the repository! - -OPTIONS - -a Perform checks on the port to make sure - there are no problems. Recommended. - -c file Use file in place of normal log message. - -f Do not fetch the distfile. - -h host Use a svnhost besides repo.FreeBSD.org. - -i Interactive mode; allow more control over - where things are placed. - -l PR# Attempts to autogenerate a commit message by - reading the Makefile file. - 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. - -s distdir Use a different directory besides the default, - for downloading distfiles. - -t Do more port testing. Requires -a. - -u user Use a different username (default: $u). - -y Check for similarly named ports. - -ENVIRONMENT VARIABLES - $0 supports the following environment variables: - - ADDPSVNROOT - Location of SVN repository. - USER - Username of user invoking $0. - -EXAMPLES - % addport -n -d greatgame,helpfuldev,shoot - Will show what happens but not actually commit ports - named "greatgame", "helpfuldev", and "shoot". - - % addport - Displays this message. :-) - -EOF -} - -sub contains($@) { - # look if the first parameter is contained in the list following it - my ($item, @list) = @_; - - foreach my $i (@list) { - return 1 if $i eq $item; - } - return 0; -} - -sub lsports() { - my @rv = (); - my $spaces; - - open(F, "Makefile") || die "can't open Makefile: $!"; - while() { - chomp; - chomp; - next if $_ !~ m/SUBDIR/; - - if ( !defined($spaces) ) { - m/^([\s\t]+)[^\s\t]/; - $spaces = $1; - } - - s/^[ \t]+SUBDIR[ \t]+\+?=[\ \t]+//; - push(@rv, $_); - } - close(F); - - return ($spaces, @rv); -} - -# this finds the last comment in the Makefile -sub lastcomment() { - my $num = 0; - my $diff = 0; - - open(F, "Makefile"); - while() { - chomp; - if ($_ =~ m/^#/) { - $num += $diff; - $num++; - $diff = 0; - } else { - $diff += 1; - } - next; - } - return $num; -} - Index: Tools/scripts/chkversion.pl =================================================================== --- Tools/scripts/chkversion.pl +++ Tools/scripts/chkversion.pl @@ -53,7 +53,6 @@ # and enter something like # # BLAME=yes (git specific) -# SVNBLAME=yes # XXX: SVN specific # ALLPORTS=yes # RCPT_ORIGIN=you@domain.example # RCPT_VERSION=you@domain.example @@ -64,10 +63,6 @@ # If the environment variable BLAME is set and the ports tree is checked # out by git, every entry is listed with a record of the last git commit. # -# XXX: SVN specific: -# If the environment variable SVNBLAME is set and the ports tree is checked -# out by SVN, every entry is listed with a record of the last SVN commit. -# use v5.20; use strict; @@ -83,7 +78,6 @@ my $portsdir = $ENV{PORTSDIR} // '/usr/ports'; my $versiondir = $ENV{VERSIONDIR} // '/var/db/chkversion'; -my $svnblame = exists $ENV{SVNBLAME}; # XXX: SVN specific my $blame = exists $ENV{BLAME}; my $allports = exists $ENV{ALLPORTS}; @@ -100,7 +94,6 @@ my $cc_mntnr = exists $ENV{CC_MAINTAINER}; my $make = '/usr/bin/make'; -my $svn = '/usr/local/bin/svn'; # XXX: SVN specific my $git = '/usr/local/bin/git'; my $sendmail = '/usr/sbin/sendmail'; my $pkg = first { -x $_ } ($ENV{PKG} // '', '/usr/local/sbin/pkg', '/usr/sbin/pkg'); @@ -151,7 +144,6 @@ # Skip directories we shouldn't descend into # if (/^.git$/ if (/^\.git$/ - || /^\.svn$/ # XXX: SVN specific || $File::Find::name =~ m"^$portsdir/(?:Mk|Templates|Tools|distfiles|packages)$"os || $File::Find::name =~ m"^$portsdir/[^/]+/pkg$"os) { @@ -304,15 +296,6 @@ my @log = readfrom $portdir, $git, 'log', "${rev}^..HEAD", 'Makefile'; print $fh " | $_\n" for @log; } - # XXX: SVN specific: - elsif ($svnblame && -d "$portsdir/.svn") { - my @svnlog = readfrom $portdir, $svn, 'log', ($rev ? "-r$rev" : ''), 'Makefile'; - for (@svnlog) { - my $in_log = /^-{20,}$/ ... /^(-{20,}|={70,})$/; - print $fh " | $_\n" - if ($in_log && $in_log ne 1 && $in_log !~ /E0$/); - } - } } # Git version: Index: Tools/scripts/mfh =================================================================== --- Tools/scripts/mfh +++ /dev/null @@ -1,195 +0,0 @@ -#!/bin/sh -# -# mfh - Merge from head to a given branch -# -# Usage: mfh [] [] -# is optional and defaults to latest branch -# If supplying multiple revnumbers, put them in chronological order -# (111111 111112 111113) -# -# Copyright 2013 Baptiste Daroussin -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# MAINTAINER= portmgr@FreeBSD.org - -set -eu - -LF=$(printf '\nX') -LF=${LF%X} -IFS="${LF}" - -# defaults from here --------------------------- - -: ${svnserver:="svn+ssh://repo.FreeBSD.org"} -: ${EDITOR:=vi} - -# implementation from here --------------------- - -err() { - echo "$@" >&2 - exit 1 -} - -ask() { - question=${1} - - answer=x - while [ "${answer}" != "y" -a "${answer}" != "n" ] ; do - printf "%s [y/n] " "${question}" - read -r answer - done - - [ "${answer}" = "y" ] && return 0 - return 1 -} - -# -- find svn and diff coloring command -- - -if [ -n "$(command -v svn 2>/dev/null)" ]; then - svn=svn -elif [ -n "$(command -v svnlite 2>/dev/null)" ]; then - svn=svnlite -else - err "Neither svn(1) nor svnlite(1) found. Please install devel/subversion." -fi - -latest_branch=$("${svn}" ls ${svnserver}/ports/branches/|sed -ne '/^2.*Q./s|/$||p'|tail -1) - -[ $# -lt 1 ] && err "$(basename "$0") requires at least 1 arguments: [] [...]" -branch=$1 - -if [ -n "$(command -v ydiff)" ] ; then cdiffcmd=ydiff -elif [ -n "$(command -v colordiff)" ] ; then cdiffcmd=colordiff -else cdiffcmd=cat -fi - -# I sure hope by 2030 we'll be doing something else. Yes, famous last words. -if expr -- "${branch}" : '20[12][0-9]Q[1-4]' > /dev/null; then - shift - if [ "${latest_branch}" != "${branch}" ]; then - ask "/!\\ The latest branch is ${latest_branch}, do you really want to commit to ${branch}?" || exit 1 - fi -else - branch=${latest_branch} -fi - -## -- parse revisions -- - -for rev in "$@" -do - rev=${rev##r} # remove a leading "r" - case ${rev} in - ''|*[!-0-9]*) err "revision \"${rev}\" should be a number" ;; - esac -done - -## -- set up tmpdir and auto-clean -- - -dir=$(mktemp -d /tmp/mfh.XXXXXX) -trap "rc=\$? ; echo '+ rm -rf \"${dir}\"' ; rm -rf \"\${dir}\" ; trap - EXIT ; exit \$rc" EXIT INT QUIT TERM -cd "${dir}" - -## -- check out, merge, generate commit log -- - -printf "MFH:" > commit.txt -for rev in "$@" -do - rev=${rev##r} - printf " r%s" "${rev}" >> commit.txt -done -echo >> commit.txt - -# iterate over revisions to assemble dirlist (for checkout) -# and accumulate log messages -dirlist="" -for rev in "$@" -do - rev=${rev##r} - for f in $("${svn}" diff --summarize -c "r${rev}" "${svnserver}/ports/head"); do - # ignore top-level filenames without slash - case ${f} in - */*) ;; - *) continue ;; - esac - f=${f#*/ports/head/} - # strip down f to the first two components (CATEGORY/PORTNAME), - # so that if the MFH only addresses files/, we still get the - # full port to review, and, for instance, bump PORTREVISION - # separately if the patch was broken out from a larger lump. - while :; do - case ${f} in - */*/*) f=${f%/*} ;; - *) break ;; - esac - done - dirlist="${dirlist}${f}${LF}" - done - "${svn}" log "-r${rev##-}" ${svnserver}/ports/head | sed '1,2d;$d;/^MFH:/d' \ - | sed '$d' >> commit.txt -done -dirlist=$(printf '%s' "${dirlist}" | sort -u | sed "s}^}${branch}/}") - -"${svn}" co --quiet --depth=empty ${svnserver}/ports/branches/"${branch}" -"${svn}" up --parents --set-depth=infinity $dirlist -"${svn}" up --quiet "${branch}" -for rev in "$@" -do - rev=${rev##r} - "${svn}" merge -c "r${rev}" ^/head/ "${branch}" -done -"${svn}" up --quiet "${branch}" - -## -- present final result to user -- -svnstat=$("${svn}" status "${branch}") -if [ -z "${svnstat}" ] ; then - err "The MFH came up empty - already merged? Wrong revision given?" -fi - -echo -printf '%s\n' "${svnstat}" -"${svn}" diff "${branch}" | $cdiffcmd -printf '\nSee the status/diff above: all the merge work was done on %s.\n' "${dir}/${branch}" -ask "Do you want to commit? (no = start a shell)" || ( - echo "Dropping you to a shell so you can investigate. Exit the shell to resume this script." - cd "${branch}" - pwd - su -m $(id -un) || : - ask "Do you want to commit now? (no = clean up and abort)" || err "User-requested abort." -) -echo >> commit.txt - -## -- edit pre-assembled log message and commit -- -${EDITOR} commit.txt -while ! "${svn}" ci -F commit.txt "${branch}"; do - if ! ask "Commit failed. Re-edit message and try again?"; then - save_log="$(mktemp -t mfh)" - cp -f commit.txt "${save_log}" - echo "Saving commit log to ${save_log}" - break - fi - ${EDITOR} commit.txt -done - -# the trap will clean up for us -exit 0 Index: Tools/scripts/psvn =================================================================== --- Tools/scripts/psvn +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/sh -eu -# -# psvn - Wrapper to set Subversion properties automatically -# -# Copyright (c) 2012 Beat Gaetzi -# Copyright (c) 2012,2014 Matthias Andree -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# -# $FreeBSD$ -# -# MAINTAINER= mandree@FreeBSD.org -# beat@ has implicit approval to change this script. -# - -# -# The psvn wrapper checkes from replaced, conflicting, missing or -# untracked files. When committing it adds the needed Subversion -# properties and removes unneeded ones. -# There is also adds a check subcommand which just executes the -# checks. -# - -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:${PATH} -export PATH - -SVN="$(which svn)" -LF="$(printf '\nX')" -LF="${LF%X}" - -VERSION=$("${SVN}" --version --quiet | sed -e 's,^\(.*\)\.\(.*\)\..*,\1\2,') -if [ ${VERSION} -lt 17 ] ; -then - echo "===> Please consider upgrading to Subversion 1.7 (or newer)" -fi - -checkstatus () { - local IFS _error _file _status _statusline - - _error=0 - eval "set -- $@" - IFS="$LF" - set -- $("${SVN}" status -- "$@") - - for _statusline - do - _status="$(printf '%.7s' "${_statusline}")" - _file="${_statusline##????????}" - - case "${_status}" in - R*) - printf >&2 '===> Do not replace files as this may lose history: "%s"\n' "${_file}" - _error=1 - ;; - C*|?C*) - printf >&2 '===> Conflict detected: \"%s\"\n' "${_file}" - _error=1 - ;; - \~*) - printf >&2 '===> Versioned item \"%s\" obstructed.\n' "${_file}" - _error=1 - ;; - \?*) - printf >&2 '===> Untracked new file "%s". Consider svn adding or deleting it.\n' "${_file}" - _error=1 - ;; - \!*) - printf >&2 '===> Missing file "%s". Consider re-adding or svn deleting it.\n' "${_file}" - _error=1 - ;; - esac - done - - if [ ${_error} -ne 0 ] ; - then - exit 1 - fi -} - -setprop () { - local _file - - eval "set -- $1" - - for _file - do - if [ -d "${_file}" -o ! -e "${_file}" ] ; - then - continue - fi - printf >&2 '=> Adding svn keywords to "%s"\n' "${_file}" - case $(egrep -- '\$FreeBSD\$|\$[BDFSer]+:' "${_file}" >/dev/null || echo $?) in - "") # matched pattern - "${SVN}" -q -- propset svn:keywords "FreeBSD=%H" "${_file}" - "${SVN}" -q -- propdel fbsd:nokeywords "${_file}" - ;; - 1) # no match - "${SVN}" -q -- propset fbsd:nokeywords yes "${_file}" - "${SVN}" -q -- propdel svn:keywords "${_file}" - ;; - *) # egrep failed - exit 1 - ;; - esac - if [ "${_file##/*}" != "bsd.port.mk" ] ; then - "${SVN}" -q -- propset svn:eol-style native "${_file}" - fi - "${SVN}" -q -- propset svn:mime-type text/plain "${_file}" - "${SVN}" -q -- propdel cvs2svn:cvs-rev "${_file}" - done -} - -# taken from "Rich's sh (POSIX shell) tricks", -# a "Programming Guide[...]" at http://www.etalabs.net/sh_tricks.html -savearray() { - for i do - printf %s\\n "$i" | sed -e "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" - done - echo " " -} - -getfilequotedarray() { - local varname IFS - varname="$1" - shift - IFS="$LF" - set -- $("${SVN}" status -- "$@" | grep -v '^ ' | sed 's/^....... //') - eval "$varname=\$(savearray "\$@")" -} - -for opt ; do - case "${opt}" in - -*) continue ;; - esac - case "${opt}" in - check) - shift - if [ $# -gt 0 ] ; then - echo >&2 "===> Unsupported option before, or garbage after command" - exit 1 - fi - getfilequotedarray "files" "$@" - checkstatus "${files}" - exit 0 - ;; - ci|commit) - savedargs=$(savearray "$@") - shift - while getopts :qm:F: opt - do - case "$opt" in - q) ;; - m) ;; - F) ;; - \?) echo >&2 "===> Unsupported option -$OPTARG encountered. Abort." - exit 1 ;; - :) echo >&2 "===> Missing argument to option -$OPTARG. Abort." - exit 1 ;; - esac - done - shift $(($OPTIND - 1)) - - getfilequotedarray "files" "$@" - checkstatus "${files}" - setprop "${files}" - - eval "set -- $savedargs" - exec "${SVN}" "$@" - ;; - *) - exec "${SVN}" "$@" - ;; - esac -done Index: Tools/scripts/rmport =================================================================== --- Tools/scripts/rmport +++ Tools/scripts/rmport @@ -4,7 +4,7 @@ # # Copyright 2006-2007 Vasil Dimov # Copyright 2012-2018 Chris Rees -# Copyright 2016-2018 Rene Ladan +# Copyright 2016-2020 René Ladan # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -32,37 +32,28 @@ # Originally written by Vasil Dimov # Others: # Chris Rees -# Rene Ladan -# -# $FreeBSD$ +# René Ladan # # MAINTAINER= crees@FreeBSD.org # EDITOR=${EDITOR:-/usr/bin/vi} PORTSDIR=${PORTSDIR:-/usr/ports} -INDEX=${PORTSDIR}/`make -C ${PORTSDIR} -V INDEXFILE` +INDEX=${PORTSDIR}/$(make -C ${PORTSDIR} -V INDEXFILE) -TODAY=`date -u -v+0d +%Y-%m-%d` +TODAY=$(date -u +%Y-%m-%d) SED="sed -i .orig -E" # use ~/.ssh/config to set up the desired username if different than $LOGNAME -SVNREPO=${SVNREPO:-svn+ssh://repo.FreeBSD.org/ports} +GITREPO=${GITREPO:-git@gitrepo.FreeBSD.org:ports.git} -if [ -n "$(command -v svn 2>/dev/null)" ]; then - SVN=svn -elif [ -n "$(command -v svnlite 2>/dev/null)" ]; then - SVN=svnlite +if [ -n "$(command -v git 2>/dev/null)" ]; then + GIT=git else - echo "Neither svn(1) nor svnlite(1) found. Please install devel/subversion." + echo "git(1) not found. Please install devel/git." exit 1 fi - -if ! CDIFF=$(which cdiff) ; then - CDIFF=${PAGER} -fi - log() { echo "==> $*" >&2 @@ -85,8 +76,8 @@ question=${1} answer=x - while [ "${answer}" != "y" -a "${answer}" != "n" ] ; do - read -p "${question} [yn] " answer + while [ "${answer}" != "y" ] && [ "${answer}" != "n" ] ; do + read -p "${question}? [yn]" answer done echo ${answer} @@ -105,13 +96,13 @@ # either absolute or relative # get the full path - rp=`realpath ${arg}` + rp=$(realpath ${arg}) - category=`basename \`dirname ${rp}\`` - port=`basename ${rp}` + category=$(basename $(dirname ${rp})) + port=$(basename ${rp}) echo ${category}/${port} else - echo "What do you mean by \`${arg}'?" >&2 + echo "What do you mean by '${arg}'?" >&2 exit 1 fi } @@ -121,7 +112,8 @@ for category in $(make -C ${PORTSDIR} -V SUBDIR); do for port in $(make -C ${PORTSDIR}/${category} -V SUBDIR); do DATE="$(make -C ${PORTSDIR}/${category}/${port} -V EXPIRATION_DATE)" - if [ -n "${DATE}" -a ! "${DATE}" \> "${TODAY}" ] ; then + # shellcheck disable=SC2039 + if [ -n "${DATE}" ] && [ ! "${DATE}" \> "$${TODAY}" ] ; then if [ "$1" = 1 ] ; then echo -n "${DATE} ${category}/${port}: " make -C ${PORTSDIR}/${category}/${port} -V DEPRECATED @@ -133,24 +125,6 @@ done } -# create temporary checkout directory -mkcodir() -{ - log "creating temporary directory" - d=`mktemp -d -t rmport` - echo "This is the commit message, please edit it." >> ${d}/svnlog - log "created ${d}" - echo "${d}" -} - -# checkout common files from the repository -co_common() -{ - log "getting ports/MOVED and ports/LEGAL from repository" - ${SVN} co --depth empty ${SVNREPO}/head ports - ${SVN} up ports/MOVED ports/LEGAL -} - # check if some ports depend on the given port # XXX Very Little Chance (tm) for breaking INDEX exists: # /usr/ports/INDEX may be outdated and not contain recently added dependencies @@ -158,19 +132,19 @@ { catport=${1} alltorm=${2} - pkgname=`pkgname ${catport}` + pkgname=$(pkgname ${catport}) rmpkgs="" rmcatports="" for torm in ${alltorm} ; do - torm="`echo ${torm} | sed 's/\/$//'`" - rmpkgs="${rmpkgs:+${rmpkgs}|}`pkgname ${torm}`" + torm="$(echo ${torm} | sed 's/\/$//')" + rmpkgs="${rmpkgs:+${rmpkgs}|}$(pkgname ${torm})" rmcatports="${rmcatports:+${rmcatports}|}${PORTSDIR}/${torm}/" done err=0 - deps=`grep -E "${pkgname}" ${INDEX} |grep -vE "^(${rmpkgs})" || :` + deps=$(grep -E "${pkgname}" ${INDEX} |grep -vE "^(${rmpkgs})" || :) if [ -n "${deps}" ] ; then log "${catport}: some port(s) depend on ${pkgname}:" echo "${deps}" >&2 @@ -178,11 +152,9 @@ fi # check if some Makefiles mention the port to be deleted - portdir_grep="^[^#].*/`basename ${catport}`([[:space:]]|@|/|$)" - r="`find -H ${PORTSDIR} -mindepth 2 -maxdepth 3 \ - \( -name "Makefile*" -or -path "*Mk/*.mk" \) \ - |xargs grep -EH "${portdir_grep}" \ - |grep -vE "^(${rmcatports})" || :`" + portdir_grep="^[^#].*/$(basename ${catport})([[:space:]]|@|/|$)" + r="$(${GIT} grep '${portdir_grep}' -- '**Makefile*' 'Mk/' \ + |grep -vE "^(${rmcatports})" || :)" if [ -n "${r}" ] ; then if [ ${err} -eq 1 ] ; then echo >&2 @@ -205,7 +177,7 @@ err=0 - res="`check_dep_core ${catport} "${alltorm}" 2>&1`" || err=1 + res="$(check_dep_core ${catport} "${alltorm}" 2>&1)" || err=1 if [ ${err} -eq 0 ] ; then return 0 @@ -219,7 +191,7 @@ echo "" >&2 echo "you can skip ${catport} and continue with the rest or remove it anyway" >&2 - answer=`ask "do you want to skip ${catport}?"` + answer=$(ask "do you want to skip ${catport}") if [ "${answer}" = "y" ] ; then return 1 else @@ -227,8 +199,8 @@ fi } -# query GNATS via Bugzilla, format and return the result -get_PRs_www() +# query Bugzilla and return the result +get_PRs() { catport=${1} synopsis=${2} @@ -237,7 +209,7 @@ url="https://bugs.freebsd.org/bugzilla/buglist.cgi?quicksearch=${synopsis}" - raw="`fetch -q -T 20 -o - "${url}"`" + raw="$(fetch -q -T 20 -o - "${url}")" if [ -z "${raw}" ] ; then log "${catport}: empty result from URL: ${url}" @@ -249,29 +221,20 @@ |sort } -# query GNATS and return the result -get_PRs() -{ - catport=${1} - synopsis=${2} - - get_PRs_www ${catport} ${synopsis} -} - # check if any PRs exist that are related to the port check_PRs() { catport=${1} synopsis=${2} - PRs="`get_PRs ${catport} "${synopsis}"`" || exit + PRs="$(get_PRs ${catport} "${synopsis}")" || exit if [ -n "${PRs}" ] ; then log "${catport}: PRs found, related to ${synopsis}:" printf "%s\n" "${PRs}" >&2 echo "you can skip ${catport} and continue with the rest or remove it anyway" >&2 - answer=`ask "do you want to skip ${catport}?"` + answer=$(ask "do you want to skip ${catport}") if [ "${answer}" = "y" ] ; then return 1 else @@ -282,17 +245,6 @@ return 0 } -# checkout port's specific files from the repository -co_port() -{ - cat=${1} - port=${2} - - log "${cat}/${port}: getting ${cat}/Makefile and port's files from repository" - ${SVN} up --depth empty ports/${cat} ports/$cat/Makefile - ${SVN} up ports/${cat}/${port} -} - # check if anything about the port is mentioned in ports/LEGAL check_LEGAL() { @@ -302,11 +254,11 @@ for checkstr in ${pkgname} ${catport} ; do msg="${catport}: checking if ${checkstr} is in ports/LEGAL" log "${msg}" - while grep -i ${checkstr} ports/LEGAL ; do + while grep -i ${checkstr} LEGAL ; do echo "" >&2 - echo "${checkstr} is in ${PWD}/ports/LEGAL" >&2 + echo "${checkstr} is in ports/LEGAL" >&2 echo "remove it and hit when ready" >&2 - echo "or hit \`s' to skip this issue and continue anyway" >&2 + echo "or hit 's' to skip this issue and continue anyway" >&2 read answer if [ "${answer}" = "s" ] ; then break @@ -314,6 +266,7 @@ log "${msg}" done done + ${GIT} add LEGAL } # add port's entry to ports/MOVED @@ -321,9 +274,9 @@ { catport=${1} - DEPRECATED="`make -C ${PORTSDIR}/${catport} -V DEPRECATED`" + DEPRECATED="$(make -C ${PORTSDIR}/${catport} -V DEPRECATED)" DEPRECATED=${DEPRECATED:+: ${DEPRECATED}} - if [ -n "`make -C ${PORTSDIR}/${catport} -V EXPIRATION_DATE`" ] ; then + if [ -n "$(make -C ${PORTSDIR}/${catport} -V EXPIRATION_DATE)" ] ; then REASON="Has expired${DEPRECATED}" else REASON="Removed${DEPRECATED}" @@ -331,7 +284,8 @@ log "${catport}: adding entry to ports/MOVED" - echo "${catport}||${TODAY}|${REASON}" >> ports/MOVED + echo "${catport}||${TODAY}|${REASON}" >> MOVED + ${GIT} add MOVED } # remove port from category/Makefile @@ -342,10 +296,10 @@ log "${cat}/${port}: removing from ${cat}/Makefile" - portesc=`escape ${port}` + portesc=$(escape ${port}) - ${SED} -e "/^[[:space:]]*SUBDIR[[:space:]]*\+=[[:space:]]*${portesc}([[:space:]]+#.*)?$/d" \ - ports/${cat}/Makefile + ${SED} -e "/^[[:space:]]*SUBDIR[[:space:]]*\+=[[:space:]]*${portesc}([[:space:]]+#.*)?$/d" ${cat}/Makefile + ${GIT} add ${cat}/Makefile } # remove port's files @@ -355,7 +309,7 @@ log "${catport}: removing port's files" - ${SVN} rm ports/${catport} + ${GIT} rm -r ${catport} } append_Template() @@ -364,81 +318,42 @@ msg=${catport} - EXPIRATION_DATE=`make -C ${PORTSDIR}/${catport} -V EXPIRATION_DATE` + EXPIRATION_DATE=$(make -C ${PORTSDIR}/${catport} -V EXPIRATION_DATE) if [ -n "${EXPIRATION_DATE}" ] ; then msg="${EXPIRATION_DATE} ${msg}" fi - DEPRECATED="`make -C ${PORTSDIR}/${catport} -V DEPRECATED`" + DEPRECATED="$(make -C ${PORTSDIR}/${catport} -V DEPRECATED)" if [ -n "${DEPRECATED}" ] ; then msg="${msg}: ${DEPRECATED}" fi log "${catport}: adding entry to commit message template" - echo "${msg}" >> ./svnlog + echo "${msg}" >> ${gitlog} } -# diff -diff() -{ - log "creating diff" - - diffout=${codir}/diff - - ${SVN} diff --no-diff-deleted ports > ${diffout} 2>&1 || : - - read -p "hit to view svn diff output" dummy - - # give this to the outside world so it can be showed to the committer - # and removed when we are done - echo ${diffout} -} - -# update, ask for confirmation and commit +# update, ask for confirmation and make a commit commit() { - log "running svn update" - ${SVN} up --quiet ports 2>&1 |${PAGER:-less} - - echo >> svnlog - echo - $EDITOR svnlog - - log "Your commit message is:" - cat svnlog - - answer=y - while [ "${answer}" = "y" ] ; do - answer=`ask "Do you want to edit your commit message again?"` - if [ "${answer}" = "y" ] ; then - $EDITOR svnlog - fi - done - - answer=`ask "Do you want to commit now?"` - + ${GIT} commit --file=${gitlog} + answer=$(ask "Do you want to merge and tweak the commit message") if [ "${answer}" = "y" ] ; then - ${SVN} ci --file svnlog ports + ${GIT} checkout main 2>&1 + ${GIT} pull --ff-only 2>&1 + ${GIT} merge --squash ${branch} 2>&1 # history remains linear + ${GIT} commit 2>&1 # modify final commit message + echo "All done, check the result and push when everything is OK." fi } cleanup() { - diffout=${1} - codir=${2} - log "cleaning up" - rm ${diffout} - - rm svnlog - - # release ports directories - rm -rf ports - - cd / - rmdir ${codir} + rm -f ${gitlog} + ${GIT} checkout main + ${GIT} branch -D ${branch} } usage() @@ -465,7 +380,20 @@ # main -if [ ${#} -eq 0 -o "${1}" = "-h" -o "${1}" = "--help" ] ; then +if ! ${GIT} diff --exit-code remotes/origin/main ; then + echo "you have local commits, exiting" >&2 + exit +fi +git_dir="$(${GIT} rev-parse --git-dir)" +exitcode=$? +if [ ${exitcode} -ne 0 ] ; then + echo "not at a git boundary" >&2 + exit +else + cd "${git_dir}/.." || exit 1 +fi + +if [ ${#} -eq 0 ] || [ "${1}" = "-h" ] || [ "${1}" = "--help" ] ; then usage fi @@ -473,7 +401,7 @@ if [ ${#} -ne 2 ] ; then usage fi - catport=`find_catport ${2}` + catport=$(find_catport ${2}) check_dep ${catport} 0 ${catport} exit fi @@ -498,23 +426,22 @@ if [ ${#} -ne 1 ] ; then usage fi - ${0} `find_expired 0` + ${0} $(find_expired 0) exit fi -codir=`mkcodir` -cd ${codir} - -co_common +branch="rmport-$(date +%s)" +${GIT} checkout -b ${branch} remotes/origin/main +gitlog=$(mktemp -t gitlog) for catport in $* ; do # convert to category/port - catport=`find_catport ${catport}` - cat=`dirname ${catport}` - port=`basename ${catport}` + catport=$(find_catport ${catport}) + cat=$(dirname ${catport}) + port=$(basename ${catport}) # remove any trailing slashes catport="${cat}/${port}" - pkgname=`pkgname ${catport}` + pkgname=$(pkgname ${catport}) if ! check_dep ${catport} 1 "${*}" ; then continue @@ -524,8 +451,6 @@ continue fi - co_port ${cat} ${port} - check_LEGAL ${catport} ${pkgname} # everything seems ok, edit the files @@ -543,17 +468,18 @@ # the diff afterwards answer=y while [ "${answer}" = "y" ] ; do - diffout=$(diff) - - ${CDIFF} < ${diffout} + ${GIT} diff --staged --irreversible-delete echo "" >&2 - echo "you can now edit files under ${codir}/ by hand" >&2 - answer=`ask "do you want to recreate the diff?"` + echo "you can now edit files by hand" >&2 + answer=$(ask "do you want to recreate the diff") + if [ "${answer}" = "y" ] ; then + ${GIT} add LEGAL MOVED + fi done commit -cleanup ${diffout} ${codir} +cleanup # EOF Index: Tools/scripts/search_lib_depends_and_bump.sh =================================================================== --- Tools/scripts/search_lib_depends_and_bump.sh +++ Tools/scripts/search_lib_depends_and_bump.sh @@ -94,7 +94,6 @@ echo "All portlint test successfull, please review the changes before you commit them carefully." echo "You maybe want to run now" echo "git diff" - echo "svn diff" echo break; fi Index: Tools/scripts/tindex =================================================================== --- Tools/scripts/tindex +++ Tools/scripts/tindex @@ -6,7 +6,7 @@ # that 'make fetchindex' sees it. # # When INDEX is broken, assemble the list of committers who touched files -# on the most recent 'svn update', and put those committers "on the hook". +# on the most recent 'git pull', and put those committers "on the hook". # These committers all stay on the hook until INDEX is buildable again. # # MAINTAINER= portmgr@FreeBSD.org @@ -44,10 +44,7 @@ blame() { # Find out who is responsible for current version of file $1 - # Fastest way to extract is from svn info - who=$(${SVN} info $1 2>/dev/null | grep '^Last Changed Author' | awk '{print $4}') - - echo $who + git log --no-patch --max-count=1 --format='%ce' $1 } indexfail() { @@ -78,7 +75,7 @@ # Find out which committers are on the hook - commits=$(grep ^U ${PORTSDIR}/svn.log | grep -v INDEX | awk '{print $2}') + commits=$(${GIT} diff --name-only ${OLD_HEAD}) for i in ${commits}; do blame $i >> ${PORTSDIR}/hook done @@ -89,8 +86,8 @@ tr -s '\n' ' ' < ${PORTSDIR}/hook echo echo - echo "Most recent SVN update was:"; - grep -v '/work$' svn.log | grep -v '^\?' + echo "Most recent Git update was:"; + (IFS=""; echo ${commits}) ) | mail -s "INDEX build failed for ${BRANCH}" ${REPORT_ADDRESS} exit 1 } @@ -131,10 +128,10 @@ cd ${PORTSDIR} rm -f INDEX-11 INDEX-11.bz2 INDEX-12 INDEX-12.bz2 INDEX-13 INDEX-13.bz2 INDEX-14 INDEX-14.bz2 -(${SVN} up 2>1 ) > svn.log -if grep -q ^C svn.log ; then - (echo "svn update failed with conflicts:"; - grep ^C svn.log) | mail -s "Ports svn up failed" ${ERROR_ADDRESS} +OLD_HEAD=$(${GIT} rev-parse HEAD) +if ! ${GIT} pull --ff-only > git.log 2>&1 ; then + (echo "Git update failed with conflicts:"; + cat git.log) | mail -s "Ports Git update failed" ${ERROR_ADDRESS} exit 1 fi @@ -148,7 +145,7 @@ echo "Building INDEX for ${branch} with OSVERSION=${OSVERSION}" cd ${PORTSDIR} - ((make index 2> index.err) > index.out) || indexfail ${branch} + ( (make index 2> index.err) > index.out) || indexfail ${branch} if [ -s index.err ]; then indexfail ${branch} fi