update_branches revision d9b4174233b951f25cd53a2787b9f14314258c2f
d458ef4acb25b66d39525cca3ab5a64c4f210a0bTinderbox User# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# Permission to use, copy, modify, and distribute this software for any
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# purpose with or without fee is hereby granted, provided that the above
d458ef4acb25b66d39525cca3ab5a64c4f210a0bTinderbox User# copyright notice and this permission notice appear in all copies.
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
d458ef4acb25b66d39525cca3ab5a64c4f210a0bTinderbox User# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# PERFORMANCE OF THIS SOFTWARE.
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# $Id: update_branches,v 1.1 2005/05/16 04:21:29 marka Exp $
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# load existing content
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox Useropen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# Search repository for new branches.
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox Useropen(FILES, "find /proj/cvs/prod/bind9 -type f -name *,v -print |") || die "can't start find: $!";
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User open(FILE, "<$_") || die "can't open $_: $!";
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User next unless m/^symbols$/; # skip until we find the tags
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User next unless m/\.0\.\d$/; # skip if not a branch
9c8c1a04853db32f2578a269cab9239c4f4c8b9bTinderbox User# Write out updated version.
9c8c1a04853db32f2578a269cab9239c4f4c8b9bTinderbox Useropen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
9c8c1a04853db32f2578a269cab9239c4f4c8b9bTinderbox Userprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\n";
9c8c1a04853db32f2578a269cab9239c4f4c8b9bTinderbox Userprint BRANCHES "-------------------------------------------------------\n\n";
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User print BRANCHES "\t$comments{$key}" if ($comments{$key} ne "");
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User print BRANCHES "\t\t$comments{$key}" if ($comments{$key} ne "");
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User# Update if changed.
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox Userif (system("cmp", "-s", "doc/private/newbranches", "doc/private/branches")) {
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
49f29a1d550c15d691b5a9162bc089d0fba12adfTinderbox User system("cvs", "-d", "/proj/cvs/prod", "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";