synch_hg_p4/update_repos.pl
author Simon Howkins <simonh@symbian.org>
Mon, 09 Nov 2009 14:27:03 +0000
changeset 104 1350a673dd5f
parent 0 02cd6b52f378
permissions -rw-r--r--
Alternative script for generating release note information about package changes and FCL usage. Uses the sources.csv and sysdef, so doesn't need to access the release archive to access previous package lists or names, and can work concurrently with other build analysis steps.

#! perl

use strict;

# update_repos.pl

my %repos;

foreach my $layer ("os", "mw", "app", "ostools")
	{
	opendir DIR, $layer;
	my @packages = grep !/^\.\.?$/, readdir DIR;
	closedir DIR;
	foreach my $package (@packages)
		{
		next if (-f "$layer/$package");
		$repos{"$layer/$package"} = 1;
		}
	}

print join("\n",sort keys %repos,"","");

my $tree = "d:/Mercurial/";

foreach my $layer ("os", "mw", "app", "ostools")
	{
	opendir DIR, "$tree$layer";
	my @packages = grep !/^\.\.?$/, readdir DIR;
	closedir DIR;
	foreach my $package (@packages)
		{
		next if (-f "$tree$package");
		if (defined $repos{"$layer/$package"})
			{
			# this one is still relevant
			next;
			}
		# package name has changed, I expect
		print "Old package $layer/$package is now obsolete\n";
		rename "$tree$layer/$package", "$tree"."obsolete/".$package;
		}
	}

foreach my $repo (sort keys %repos)
	{
	print "\n\nProcessing $repo\n";
	my ($layer,$package) = split /\//, $repo;
	my $master = "$tree$repo/MCL_$package/.hg";
	
	if (-d $master)
		{
		# repo already exists - move it into place
		rename "$tree$repo/MCL_$package/.hg", "$repo/.hg";
		}
	else
		{
		# New repo
		print "New repository $repo\n";
		mkdir "$tree$layer";
		mkdir "$tree$layer/$package";
		mkdir "$tree$layer/$package/MCL_$package";
		}
		
	chdir $repo;
	system("hg init") if (!-d ".hg");
	system("hg", "commit", "--addremove", "-m", "add wk04 Nokia source");
	chdir "../..";
	rename "$repo/.hg", "$tree$repo/MCL_$package/.hg";
	}