update_branches revision 01163d188b89911c3a23fe1125a4cab6764a408c
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# Permission to use, copy, modify, and distribute this software for any
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# purpose with or without fee is hereby granted, provided that the above
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# copyright notice and this permission notice appear in all copies.
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# 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,
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# PERFORMANCE OF THIS SOFTWARE.
c6c78f699b55b3344fb6b17ddc854cbae4610468Automatic Updater# $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
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# so easily forgotten about.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This script updates doc/private/branches by adding new branches and moving
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# 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
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Write out updated version.
d71e2e0c61df16ff37c9934c371a4a60c08974f7Mark Andrewsopen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t(Comments)\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinprint BRANCHES "----------------------------------------------------------\n\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print BRANCHES "\t$comments{$key}" if ($comments{$key} ne "");
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 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: $!";