update_branches revision cbb94d52f98b48e8c3a8866dbf8c67860764f349
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# Permission to use, copy, modify, and distribute this software for any
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# 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
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# 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# $Id: update_branches,v 1.7 2005/05/16 07:03:47 marka Exp $
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein!system("cvs", "-d", "/proj/cvs/prod", "update", "doc/private/branches") || die "cannot update doc/private/branches: $!";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# load existing content
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinopen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Search repository for new branches.
f9ce6280cec79deb16ff6d9807aa493ff23e10d9Tinderbox Useropen(FILES, "find /proj/cvs/prod/bind9 -type f -name *,v -print |") || die "can't start find: $!";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User open(FILE, "<$_") || die "can't open $_: $!";
e285c11870c6263cd79b418e104c7eb3e2d96952Tinderbox User next unless m/^symbols$/; # skip until we find the tags
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User next unless m/\.0\.\d$/; # skip if not a branch
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User# Write out updated version.
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Useropen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Userprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\t(Comments)\n";
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Userprint BRANCHES "----------------------------------------------------------\n\n";
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User print BRANCHES "\t$comments{$key}" if ($comments{$key} ne "");
260e8e04b0dc24cb884c789b5d9eb046457f264eTinderbox User print BRANCHES "\t\t$comments{$key}" if ($comments{$key} ne "");
260e8e04b0dc24cb884c789b5d9eb046457f264eTinderbox User# Update if changed.
260e8e04b0dc24cb884c789b5d9eb046457f264eTinderbox Userif (system("cmp", "-s", "doc/private/newbranches", "doc/private/branches")) {
260e8e04b0dc24cb884c789b5d9eb046457f264eTinderbox User rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
260e8e04b0dc24cb884c789b5d9eb046457f264eTinderbox User !system("cvs", "-d", "/proj/cvs/prod", "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";