update_branches revision bf8267aa453e5d2a735ed732a043b77a0b355b20
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# Copyright (C) 2005, 2007, 2012 Internet Systems Consortium, Inc. ("ISC")
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# Permission to use, copy, modify, and/or distribute this software for any
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# purpose with or without fee is hereby granted, provided that the above
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# copyright notice and this permission notice appear in all copies.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# PERFORMANCE OF THIS SOFTWARE.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Track which branches are still open or not in the bind9 cvs repository.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# This is done so that work that is "in progress" (active) doesn't get
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# so easily forgotten about.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This script updates doc/private/branches by adding new branches and moving
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# closed branches to the end of the file. New branches are found by walking
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the cvs repository and extracting the new branches from the header fields
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# of the files there.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# doc/private/branches has one line per branch in the following field order:
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews# name, status, to whom the branch belongs and comments. Comments are
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# in '(',')'. The first three field are single words.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Note: this is intended to be run on the machine hosting the CVS repository.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein%history = ();
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Make sure we have a up to date copy. If the previous ran failed for
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# any reason remove it (-C).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein!system("cvs", "-d", $repository, "update", "-C", "doc/private/branches") || die "cannot update doc/private/branches: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# load existing content
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinopen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# T 1999-03-15 21:15 +0000 vixie bind [ietf44:A]
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinopen(HISTORY, "cvs history -T -a 2> /dev/null |") || die("can't get history");
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt s/:[^ \t]+$//;
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt ($tag, $date, $time, $tz, $who, $mod, $branch) = split;
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews# Search repository for new branches.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# New branches have the following format "name:<revision>.0.#"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# where # is the number of potential branches from this the revision.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinopen(FILES, "find $repository/$module -type f -name *,v -print |") || die "can't start find: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein open(FILE, "cvs -d $repository rlog -h $_|") || die "can't start cvs rlog -h $_: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein next unless m/^symbolic names:$/; # skip until we find the tags
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein next unless m/\.0\.\d+$/; # skip if not a branch
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein chomp while (<FILE>); # let cvs rlog exit normally.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Write out updated version.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinopen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t// Comments\n";
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntprint BRANCHES "-----------------------------------------------------------\n\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\tnew\t\tnot yet classified\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\topen\t\tdevelopement branch\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\tactive\t\tnot a development branch\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\treview\t\tready for review\n";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsprint BRANCHES "\t\t\t\tprivate\t\tprivate branch\n";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsprint BRANCHES "\t\t\t\tclosed\t\tfinished with\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print BRANCHES "\t// $comments{$key}" if ($comments{$key} ne "");
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print BRANCHES "\t\t// $comments{$key}" if ($comments{$key} ne "");
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Update if changed.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinif (system("cmp", "-s", "doc/private/newbranches", "doc/private/branches")) {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein !system("cvs", "-d", $repository, "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";