update_branches revision 01163d188b89911c3a23fe1125a4cab6764a408c
a908d41cb4b0658c958383375c5a8f0bcaaf843dFrancis Dupont# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Permission to use, copy, modify, and distribute this software for any
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# purpose with or without fee is hereby granted, provided that the above
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# copyright notice and this permission notice appear in all copies.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# PERFORMANCE OF THIS SOFTWARE.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# $Id: update_branches,v 1.9 2005/05/16 23:38:45 marka Exp $
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Track which branches are still open or not in the bind9 cvs repository.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This is done so that work that is "in progress" (active) doesn't get
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# so easily forgotten about.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This script updates doc/private/branches by adding new branches and moving
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Hunt# closed branches to the end of the file. New branches are found by walking
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# the cvs repository and extracting the new branches from the header fields
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# of the files there.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# doc/private/branches has one line per branch in the following field order:
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# name, status, to whom the branch belongs and comments. Comments are
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# in '(',')'. The first three field are single words.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Make sure we have a up to date copy. If the previous ran failed for
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# any reason remove it (-C).
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews!system("cvs", "-d", "/proj/cvs/prod", "update", "-C", "doc/private/branches") || die "cannot update doc/private/branches: $!";
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# load existing content
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsopen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Search repository for new branches.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsopen(FILES, "find /proj/cvs/prod/bind9 -type f -name *,v -print |") || die "can't start find: $!";
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt next unless m/^symbols$/; # skip until we find the tags
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews next unless m/\.0\.\d$/; # skip if not a branch
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Write out updated version.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsopen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t(Comments)\n";
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsprint BRANCHES "----------------------------------------------------------\n\n";
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews print BRANCHES "\t$comments{$key}" if ($comments{$key} ne "");
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews print BRANCHES "\t\t$comments{$key}" if ($comments{$key} ne "");
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Update if changed.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewsif (system("cmp", "-s", "doc/private/newbranches", "doc/private/branches")) {
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews !system("cvs", "-d", "/proj/cvs/prod", "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";