update_branches revision 68843c99b695bf194b019d465f6d33e6297fd02a
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Permission to use, copy, modify, and 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.
2cc6eb92f9443695bc32fa6eed372d983d261a35Automatic Updater# $Id: update_branches,v 1.18 2005/05/18 04:15:55 marka Exp $
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Track which branches are still open or not in the bind9 cvs repository.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This is done so that work that is "in progress" (active) doesn't get
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# 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:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# 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# Make sure we have a up to date copy. If the previous ran failed for
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# 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: $!";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark 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.
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrewsopen(FILES, "find $repository/$module -type f -name *,v -print |") || die "can't start find: $!";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews 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
acb72d5e2c83b597332e3eb0c7d59e1142f1adfdMark Andrews chomp while (<FILE>); # let cvs rlog exit normally.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Write out updated version.
38417cbfb1a328c20b5b723b8584a02c57f88897Automatic Updateropen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
38417cbfb1a328c20b5b723b8584a02c57f88897Automatic Updaterprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t// Comments\n";
38417cbfb1a328c20b5b723b8584a02c57f88897Automatic Updaterprint BRANCHES "-----------------------------------------------------------\n\n";
38417cbfb1a328c20b5b723b8584a02c57f88897Automatic Updaterprint 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";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\tprivate\t\tprivate branch\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\t\t\t\tclosed\t\tfinished with\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print BRANCHES "\t// $comments{$key}" if ($comments{$key} ne "");
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews print BRANCHES "\t\t// $comments{$key}" if ($comments{$key} ne "");
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# 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: $!";