perfsonar-dev - perfsonar: r3791 - branches/rpm
Subject: perfsonar development work
List archive
- From:
- To:
- Subject: perfsonar: r3791 - branches/rpm
- Date: Thu, 24 Apr 2008 19:22:33 -0400
Author: fernandes
Date: 2008-04-24 19:22:31 -0400 (Thu, 24 Apr 2008)
New Revision: 3791
Modified:
branches/rpm/package_maker.pl
Log:
New version of the package maker script:
- Debian packages are now created in the new directory structure.
- Developers can now specify the release version of the package.
- Some permissions were changed.
Modified: branches/rpm/package_maker.pl
===================================================================
--- branches/rpm/package_maker.pl 2008-04-24 11:08:49 UTC (rev 3790)
+++ branches/rpm/package_maker.pl 2008-04-24 23:22:31 UTC (rev 3791)
@@ -17,6 +17,7 @@
my $serviceSummary;
my $serviceName;
my $serviceVersion;
+my $serviceRelease = 1;
my $serviceMaintainer;
my $serviceDependencies;
my $serviceArch = 'noarch';
@@ -46,9 +47,18 @@
createDebBuildTree();
createControlFile();
createScripts();
+ getFilesListing();
- system("cp -R webapps debian/home/perfsonar/");
-
+ system("find debian/opt -type f -exec md5sum \{\} \; >>
debian/DEBIAN/md5sums");
+ system("cp -R webapps/$serviceDirectory
debian/opt/perfsonar/services/".lc($serviceName));
+ system("chmod 775
debian/opt/perfsonar/services/".lc($serviceName)."/WEB-INF/logs");
+ for my $directory (@directoryListing){
+ chomp $directory;
+ system("chmod 775
debian/opt/perfsonar/services/".lc($serviceName)."/$directory");
+ system("chmod 660
debian/opt/perfsonar/services/".lc($serviceName)."/$directory/* &>
/dev/null");
+ }
+ system("ln -fs ../../services/".lc($serviceName)."
debian/opt/perfsonar/tomcat/webapps/".lc($serviceName));
+
buildDeb();
}
@@ -58,7 +68,8 @@
}
system("mkdir -p debian/DEBIAN");
- system("mkdir -p debian/home/perfsonar");
+ system("mkdir -p debian/opt/perfsonar/services");
+ system("mkdir -p debian/opt/perfsonar/tomcat/webapps");
system("find ./debian -type d | xargs chmod 755");
}
@@ -66,7 +77,7 @@
open(CONTROLFILE, "> debian/DEBIAN/control");
select CONTROLFILE;
print "Package: ".lc($serviceName)."\n";
- print "Version: $serviceVersion-1\n";
+ print "Version: $serviceVersion-$serviceRelease\n";
print "Section: net\n";
print "Priority: optional\n";
print "Architecture: all\n";
@@ -75,7 +86,7 @@
print "Description: $serviceSummary\n";
for my $messageLine (@serviceDescription){
$messageLine =~ s/"/\\"/g;
- print "$messageLine\n";
+ print " $messageLine\n";
}
close(CONTROLFILE);
select STDOUT;
@@ -87,9 +98,13 @@
print "#!/bin/sh\n";
print "set -e\n";
print "if [ \"\$1\" = \"configure\" ]; then\n";
- print " ln -fns /home/perfsonar/webapps/$serviceName-$serviceVersion
/home/perfsonar/webapps/$serviceName\n";
- printPostScript();
- print " chown -R perfsonar:perfsonar /home/perfsonar/webapps
/home/perfsonar/perfsonar-tomcat/conf\n";
+ print " chown -R root:perfsonar
/opt/perfsonar/services/".lc($serviceName)."\n";
+ print "\n";
+ print " echo \"\"\n";
+ for my $messageLine (@serviceMessage){
+ $messageLine =~ s/"/\\"/g;
+ print " echo \"$messageLine\"\n";
+ }
print "fi\n";
close POSTINST;
@@ -97,8 +112,11 @@
select POSTRM;
print "#!/bin/sh\n";
print "set -e\n";
- print "if [ \"\$1\" = \"purge\" ]; then\n";
- printPostRmScript();
+ print "if [ \"\$1\" = \"remove\" ]; then\n";
+ print " if [ -h /opt/perfsonar/services/".lc($serviceName)." ]; then\n";
+ print " rm -f /opt/perfsonar/services/".lc($serviceName)."\n";
+ print " fi\n";
+ print "fi\n";
close POSTRM;
select STDOUT;
@@ -108,7 +126,7 @@
system("chmod 755 debian/DEBIAN/postinst");
system("chmod 755 debian/DEBIAN/postrm");
system("fakeroot dpkg-deb --build ./debian");
- system("mv debian.deb ".lc($serviceName)."-$serviceVersion-1.deb");
+ system("mv debian.deb
".lc($serviceName)."_$serviceVersion-".$serviceRelease."_$serviceArch.deb");
}
sub getLastServiceInfo(){
@@ -138,6 +156,8 @@
$serviceMaintainer = $1;
}elsif(/^serviceVersion=(.*)$/){
$serviceVersion = $1;
+ }elsif(/^serviceRelease=(.*)$/){
+ $serviceRelease = $1;
}elsif(/^serviceDependencies=(.*)$/){
$serviceDependencies = $1;
}elsif(/^serviceDescription=(.*)$/){
@@ -157,6 +177,7 @@
print "serviceSummary=$serviceSummary\n";
print "serviceName=$serviceName\n";
print "serviceVersion=$serviceVersion\n";
+ print "serviceRelease=$serviceRelease\n";
print "serviceMaintainer=$serviceMaintainer\n";
print "serviceDependencies=$serviceDependencies\n";
print "serviceArch: $serviceArch\n";
@@ -190,6 +211,13 @@
$serviceVersion = $answer;
}
+ print "Enter release version of this package [$serviceRelease]: ";
+ $answer = <STDIN>;
+ chomp($answer);
+ if($answer){
+ $serviceRelease = $answer;
+ }
+
print "Enter service dependencies [$serviceDependencies]: ";
$answer = <STDIN>;
chomp($answer);
@@ -285,72 +313,10 @@
print "Are you sure you have the right setup? Check build-guide for
more information.\n";
exit;
}
- @directoryListing = `find WEB-INF/classes/perfsonar -type d`;
+ @directoryListing = `find WEB-INF/classes/perfsonar/* -type d`;
chdir("../..");
}
-sub printPostScript(){
- print " if [ -z \"`grep -m 1 -n \"<Context path='/$serviceName'\"
/home/perfsonar/perfsonar-tomcat/conf/server.xml`\" ]; then\n";
- print " HOSTLINE=`grep -m 1 -n \"</Host>\"
/home/perfsonar/perfsonar-tomcat/conf/server.xml`\n";
- print " COLON=`expr index \"\$HOSTLINE\" :`\n";
- print " LINE=\${HOSTLINE:0:\$COLON-1}\n";
- print " HOSTTAG=\"\${HOSTLINE:\$COLON+1}\"\n";
- print "\n";
- print " exec 6>&1\n";
- print " exec >
/home/perfsonar/perfsonar-tomcat/perfSONAR-patch.tmp\n";
- print "\n";
- print " echo \"--- conf/server.xml\"\n";
- print " echo \"+++ conf/server.xml\"\n";
- print " echo \"@@ -\$LINE,1 +\${LINE-1},4 @@\"\n";
- print " echo \"+ <Context path='/$serviceName'\"\n";
- print " echo \"+
docBase='/home/perfsonar/webapps/$serviceName'>\"\n";
- print " echo \"+ </Context>\"\n";
- print " echo \" \$HOSTTAG\"\n";
- print "\n";
- print " exec 1>&6 6>&-\n";
- print "\n";
- print " cd /home/perfsonar/perfsonar-tomcat/\n";
- print " patch -p0 < perfSONAR-patch.tmp &> /dev/null\n";
- print " rm perfSONAR-patch.tmp\n";
- print " fi\n";
- print "\n";
- print "echo \"\"\n";
- for my $messageLine (@serviceMessage){
- $messageLine =~ s/"/\\"/g;
- print "echo \"$messageLine\"\n";
- }
-}
-
-sub printPostRmScript(){
-
- print " if [ \"`grep -m 1 -n \"<Context path='/$serviceName'\"
/home/perfsonar/perfsonar-tomcat/conf/server.xml`\" ]; then\n";
- print " HOSTLINE=`grep -m 1 -n \"<Context path='/$serviceName'\"
/home/perfsonar/perfsonar-tomcat/conf/server.xml`\n";
- print " COLON=`expr index \"\$HOSTLINE\" :`\n";
- print " LINE=\${HOSTLINE:0:\$COLON-1}\n";
- print "\n";
- print " exec 6>&1\n";
- print " exec >
/home/perfsonar/perfsonar-tomcat/perfSONAR-patch.tmp\n";
- print "\n";
- print " echo \"--- conf/server.xml\"\n";
- print " echo \"+++ conf/server.xml\"\n";
- print " echo \"@@ -\$LINE,3 +\$LINE,0 @@\"\n";
- print " echo \"- <Context path='/$serviceName'\"\n";
- print " echo \"-
docBase='/home/perfsonar/webapps/$serviceName'>\"\n";
- print " echo \"- </Context>\"\n";
- print "\n";
- print " exec 1>&6 6>&-\n";
- print "\n";
- print " cd /home/perfsonar/perfsonar-tomcat/\n";
- print " patch -fp0 < perfSONAR-patch.tmp &> /dev/null\n";
- print " rm perfSONAR-patch.tmp\n";
- print " fi\n";
- print "\n";
- print " if [ -h /home/perfsonar/webapps/$serviceName ]; then\n";
- print " rm -f /home/perfsonar/webapps/$serviceName\n";
- print " fi\n";
- print "fi\n";
-}
-
sub createSpecFile(){
open( SPECFILE, "> SPECS/$serviceName-$serviceVersion.spec" );
select SPECFILE;
@@ -360,7 +326,7 @@
print "Name: ".lc($serviceName)."\n";
print "Version: $serviceVersion\n";
print "License: GPL\n";
- print "Release: 1\n";
+ print "Release: $serviceRelease\n";
print "Summary: $serviceSummary\n";
print "Source0: \%{name}-\%{version}.tar.gz\n";
print "BuildRoot: \%{_tmppath}/\%{name}-\%{version}-\%{release}\n";
@@ -412,11 +378,12 @@
print "\%defattr(0644,root,perfsonar,0755)\n";
print "\%config(noreplace)
\%{prefix}/WEB-INF/classes/perfsonar/conf/*.properties\n";
print "\%{prefix}\n";
- print "\%attr(640,perfsonar,perfsonar)
\%{prefix}/WEB-INF/classes/perfsonar\n";
- print "\%attr(755,perfsonar,perfsonar) \%dir
\%{prefix}/WEB-INF/logs\n";
+ print "\%attr(660,root,perfsonar)
\%{prefix}/WEB-INF/classes/perfsonar\n";
+ print "\%attr(775,root,perfsonar) \%dir \%{prefix}/WEB-INF/logs\n";
+ print "\%attr(755,root,perfsonar) \%dir
\%{prefix}/WEB-INF/classes/perfsonar\n";
for my $directory (@directoryListing){
chomp $directory;
- print "\%attr(755,perfsonar,perfsonar) \%dir
\%{prefix}/$directory\n";
+ print "\%attr(775,root,perfsonar) \%dir \%{prefix}/$directory\n";
}
print "\n";
- perfsonar: r3791 - branches/rpm, svnlog, 04/24/2008
Archive powered by MHonArc 2.6.16.