File: make_release.pl

package info (click to toggle)
packagesearch 1.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,656 kB
  • ctags: 1,363
  • sloc: cpp: 7,575; perl: 326; makefile: 78; sh: 1
file content (126 lines) | stat: -rwxr-xr-x 3,489 bytes parent folder | download
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/perl -w
# creates the release, assuming build application

sub evaluateArguments();


evaluateArguments();
print "Please enter a version string: ";
my $version = <STDIN>;
chomp($version);

if ($debian)
{
	print "Did you remember to run dch -v $version and commit the changes? (y/n)?\n";
	my $decide = <STDIN>;
	if ( $decide =~ /n/ )
	{
		`dch -v $version`;
		`cvs up debian/changelog`;
		`cvs commit debian/changelog`;
	}
}

my $headmodule = "packagesearch";	# toplevel module
my $projectname = "packagesearch";	# the sourceforge name of the project
my $releasename = "packagesearch";	# the base name the release file 


# directory where the binary release is located
my $binReleaseDir="bin_release/$releasename-v$version\/";
print "$binReleaseDir\n";

mkdir("release");
if ($binary)
{
	mkdir("release/bin_release");
	mkdir("release/$binReleaseDir");
}
chomp($date =`date +\%Y-\%m-\%d`);	# get the current date
my $bin_filename = "$releasename-v$version-linux-i386-binary.tar.bz2";
my $src_filename = "$releasename-v$version-$date-src.tar.bz2";

print "Changing directory to release\n";
chdir("release");
if ($source)
{
	print "Getting the cvs version\n";
	(system("cvs -d:ext:bmesing\@cvs.sf.net:/cvsroot/$projectname export -r HEAD  $headmodule")==0)
		|| die("Could not get cvs version.\n");
	system("rm `find  ./ -name \".cvsignore\"`");
	# system("cvs -:pserver:anonymous\@cvs.planets3d.sourceforge.net:/cvsroot/planets3d co $headmodule");
	print "creating source tarball\n";
	(system("tar cjf $src_filename $headmodule\/\n")==0) || die("could not create archive.\n");
	print "source tarball $src_filename created\n";
}

if ($debian)
{
	`mv $headmodule $headmodule-$version`;
	print "creating debian package\n";
	chdir("$headmodule-$version");
	(system("dpkg-buildpackage -rfakeroot")==0) || die("could not create archive.\n");
	chdir("..");
	# `lintian -i ${headmodule}_${version}-*_i386.changes`;	# we don't know the revision here, so try a star
	print "Press any key to continue";
	my $dummy = <STDIN>;
	`mv $headmodule-$version $headmodule`;
}

#create the binary release
if ($binary)
{
	chdir($headmodule);
	print "please change to release if you want to\n";
	$test=`kwrite src/packagesearch.pro`;	# don't use the system() function to ensure the order of execution
	print "creating $releasename\n";
	chdir("src");
	(system("qmake packagesearch.pro && make")==0)  || die("build script failed");
	chdir("../../");
	print "copying files for release\n";
	# copy head executables
	$test=`cp $headmodule/src/$releasename $binReleaseDir`;
	#copy data dir
	mkdir("${binReleaseDir}doc");
	mkdir("${binReleaseDir}icons");
	`cp $headmodule/icons/packagesearch.png ${binReleaseDir}icons/`;
	`cp $headmodule/doc/{index.html,COPYING.txt} ${binReleaseDir}doc/`;
	`cp $headmodule/{README,AUTHORS,COPYING} ${binReleaseDir}/`;

	chdir("bin_release");
	print "creating binary release\n";
	(system("tar cjvf ../$bin_filename $releasename-v$version")==0) || die("could not create archive.") ;
	print "binary tarball $bin_filename created\n";
}


sub evaluateArguments()
{
	if (@ARGV==0)	# no argument
	{
		print "usage: make_release.pl [source] [binary] [debian]\n";
		exit;
	}
	$binary = 0;
	$source = 0;
	foreach(@ARGV)
	{
		if ($_ eq "debian")
		{
			$debian = 1;
		}
		elsif ($_ eq "source")
		{
			$source = 1;
		}
		elsif ($_ eq "binary")
		{
			$binary = 1;
		}
		else	# not one of the keywords
		{
			print "usage: make_release.pl [source] [binary] [debian]\n";
			exit;
		}
	}
}