summaryrefslogtreecommitdiff
path: root/import_tools/del_repo/repo-print-artifacts.pl
blob: fe3f438ddfd0089fc03a2eefff573fa968dad7b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl
# Bryan Bishop kanzure@gmail.com http://heybryan.org/
# 2009-06-10
# just a utility script to print out a list of artifact names from a .repo file
use XML::Simple;
use Data::Dumper;


#print "\$#ARGV is: $#ARGV\n";
$numArgs = $#ARGV+1;
if ($numArgs <= 0) {
	print "\n\nproper usage (you passed $numArgs arguments)\n\n";
	print "./repo-print-artifacts example.repo\n";
	exit;
}

#foreach $myArg (@ARGV) {
#	print $myArg . "\n";
#}

$xml = new XML::Simple(ForceArray => 1);
$data = $xml->XMLin($ARGV[0], forcearray => 1); # set ARGV0 to something like: "/home/bryan/lab/summer2009/something.repo"

foreach $system ((@{$data->{System}})) { # take the <System> element from the XML file (it's in a hashref variable)
	foreach $artifact ((@{$system->{Artifact}})) {
		$name = $artifact->{ArtifactName};
		print "$name\n";
	}
}