update_branches revision 01163d188b89911c3a23fe1125a4cab6764a408c
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.
47012ae6dbf18a2503d7b33c1c9583dc38625cb7Mark Andrews# $Id: update_branches,v 1.9 2005/05/16 23:38:45 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
cedb0bd0c1e3c461b7e479a16d3adfd5b150f1f4Mark 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# 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", "/proj/cvs/prod", "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: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Search repository for new branches.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinopen(FILES, "find /proj/cvs/prod/bind9 -type f -name *,v -print |") || die "can't start find: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein next unless m/^symbols$/; # skip until we find the tags
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews next unless m/\.0\.\d$/; # skip if not a branch
47012ae6dbf18a2503d7b33c1c9583dc38625cb7Mark Andrews# Write out updated version.
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceopen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t(Comments)\n";
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luceprint BRANCHES "----------------------------------------------------------\n\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print BRANCHES "\t$comments{$key}" if ($comments{$key} ne "");
47012ae6dbf18a2503d7b33c1c9583dc38625cb7Mark 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", "/proj/cvs/prod", "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";