nebula-plugins / gradle-ospackage-plugin

Gradle plugin for constructing linux packages, specifically RPM and DEBs.
Apache License 2.0
371 stars 126 forks source link

Ambiguous error if there's a long description. #268

Open DeegC opened 6 years ago

DeegC commented 6 years ago

It appears that a long (multiline?) description triggers an exception. No big deal except that the error message doesn't give any indication on what the error is. If I remove the description from build.gradle it works great. This might be a problem in JDeb and there's nothing you can do.

$ gradle generateDeb
:utc-debian:generateDeb FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':utc-debian:generateDeb'.
> Can't build debian package /home/dgc/project/UTC/debian/build/distributions/utc_1.0-1_all.deb

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.87 secs

Details:

Ubuntu 17.10 Gradle: 3.5.1 Java 8

build.gradle file in its entirety (note: it's a subproject):

plugins {
  id "nebula.ospackage" version "4.5.1"
}

description ="""
Gradle build for UTC

Project name: ${project.name}
"""

// See https://github.com/nebula-plugins/gradle-ospackage-plugin/wiki/Deb-Plugin
task generateDeb(type: Deb) {
    packageName = 'utc'
    release = '1'
    user = 'utc'

    preInstall file('debianPreInstall.sh')

    into '/opt/utc'
    from '../bin'
    from '../sqlite/utc.sqlite.empty.db'

    from( 'utc-server' ) {
        into '/etc/init.d'
    }
}

Bottom part of the stack trace:

Caused by: org.vafer.jdeb.PackagingException: Failed to create debian package /home/dgc/project/UTC/debian/build/distributions/utc_1.0-1_all.deb
        at org.vafer.jdeb.DebMaker.makeDeb(DebMaker.java:296)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1218)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
        at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at com.netflix.gradle.plugins.deb.DebCopyAction.end(DebCopyAction.groovy:268)
        ... 150 more
Caused by: org.vafer.jdeb.PackagingException: Could not create deb package
        at org.vafer.jdeb.DebMaker.createSignedDeb(DebMaker.java:520)
        at org.vafer.jdeb.DebMaker.createDeb(DebMaker.java:411)
        at org.vafer.jdeb.DebMaker.makeDeb(DebMaker.java:292)
        ... 161 more
Caused by: java.text.ParseException: Line misses ':' delimiter
        at org.vafer.jdeb.debian.ControlFile.parse(ControlFile.java:84)
        at org.vafer.jdeb.debian.ControlFile.parse(ControlFile.java:43)
        at org.vafer.jdeb.debian.BinaryPackageControlFile.<init>(BinaryPackageControlFile.java:60)
        at org.vafer.jdeb.ControlBuilder.createPackageControlFile(ControlBuilder.java:177)
        at org.vafer.jdeb.DebMaker.createSignedDeb(DebMaker.java:440)
        ... 163 more
katsadim commented 6 years ago

This happens because the description content of a control file should be indented with spaces if it is multilined.

As a side note, no empty lines are allowed in description therefore this will do it for you:

description = """\
Gradle build for UTC
 Project name: ${project.name}"""
katsadim commented 6 years ago

I created PR #269 which addresses your issue. This will not support empty lines though, as the message generated from jDeb is quite meaningful.