You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2013/03/12 15:06:01 UTC
svn commit: r1455536 - in /tomee/sandbox/tomee-deb: pom.xml
src/main/groovy/org/apache/tomee/deb/PackageBuilder.groovy
Author: tveronezi
Date: Tue Mar 12 14:06:01 2013
New Revision: 1455536
URL: http://svn.apache.org/r1455536
Log:
https://issues.apache.org/jira/browse/TOMEE-245
-Still need to address the issues below (lintian ./target/apache-tomee-plus-1.6.0-SNAPSHOT.deb)...
E: tomee: debian-changelog-file-missing
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/catalina.policy
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/catalina.properties
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/context.xml
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/logging.properties
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/server.xml
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/server.xml.original
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/system.properties
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/tomcat-users.xml
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/tomcat-users.xml.original
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/tomee.xml
E: tomee: file-in-etc-not-marked-as-conffile etc/tomee/web.xml
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/catalina.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/catalina.sh.original 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/configtest.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/daemon.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/digest.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/setclasspath.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/shutdown.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/startup.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/tomee.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/tool-wrapper.sh 1363
W: tomee: executable-is-not-world-readable usr/share/tomee/bin/version.sh 1363
W: tomee: codeless-jar usr/share/tomee/lib/tomcat-i18n-es.jar
W: tomee: codeless-jar usr/share/tomee/lib/tomcat-i18n-fr.jar
W: tomee: codeless-jar usr/share/tomee/lib/tomcat-i18n-ja.jar
W: tomee: codeless-jar usr/share/tomee/lib/tomee-webapp-1.6.0-SNAPSHOT.jar
Modified:
tomee/sandbox/tomee-deb/pom.xml
tomee/sandbox/tomee-deb/src/main/groovy/org/apache/tomee/deb/PackageBuilder.groovy
Modified: tomee/sandbox/tomee-deb/pom.xml
URL: http://svn.apache.org/viewvc/tomee/sandbox/tomee-deb/pom.xml?rev=1455536&r1=1455535&r2=1455536&view=diff
==============================================================================
--- tomee/sandbox/tomee-deb/pom.xml (original)
+++ tomee/sandbox/tomee-deb/pom.xml Tue Mar 12 14:06:01 2013
@@ -19,7 +19,7 @@
<groupId>org.apache.tomee</groupId>
<artifactId>tomee-deb</artifactId>
<version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
+ <packaging>pom</packaging>
<name>tomee-deb</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Modified: tomee/sandbox/tomee-deb/src/main/groovy/org/apache/tomee/deb/PackageBuilder.groovy
URL: http://svn.apache.org/viewvc/tomee/sandbox/tomee-deb/src/main/groovy/org/apache/tomee/deb/PackageBuilder.groovy?rev=1455536&r1=1455535&r2=1455536&view=diff
==============================================================================
--- tomee/sandbox/tomee-deb/src/main/groovy/org/apache/tomee/deb/PackageBuilder.groovy (original)
+++ tomee/sandbox/tomee-deb/src/main/groovy/org/apache/tomee/deb/PackageBuilder.groovy Tue Mar 12 14:06:01 2013
@@ -31,6 +31,7 @@ import java.util.zip.GZIPInputStream
class PackageBuilder {
String targetDir
String tomeeVersion
+ def roots = new HashSet<String>()
private File untar(String fileName) {
File parent = new File(this.targetDir, 'output')
@@ -66,9 +67,13 @@ class PackageBuilder {
file.delete()
} as Object
- private def tarRoot(TarArchiveOutputStream output, String... pathList) {
+ private def tarRoot(String name, TarArchiveOutputStream output, String root) {
+ if (roots.contains(name + ':' + root)) {
+ // no-op
+ return;
+ }
StringBuilder builder = new StringBuilder()
- pathList.each {
+ root.split('/').each {
builder.append(it)
builder.append('/')
@@ -76,27 +81,57 @@ class PackageBuilder {
TarArchiveEntry entry = new TarArchiveEntry(path)
entry.userName = 'root'
entry.groupName = 'root'
- entry.setModTime(System.currentTimeMillis())
+ entry.setModTime System.currentTimeMillis()
output.putArchiveEntry(entry)
output.closeArchiveEntry()
}
+ roots << name + ':' + root
}
private def tarItem = { TarArchiveOutputStream output, File item, Integer startIndex, def dataholder ->
+ if (item.isFile() && item.name == 'LICENSE') {
+ // no-op the package has the license already. http://lintian.debian.org/tags/no-copyright-file.html
+ return
+ }
String subPath = item.path.substring(startIndex).replaceAll("\\\\", "/");
if (item.isDirectory()) {
subPath = subPath + '/'
}
- String path = './usr/share/tomee' + subPath
+ String root
+ String path
+
+ if (subPath.startsWith('/webapps') || subPath.startsWith('/work')) {
+ root = './var/lib/tomee'
+ path = root + subPath
+
+ } else if (subPath.startsWith('/conf')) {
+ root = './etc/tomee'
+ path = root + subPath.substring('/conf'.length())
+
+ } else if (subPath.startsWith('/logs')) {
+ root = './var/log/tomee'
+ path = root + subPath.substring('/logs'.length())
+
+ } else if (subPath.startsWith('/temp')) {
+ // no-op
+ return
+
+ } else {
+ root = './usr/share/tomee'
+ path = root + subPath
+ }
+ tarRoot('data', output, root)
+
TarArchiveEntry entry = new TarArchiveEntry(path, true)
+
entry.userName = 'root'
entry.groupName = 'root'
entry.setModTime(System.currentTimeMillis())
if (item.isFile()) {
dataholder.checksum.append(getCheckSumLine(path, item))
if (path.endsWith('.sh') || path.endsWith('.sh.original')) {
- entry.mode = 754
+ entry.mode = 755
}
long size = item.length()
@@ -118,10 +153,27 @@ class PackageBuilder {
}
} as Object
- private String getCheckSumLine(String name, File file) throws IOException {
- FileInputStream fis = new FileInputStream(file)
- String md5 = DigestUtils.md5Hex(fis)
- fis.close()
+ private static String getCheckSum(String text) {
+ return getCheckSum(new ByteArrayInputStream(text.getBytes()))
+ }
+
+ private static String getCheckSum(File file) {
+ return getCheckSum(new FileInputStream(file))
+ }
+
+ private static String getCheckSum(InputStream input) {
+ String md5 = DigestUtils.md5Hex(input)
+ input.close()
+ return md5
+ }
+
+ private static String getCheckSumLine(String name, File file) {
+ String md5 = getCheckSum(file)
+ return "${md5} ${name}\n"
+ }
+
+ private static String getCheckSumLine(String name, String text) {
+ String md5 = getCheckSum(text)
return "${md5} ${name}\n"
}
@@ -136,10 +188,11 @@ class PackageBuilder {
checksum: new StringBuilder()
]
- tarRoot(output, '.', 'usr', 'share', 'tomee')
items.each {
tarItem(output, it, startIndex, dataholder)
}
+ addCopyrightEntry(output, dataholder)
+
output.close()
return [
tar: tar,
@@ -148,7 +201,7 @@ class PackageBuilder {
]
}
- private void addTextEntry(TarArchiveOutputStream output, String entryName, String text) {
+ private static void addTextEntry(TarArchiveOutputStream output, String entryName, String text) {
TarArchiveEntry entry = new TarArchiveEntry(entryName)
entry.userName = 'root'
entry.setSize(text.getBytes().length)
@@ -157,30 +210,37 @@ class PackageBuilder {
output.closeArchiveEntry()
}
+ private void addCopyrightEntry(TarArchiveOutputStream output, def dataholder) {
+ tarRoot('data', output, './usr/share/doc/tomee')
+ String text = """Files: *
+Copyright: 2013 The Apache Software Foundation
+License: Apache
+"""
+ dataholder.checksum.append(getCheckSumLine('./usr/share/doc/tomee/copyright', text))
+ addTextEntry(output, './usr/share/doc/tomee/copyright', text)
+ }
+
private void addControlEntry(TarArchiveOutputStream output, long installedSize) {
long inMB = installedSize / 1024
String text = """Package: tomee
Version: ${tomeeVersion}
-Section: admin
+Section: java
Priority: optional
-Architecture: i386
-Depends:
-Suggests:
-Conflicts:
-Replaces:
+Homepage: http://tomee.apache.org/
+Architecture: all
+Depends: openjdk-7-jre
Installed-Size: ${inMB}
Maintainer: devlist <de...@tomee.apache.org>
Description: Apache TomEE
- Apache TomEE, pronounced \"Tommy\", is an all-Apache
- Java EE 6 Web Profile certified stack where Tomcat is top
- dog. Apache TomEE is assembled from a vanilla Apache Tomcat
- zip file. We start with Tomcat, add our jars and zip up the
- rest. The result is Tomcat with added EE features - TomEE.
+ Apache TomEE, pronounced \"Tommy\", is an all-Apache Java EE 6 Web Profile
+ certified stack where Tomcat is top dog. Apache TomEE is assembled from a
+ vanilla Apache Tomcat zip file. We start with Tomcat, add our jars and zip
+ up the rest. The result is Tomcat with added EE features - TomEE.
"""
addTextEntry(output, 'control', text)
}
- private void addChecksum(TarArchiveOutputStream output, String checksum) {
+ private static void addChecksum(TarArchiveOutputStream output, String checksum) {
addTextEntry(output, 'md5sums', checksum)
}
@@ -212,7 +272,7 @@ Description: Apache TomEE
gz.delete()
}
- private File gzip(File file) {
+ private static File gzip(File file) {
File gz = new File(file.parent, file.name + '.gz')
InputStream input = new FileInputStream(file)
GzipCompressorOutputStream output = new GzipCompressorOutputStream(new FileOutputStream(gz))
@@ -223,14 +283,14 @@ Description: Apache TomEE
return gz
}
- private void arItem(ArArchiveOutputStream output, File file) {
+ private static void arItem(ArArchiveOutputStream output, File file) {
ArArchiveEntry entry = new ArArchiveEntry(file.name, file.length())
output.putArchiveEntry(entry)
output << new FileInputStream(file)
output.closeArchiveEntry()
}
- private void arDebianBinary(ArArchiveOutputStream output) {
+ private static void arDebianBinary(ArArchiveOutputStream output) {
byte[] text = "2.0\n".getBytes()
ArArchiveEntry entry = new ArArchiveEntry('debian-binary', text.length)
output.putArchiveEntry(entry)
@@ -239,7 +299,8 @@ Description: Apache TomEE
}
private File ar(String name, File data, File control) {
- File ar = new File(data.parent, "apache-tomee-${name}-${tomeeVersion}.deb")
+ String packageName = "apache-tomee-${name}-${tomeeVersion}.deb"
+ File ar = new File(data.parent, packageName)
ArArchiveOutputStream output = new ArArchiveOutputStream(new FileOutputStream(ar))
arDebianBinary(output)
@@ -247,8 +308,6 @@ Description: Apache TomEE
arItem(output, data)
output.close()
- //data.delete()
- //control.delete()
return ar
}
@@ -263,11 +322,11 @@ Description: Apache TomEE
def tarData = tar(exploded)
File data = gzip(tarData.tar)
File control = gzip(createControlTar(exploded, tarData))
- delete(exploded)
+ delete exploded
File debFile = ar(name, data, control)
File result = new File(this.targetDir, debFile.name)
debFile.renameTo(result)
- //delete(new File(this.targetDir, 'output'))
+ delete new File(this.targetDir, 'output')
return result
}