update_branches revision 648ba62b1f156cbca14d54d06c535385f1193d13
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# Permission to use, copy, modify, and distribute this software for any
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# purpose with or without fee is hereby granted, provided that the above
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# copyright notice and this permission notice appear in all copies.
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
d8417b5f3406f4ace0f3bdb228b05a7b701976d6Andreas Gustafsson# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
d8417b5f3406f4ace0f3bdb228b05a7b701976d6Andreas Gustafsson# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0f7bbb64ea71e1226c34fb433731eebf4b395333Andreas Gustafsson# PERFORMANCE OF THIS SOFTWARE.
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson# $Id: update_branches,v 1.2 2005/05/16 04:27:57 marka Exp $
59ddb53fd74be6c4d76536e45465f34f1a08b834Andreas Gustafsson!system("cvs", "-d", "/proj/cvs/prod", "update", "doc/private/branches") || die "cannot update doc/private/branches: $!";
59ddb53fd74be6c4d76536e45465f34f1a08b834Andreas Gustafsson# load existing content
35b61b8fb1f377ec9b68bbc8e4e43fbd2756a04dAndreas Gustafssonopen(BRANCHES, "<doc/private/branches") || die "can't open util/branches: $!";
074ae7bf0993ced96b32e3e85553a401f3f3eca9Andreas Gustafsson# Search repository for new branches.
074ae7bf0993ced96b32e3e85553a401f3f3eca9Andreas Gustafssonopen(FILES, "find /proj/cvs/prod/bind9 -type f -name *,v -print |") || die "can't start find: $!";
a488e91e5dedfd055b6a6e6dc3018866478facceAndreas Gustafsson # $file = $_; # save for branch debug below.
a488e91e5dedfd055b6a6e6dc3018866478facceAndreas Gustafsson open(FILE, "<$_") || die "can't open $_: $!";
692f5c282d13b6a0276e5a60c87ab4af013d3b80Mark Andrews next unless m/^symbols$/; # skip until we find the tags
d8417b5f3406f4ace0f3bdb228b05a7b701976d6Andreas Gustafsson last if (m/^locks;/); # we are past the tags
d8417b5f3406f4ace0f3bdb228b05a7b701976d6Andreas Gustafsson next unless m/\.0\.\d$/; # skip if not a branch
8f9d22f92aae318244392e217bd53c6173ee6079Andreas Gustafsson# Write out updated version.
8f9d22f92aae318244392e217bd53c6173ee6079Andreas Gustafssonopen(BRANCHES, ">doc/private/newbranches") || die "can't open doc/private/branches: $!";
8f9d22f92aae318244392e217bd53c6173ee6079Andreas Gustafssonprint BRANCHES "\nBranch\t\t\t\tStatus\tWhom\n";
8f9d22f92aae318244392e217bd53c6173ee6079Andreas Gustafssonprint BRANCHES "-------------------------------------------------------\n\n";
4e0ab18258915b14c163aa9087390402f5ff599bAndreas Gustafsson print BRANCHES "\t$comments{$key}" if ($comments{$key} ne "");
a488e91e5dedfd055b6a6e6dc3018866478facceAndreas Gustafsson print BRANCHES "\t\t$comments{$key}" if ($comments{$key} ne "");
a488e91e5dedfd055b6a6e6dc3018866478facceAndreas Gustafsson# Update if changed.
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafssonif (system("cmp", "-s", "doc/private/newbranches", "doc/private/branches")) {
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson rename("doc/private/newbranches", "doc/private/branches") || die "Cannot rename: doc/private/newbranches -> doc/private/branches: $!";
9769d3146777ca71af80b459ecec1ef8e2d05950Andreas Gustafsson !system("cvs", "-d", "/proj/cvs/prod", "commit", "-m", "auto update", "doc/private/branches") || die "cvs commit failed: $!";