[darwinbuild-changes] [274] trunk/darwinbuild/log-index.pl

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 02:02:11 PDT 2006


Revision: 274
          http://trac.macosforge.org/projects/darwinbuild/changeset/274
Author:   kevin
Date:     2006-10-04 02:02:11 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- get current build information from darwinxref

Modified Paths:
--------------
    trunk/darwinbuild/log-index.pl

Modified: trunk/darwinbuild/log-index.pl
===================================================================
--- trunk/darwinbuild/log-index.pl	2005-09-19 22:47:41 UTC (rev 273)
+++ trunk/darwinbuild/log-index.pl	2006-10-04 09:02:11 UTC (rev 274)
@@ -7,6 +7,21 @@
 use File::Basename;
 use File::Glob ':glob';
 
+my $darwinxref = '/usr/local/bin/darwinxref';
+
+sub getBuild {
+	local *BUILD;
+	my $path = '.build/build';
+	if ($ENV{'DARWIN_BUILDROOT'}) {
+		$path = $ENV{'DARWIN_BUILDROOT'} . "/$path";
+	}
+	open BUILD, $path || return undef;
+	my $build = <BUILD>;
+	chomp $build;
+	close BUILD;
+	return $build;
+}
+
 sub getBuildVersion {
 	my $maxbuild = 0;
 	foreach (@_) {
@@ -20,8 +35,13 @@
 	my $build = shift;
 
 	local *PROJECTS;
-	open PROJECTS, '-|', 'darwinxref', '-b', $build, 'version', '*' || die;
-	my @projects = <PROJECTS>;
+	open PROJECTS, '-|', $darwinxref, '-b', $build, 'version', '*' || die;
+	my @projects;
+	while (<PROJECTS>) {
+		my $project = $_;
+		chomp($project);
+		push @projects, $project;
+	}
 	close PROJECTS;
 
 	return @projects;
@@ -31,9 +51,25 @@
 ### Main
 ###
 
-my $LOGDIR = $ARGV[0];
-my $BUILD = "8C46od1";
+my $BUILD = &getBuild();
 
+if (!$BUILD) {
+	print STDERR <<EOB;
+ERROR: please change your working directory to one initialized by:
+  darwinbuild -init <build>
+Alternatively, you may set the DARWIN_BUILDROOT environment variable to the
+absolute path of that directory.
+EOB
+	exit 1;
+}
+
+my $LOGDIR;
+if ($ENV{'DARWIN_BUILDROOT'}) {
+	$LOGDIR = $ENV{'DARWIN_BUILDROOT'} . "/Logs";
+} else {
+	$LOGDIR = "Logs";
+}
+
 print <<EOB;
 <html>
 <head>
@@ -117,9 +153,9 @@
 <tbody>
 EOB
 
-#foreach my $project (getProjects($BUILD)) {
-foreach my $project (sort(bsd_glob("$LOGDIR/*"))) {
-	my $projnam = basename($project);
+foreach my $project (getProjects($BUILD)) {
+	my $projnam = $project;
+	$projnam =~ s/-(.*)$//;
 
 	my $build_version = "";
 	my $buildaction = "";

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/655a4d87/attachment.html


More information about the darwinbuild-changes mailing list