File: makeTars.pl

package info (click to toggle)
treeview 1.1.6.4+dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,304 kB
  • sloc: java: 33,287; xml: 1,728; perl: 132; sh: 16; makefile: 11
file content (112 lines) | stat: -rwxr-xr-x 2,929 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/perl
use strict;

my $version = $ARGV[0];
unless ($version) {
	print "Usage:
	$0 <version_string>

	Remember to increment version number and 
	tag package first.
";
	exit(1);
}

my $buildVersion = getBuildXmlVersion();
my $javaVersion = getTreeViewAppVersion();

unless (($buildVersion eq $javaVersion) and ($buildVersion eq $version)) {
    print STDERR "Error: Version Mismatch\n";
    print STDERR "Specified Version $version\n";
    print STDERR "build.xml Version $buildVersion\n";
    print STDERR "Java Treeview Version $javaVersion\n";
    exit(1);
}

my $bin = "TreeView-" .$version . "-bin";
my $win = "TreeView-" .$version . "-win";
my $osx = "TreeView-" .$version . "-osx";
my $src = "TreeView-" .$version . "-src";
my $applet ="TreeView-" .$version . "-applet";
my $doc =  "TreeView-".$version . "-javadoc";
my $winInst = 'windows-installer.tar.gz';

unless (-d $src) { #src version
	execute("git clone file://.. jtreeview");
	execute("mv jtreeview/LinkedView $src");
	execute("rm -rf jtreeview");
	execute("tar cvf $src.tar $src");
	execute("gzip $src.tar");
}

unless (-d $doc) { # javadoc
    execute("javadoc -private -classpath lib/nanoxml-2.2.2.jar -d javadoc `find src | grep java`");
    execute("mv javadoc $doc");
    execute("zip -r $doc.zip $doc");
}

unless (-d $bin) { # .tar.gz version...
	execute("ant dist");
	execute("mv dist $bin");
	# tar.gz
	execute("tar cvf $bin.tar $bin");
	execute("gzip $bin.tar");
}
unless (-d $win) { # .zip version...
	execute("ant dist");
	execute("mv dist $win");
	execute("tar xvzf $winInst");
	if (-f 'setup.exe') { # did it untar to this directory?
	    execute("mv setup.exe windows $win");
	} elsif (-f 'windows/setup.exe') { # or a windows subdirectory?
	    execute("mv windows/setup.exe windows/windows $win");
	} else {
	    die ' could not find file "setup.exe" in windows installer.'; 
	}
	execute("zip -r $win.zip $win");
}

unless (-d $osx) { # osx version
	execute("ant bundle");
	execute("mv bundle $osx");
	#command line disk image?
	execute("zip -r $osx.zip $osx");
}


unless (-d $applet) { #applet version
    execute("ant applet");
	execute("mv applet $applet");
	execute("tar cvf $applet.tar $applet");
	execute("gzip $applet.tar");
}    

sub getBuildXmlVersion { #probably should parse XML, but I'm lazy.
    open (XML, "build.xml") || die "could not open build.xml : $!";
    while (<XML>) {
        if (/version=\"(\d+\.\d+\.\d+.*)\"/) {
            close(XML);
            return $1;
        }
    }
    close(XML);
    return "Could not determine version";
}
sub getTreeViewAppVersion {
    open (TV, "src/edu/stanford/genetics/treeview/TreeViewApp.java");
    while (<TV>) {
        if (/versionTag\s+=\s+\"(\d+\.\d+\.\d+.*)\"/) {
            close (TV);
            return $1;
        }
    }
    close(TV);
    return "Could not determine version";
}


sub execute {
	my $cmd = shift();
	print STDERR "$cmd\n";
	system($cmd);
}