diff options
author | Erwin Lansing <erwin@FreeBSD.org> | 2008-06-19 22:09:01 +0000 |
---|---|---|
committer | Erwin Lansing <erwin@FreeBSD.org> | 2008-06-19 22:09:01 +0000 |
commit | e4bbe0c85ebfa053a6a26d740d860b2982c778a2 (patch) | |
tree | 96a5f40ba7e321d1438a6d662dca0233377321d7 /Tools | |
parent | 8b0ba84c09fcd353eea2521cd6ca8e57f82eb781 (diff) | |
download | ports-e4bbe0c85ebfa053a6a26d740d860b2982c778a2.tar.gz ports-e4bbe0c85ebfa053a6a26d740d860b2982c778a2.zip |
Notes
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/addport | 38 | ||||
-rwxr-xr-x | Tools/scripts/chkmodules.pl | 130 | ||||
-rwxr-xr-x | Tools/scripts/modulesupdate | 115 | ||||
-rwxr-xr-x | Tools/scripts/rmport | 26 |
4 files changed, 9 insertions, 300 deletions
diff --git a/Tools/scripts/addport b/Tools/scripts/addport index d80fef29a989..70c95ad3a595 100755 --- a/Tools/scripts/addport +++ b/Tools/scripts/addport @@ -53,18 +53,16 @@ sub usage(); sub contains($@); sub lsports(); sub lastcomment(); -sub addmodule($); my %opts; -getopts('abc:d:fgh:il:L:M:mns:tu:', \%opts); +getopts('abc:d:fh:il:L:M:mns:tu:', \%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 $binfiles = $opts{'b'}; -my $nomodules = $opts{'g'}; my $distdir = $opts{'s'} if ($opts{'s'} ne ""); my $dir = $opts{'d'}; my $h = "pcvs.FreeBSD.org"; @@ -108,7 +106,6 @@ my $perl = "perl"; my $cp = "cp"; my $mv = "mv"; my $rm = "rm"; -my $modulesupdate = ( -f "/usr/local/bin/modulesupdate" ? "/usr/local/bin/modulesupdate" : "$portsdir/Tools/scripts/modulesupdate" ); # vars required for commitfile my $descr; my $portversion; my $pkgcomment; my $tmp; my $pkgcommentlen; my $comment; my $orig; @@ -187,7 +184,7 @@ if ($dir eq "") { chdir $currentdir; my @dirs = split(/\,/, $dir); foreach my $i (@dirs) { $i = abs_path($i); } -my $portname; my $module; my $wrapat; +my $portname; my $wrapat; foreach my $thisdir (@dirs) { # make double sure where we are.. chdir $thisdir; @@ -231,16 +228,6 @@ foreach my $thisdir (@dirs) { chomp(my $cvs_category = $category); $cvs_category =~ s/-/_/g if ($cvs_category !~ /ports-mgmt/); - $module = "$l10nprefix{$category}$portname"; - - if ($interactive) { - if (prompt("Port will be added as module $module. OK? ")) { - do { - $module = query("Preferred module name for $module? "); - } while (prompt("Is the new module name $module OK? ")); - } - } - # Do commitfile checking but only if the user did not request automatic filling. if (!$autofill) { if (-f $c) { @@ -309,7 +296,6 @@ foreach my $thisdir (@dirs) { print "We're ready to commit.\n"; print "Source directory: $thisdir\n"; print "Target CVS Repo directory: ports/$category/$portname\n"; - print "Modules entry: $module --> ports/$category/$portname\n"; prompt("Adding port $portname to $category OK? ") && errx(1, "user abort requested"); chdir $tmpdir or err(1, "$tmpdir"); @@ -378,9 +364,6 @@ foreach my $thisdir (@dirs) { # commit the actual port. chdir "$tmpdir/$category" or err(1, "$tmpdir/$category"); system("$cvs $n ci $commitfile Makefile $portname") && errx(1, "cvs commit failed, aborting."); - if (!$nomodules && ($n ne "-n")) { - addmodule("$sshmod env CVSROOT=$repo $perl $modulesupdate $module ports/$category/$portname") && errx(1, "adding port to modules failed, aborting."); - } } print <<EOF; @@ -434,7 +417,7 @@ authors: <will\@FreeBSD.org>, <mharo\@FreeBSD.org> SYNOPSIS $0 [-c commitfile] [-h host] [-l PR number] [-s distdir] [-u user] - [-abfgimnt] -d directory + [-abfimnt] -d directory Where "directory" contains the comma-delimited list of root directories of new ports that you wish to @@ -448,11 +431,9 @@ OPTIONS files (i.e. don't expand CVS tags) -c file Use file in place of normal log message. -f Do not fetch the distfile. - -g Do not commit to CVSROOT/modules. -h host Use a cvshost besides pcvs.FreeBSD.org. -i Interactive mode; allow more control over - where things are placed. This is required in - order to change things like module names etc. + 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 @@ -540,14 +521,3 @@ sub lastcomment() { return $num; } -# this adds the module -sub addmodule($) { - my ($command) = @_; - - print "*** If you have problems with the below modulesupdate command, PLEASE\n"; - print "*** ensure that you can login to $h from $moduleshost!\n"; - do { - system($command); - } while ( ($? != 0) && !prompt("Add module failed, retry? ") ); - return $?; -} diff --git a/Tools/scripts/chkmodules.pl b/Tools/scripts/chkmodules.pl deleted file mode 100755 index 8ff1f7d1e991..000000000000 --- a/Tools/scripts/chkmodules.pl +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (c) 2004 Oliver Eikemeier. 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. -# -# 3. Neither the name of the author nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED "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 -# COPYRIGHT OWNER 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. -# -# $FreeBSD$ -# -# MAINTAINER= erwin@FreeBSD.org -# -# CVSROOT-ports/modules auditing script, based on a shell script by -# Clement Laforet. -# - -require 5.005; -use strict; -use File::Find; -use Cwd 'abs_path'; - -my $portsdir = $ENV{PORTSDIR} ? $ENV{PORTSDIR} : '/usr/ports'; -my $cvsroot = $ENV{CVSROOT} ? $ENV{CVSROOT} : '/home/ncvs/CVSROOT-ports'; -my @excludes = $ENV{EXCLUDE} ? split(' ', $ENV{EXCLUDE}) : ('local', 'rookies'); - --d "$portsdir" or die "Can't find ports tree at $portsdir.\n"; --f "$cvsroot/modules" or die "Can't read modules file $cvsroot/modules.\n"; -$portsdir = abs_path($portsdir); - -my %ports = ('ports' => 1); - -my $excludepattern = '(?:'.join('|', 'distfiles', 'packages', @excludes).')'; - -sub wanted { - !-d - || ( - /^CVS$/ - || $File::Find::name =~ m"^$portsdir/$excludepattern$"os - || $File::Find::name =~ m"^$portsdir/[^/]+/pkg$"os - ) - && ($File::Find::prune = 1) - || $File::Find::name =~ m"^$portsdir/([^/]+/[^/]+)$"os - && ($ports{$1} = undef) - && ($File::Find::prune = 1) - || $File::Find::name =~ m"^$portsdir/((?:Mk|Templates|Tools)(?:/.+)?)"os - && ($ports{$1} = 1) - || $File::Find::name =~ m"^$portsdir/([^/]+)$"os - && ($ports{$1} = undef); -} - -find(\&wanted, $portsdir); - -my %extraneous; -my %missorted; -my %illegal; - -my $lastmodule = ''; - -open(MODULES, "$cvsroot/modules"); -while (<MODULES>) { - chomp; - next if 1 .. /^# !!MERGE!!/; - next if /^(#|$)/; - my ($module, $portsdir) = split; - if ($lastmodule gt $module) { - $missorted{$.} = $_; - } - $lastmodule = $module; - next if $portsdir eq 'ports'; - if ($module !~ /^[a-z\d]/i || $portsdir !~ m"^ports/([^/]+(?:/[^/]+)?)") { - $illegal{$.} = $_; - next; - } - if (exists $ports{$1}) { - $ports{$1} = $.; - } - else { - $extraneous{$.} = $_; - } -} -close(MODULES); - -my @missing = grep(!defined $ports{$_}, keys %ports); - -print "** chkmodules report: **\n" - if %extraneous || %illegal || %missorted || @missing; - -print join("\n ", - "\nModules with illegal names:", - map("$_: $illegal{$_}", sort { $a <=> $b } keys %illegal)), "\n" - if %illegal; - -print join("\n ", - "\nModules that are not sorted correctly:", - map("$_: $missorted{$_}", sort { $a <=> $b } keys %missorted)), "\n" - if %missorted; - -print join("\n ", - "\nOrphaned entries:", - map("$_: $extraneous{$_}", sort { $a <=> $b } keys %extraneous)), "\n" - if %extraneous; - -print join("\n - ", - "\nMissing entries in modules:", - sort @missing), "\n" - if @missing; - -exit %extraneous || %illegal || %missorted || @missing ? 1 : 0; diff --git a/Tools/scripts/modulesupdate b/Tools/scripts/modulesupdate deleted file mode 100755 index c5a0bbce1f37..000000000000 --- a/Tools/scripts/modulesupdate +++ /dev/null @@ -1,115 +0,0 @@ -#! /usr/bin/perl -# -# This code mostly stolen from easy-import written by J^vrg Wunsch -# -# $Id: modulesupdate,v 1.8 2000/04/02 05:42:12 mharo Exp $ -# $FreeBSD$ - -use strict; - -my $tmpdir; - -if ($ENV{CVSROOT} eq "") { - $ENV{CVSROOT}="pcvs.freebsd.org:/home/pcvs"; -} - -sub goodbye -{ - my ($exitstatus)=@_; - chdir "/tmp"; - print `rm -rf $tmpdir`; - exit $exitstatus; -} - -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 lsmodules -{ - # list all known CVS modules - my(%rv, $mname, $mpath); - - %rv = (); - - print "Checking out the modules database...\n"; - system("cvs -R co modules") && die "failed.\n"; - - my $start_read = 0; - - open(CVS, "<modules/modules") || die "$!"; - while(<CVS>) { - if (/!!MERGE!!/g) { - $start_read = 1; - } - - if ($start_read && /^[^ #]/) { - chomp; - chomp; - ($mname,$mpath) = split; - next if $mname eq ""; - $rv{$mname} = $mpath; - } - } - close(CVS); - - return %rv; -} - -$tmpdir=`mktemp -d -t mu`; -chomp $tmpdir; -chdir $tmpdir or die "$tmpdir: $!"; - -my %cvsmods = &lsmodules; -my $modulename = shift; -my $modulepath = shift; -my $dont_do_it = ""; - -if ($modulepath eq "") { - print "Error: Must specify both modulename and modulepath\n"; - &goodbye(1); -} - -if (&contains($modulename, keys(%cvsmods))) { - print "Error: $modulename already exists in modules\n"; - &goodbye(1); -} - -my $mod = ""; -foreach my $tmp (sort(keys(%cvsmods))) { - if ($tmp gt $modulename) { - $mod = $tmp; - last; - } -} - -my $cmd; -if ($mod eq "") { - # we are going to append our module - $cmd = "\$\na\n"; -} else { - # we can insert it - $cmd = "/^" . $mod . "[ \t]/\ni\n"; -} - -my $len = length($modulename); -print "Inserting new module...\n"; -open(ED, "|ed modules/modules") || die "Cannot start ed\n"; -print ED "$cmd$modulename" . "\t" x ($len < 8 ? 2 : 1) . - "$modulepath\n.\nw\nq\n"; -close(ED); - -print "Commiting new modules database...\n"; -system("cvs -R $dont_do_it commit -m \" " . - "$modulename --> $modulepath\" modules") - && die "Commit failed\n"; - -# cleanup -&goodbye; diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport index 4dc26ac8146e..f8d4b15e8827 100755 --- a/Tools/scripts/rmport +++ b/Tools/scripts/rmport @@ -130,8 +130,8 @@ REPOSITORY # checkout common files from the repository co_common() { - log "getting CVSROOT/modules, ports/MOVED and ports/LEGAL from repository" - ${PCVS} co CVSROOT/modules ports/MOVED ports/LEGAL + log "getting ports/MOVED and ports/LEGAL from repository" + ${PCVS} co ports/MOVED ports/LEGAL } # check if some ports depend on the given port @@ -317,20 +317,6 @@ check_LEGAL() done } -# remove port's entry from CVSROOT/modules -edit_modules() -{ - cat=${1} - port=${2} - - log "${cat}/${port}: removing from CVSROOT/modules" - - portesc=`escape ${port}` - - ${SED} -e "/^(ports_)?(..-)?${portesc}[[:space:]]+ports\/${cat}\/${portesc}\$/d" \ - CVSROOT/modules -} - # add port's entry to ports/MOVED edit_MOVED() { @@ -401,7 +387,7 @@ diff() diffout=${codir}/diff - ${PCVS} diff -u CVSROOT/modules ports > ${diffout} 2>&1 || : + ${PCVS} diff -u ports > ${diffout} 2>&1 || : read -p "hit <enter> to view cvs diff output" dummy @@ -414,12 +400,12 @@ diff() commit() { log "running cvs update" - ${PCVS} up CVSROOT/modules ports 2>&1 |${PAGER:-less} + ${PCVS} up ports 2>&1 |${PAGER:-less} answer=`ask "do you want to commit?"` if [ "${answer}" = "y" ] ; then - ${PCVS} ci CVSROOT/modules ports + ${PCVS} ci ports fi } @@ -529,8 +515,6 @@ for catport in $* ; do # everything seems ok, edit the files - edit_modules ${cat} ${port} - edit_MOVED ${catport} edit_Makefile ${cat} ${port} |