/srv/irclogs.ubuntu.com/2010/02/21/#ubuntu-java.txt

Rirto6hi10:43
Rirto6Looking for a good tutorial on packaging Java applications into single .deb installers. Any recommendations?10:43
persiaI don't think there's a one-size-fits-all guide.10:46
persiaIn the simple case, it's so trivial as to be pointless, and in the complex case, it's sufficiently complicated to be confusing.10:47
Rirto6How about a basic one for me to learn off?10:47
Rirto6Just a neat trivial one to get me started?10:47
persia(plus there are *many* variants of the complicated case, depending on the source of complication).10:47
persiaWell, let's first see if you have the simple case :)10:48
Rirto6Okay, nothing needs to be compiled, there is both a source folder & a binary folder10:48
persiaFirstly, do you have the source code, and is it under a redistributable license?10:48
Rirto6Yes10:48
Rirto6GPL & LGPL10:48
persiaOK.  Next: does it just automatically work with /usr/share/doc/debhelper/examples/rules.tiny?10:49
* Rirto6 checks10:49
* Rirto6 tests10:50
Rirto6persia: Hmm... everything seems to work10:56
Rirto6With just the one hitch, nothing was installed10:57
Rirto6(nothing was copied to the /usr/bin)10:57
persiaOK.  You probably need to add a debian/install file.10:58
persiaJust to confirm, the source was recompiled, yes?10:59
Rirto6I think so10:59
Rirto6persia: Do you have any nice examples for the install file?10:59
persiaGreat.  You have the trivial case, and so don't need a guide :)10:59
Rirto6:)11:00
Rirto6I'm confused with the meaning of that word11:00
Rirto6You have the 'New' case, so don't need a guide11:00
persiaAdding a single line like "myappwrapper usr/bin" would copy your wrapper (where you set classpath and stuff).11:00
Rirto6Oh11:00
Rirto6Sorry, got the word novel & trivial mixed up11:00
persiaYou'll want another line sticking your jar into /usr/share/java11:01
Rirto6persia: Sorry, you lost me there11:01
* Rirto6 goes to brush his teeth11:02
persiaYou probably want two lines in debian/install : one for a wrapper to stick in usr/bin, and another for your .jar file to go in usr/share/java/11:02
persiaBecause policy forbids having the .jar directly in usr/bin11:03
Rirto6persia: It's not a single jar file.11:03
persiaNo?  What is it?11:03
Rirto6http://www.processing.org11:04
Rirto6I'm on #ubuntu-java because it a) compiles to pure java b) In some docos is described as a class library of java11:06
Rirto6& c) required the jdk11:06
persiaI'm having wildly variable download speeds, but should be back with you in a bit (somewhere between 2 and 20 minutes, according to the counter)11:08
Rirto6kk11:10
* Rirto6 didn't even have Internet for two weeks before today11:11
Rirto6(about 6 hours ago)11:11
Rirto6persia: Remember to get the SVN as well11:12
Rirto6BTW: I don't want you to do the work for me, I just want to be guided in the right direction11:13
persiaNo need: I just want to get a look at what this is.11:13
* Rirto6 is aware that he is close to accomplishing11:13
Rirto6persia: Certainly11:13
persiaI have a suspicion that you might want to split it into a few bits, but need to verify before I can know I'm pointing you in the right direction.11:13
persiaI suspect you can get the rest of what you want with debian/install11:14
Rirto62 bits would be nice11:14
persiaIt just installs a file or directory on each line.11:14
Rirto61 bit with everything from the svn (source) & the other bit with the program (binary)11:14
persiaBut that might not end up with the best quality package.11:14
Rirto6Oh11:14
persiaSo, you don't want that.11:15
Rirto6Well in that case, include them both I suppose, in the one binary?11:15
persiaYou want to start with the source, and then package it, and then build the package, and that generates the binary.11:15
Rirto6Hmm11:15
persiaNo, the binary shouldn't have the source: that just wastes space.11:15
Rirto6Not sure it works that way with Processing11:15
persiaHrm.  By download agent claims it's been at 100% for the lat 40MB.11:15
persias/By/My/11:16
Rirto6arghh11:16
Rirto6try aria211:16
persiaHow big is the download?11:17
* persia is at 140MB so far11:18
Rirto6Good question actually11:18
Rirto6186.9MB11:18
Rirto6I think11:18
persiaOh, then I'm getting closer :)11:18
Rirto6:)11:20
Rirto6What are you on now?11:22
Rirto6(I feel like saying "Are we there yet?")11:23
persia18011:24
Rirto6kk11:24
persiaIt's not actually compressed, although named "tgz" :)11:27
persiaCompression would save some bandwidth.11:27
Rirto6Yeah11:28
Rirto6Packages are compressed, so I though I'd just do that11:28
Rirto6Makes it easier for them11:28
persiaOK, so this is a bit more complicated.11:28
Rirto6Actually with the tgz I had to mount it rather than untar it11:28
Rirto6persia: Well there are multiple files, and the jdk is a dependency11:28
persiaI just renamed it to .tar, and untarred it :)11:28
Rirto6:)11:28
persiaSo, everything in lib/ should probably be deleted and the tarball repackaged.11:29
persiaAnd check to make sure that those libraries are available on the system (most of them seem to be at first glance)11:29
persiaYou probably want a -doc package containing reference/ and examples/11:29
Rirto6Hmm11:30
Rirto6Wait, it has it's own libraries11:30
Rirto6I know that for sure11:30
persiaAre the contents of libraries/ local libraries or foreign libraries?11:30
Rirto6(most of them are default though)11:30
Rirto6Not entirely sure, at the moment I want to get a .deb out there, then I'll work on it more tomorrow night11:31
persiaThe stuff in lib/ is stuff like antlr and ecj.  I'm certain those aren't unique to processing :)11:31
Rirto6But for now I want to get it all working & out there11:31
persiaI'm not sure you can do that in a GPL compliant way.11:31
persiaBecause of the "preferred form for modification" clause.11:31
persiaThat prohibits distributing jars if you don't know you have the source that produces them11:31
Rirto6Ouch11:31
persiaAnd it's unfortunately common in the Java community to grab some binary jar from some site and embed it.11:32
persiaWhich is technically a contract violation.  Not so many prosecute, but it always pays to be careful.11:32
Rirto6Well how long would it take to do your method11:32
Rirto6?11:32
persiaWell, splitting the package is trivial.11:32
Rirto6(for an untrained person such as I)11:32
persiaJust add a second Package: stanza to debian/control and create two debian/install files: debian/processing.install and debian/processing-doc.install11:33
persiaList the files you want in the processing package in the first, and the ones you want in processing-doc in the second.11:33
persiaMake sure that the processing package depends on the system libraries that match the ones in lib/11:33
persia(which makes dropping lib/ trivial)11:33
persialibraries/ is more interesting, because it's unclear at first glance whether those are part of processing or separate.11:34
persiaIt might take a while to dig through that, but you might be able to postpone some of that.11:34
persiaI'm not sure whether you want to have a separate processing-tools package, or just stick mangler into processing.  That's more a judgement call.11:35
persiaEither way shouldn't be that much extra effort.11:35
Rirto6Nah, I'd like to keep everything together11:35
Rirto6Eventually I might make separate packages11:35
persia(well, except the docs :) )11:35
Rirto6eg; docs, tools, examples11:35
persiaWell, OK.  Works to start.  Splitting is good, but can be delayed.11:36
persiaSo, shortlist for the easy way11:36
persia1) repack the tarball to drop the stuff in lib/11:36
Rirto6Let's start from scratch, which do I want, what's in the SVN or in the tgz?11:36
persia2) make sure that the stuff in java/ and libraries/ is getting put in a jar.11:37
persiaDoesn't really matter.  I'd probably use the .tgz, just because it's a known release, and therefore less likely to have a half-completed bit.11:37
persiaYeah, compressing the tarball, I end up with only 66MB, rather than 180.11:37
persiaI'm sure that's worth an upstream bug.11:38
Rirto6Sure11:38
Rirto6I'll put that in11:38
persiaSo back to my shortlist11:38
persia3) create some wrapper shell scripts that set the classpath and call the created jar files with the right arguments.11:39
persia4) use debian/install to stick everything in the right place (can install files or directories)11:40
persiaDone!11:40
persiaI'm not convinced that package would comply with the licenses (you'd have to do source inspection and license review, which can take a lot of time)11:40
persiaI'm also not convinced that's the best way to package it11:40
persiaBut it ought to work.11:40
persiaBased on the description on the upstream website, I'd probably want to split up the various processing libraries, so that people who wrote stuff using processing would only need to have their users install the libraries needed for their application, rather than everything.11:40
persiaAnd then have processing as a general app, processing-tools for mangler and anything else that gets added later, and processing-doc containing the reference and examples.11:41
persiaBut that's a lot of binary packages, and requires more thought to organise right (so not something for the impatient)11:41
Rirto6Hmm11:44
Rirto6Thanks for the guide11:44
Rirto6Would you mind helping me write 3) & 4)?11:45
Rirto6(you'll get mention for helping with binarise the software, of course)11:45
persiaFor 3) install any java app, and take a look at the /usr/bin entry.  They're all about the same.11:46
persiaFor 4), it's just a list of things to install.  Each line has a source and destination.11:46
Rirto6How do I generate 4)11:46
persiaThe source is relative to the package directory, and the destination is relative to the filesystem.11:47
persiaWith a text editor :)11:47
Rirto6So, find & sed?11:47
persiaIt's really just lines like "foo.jar usr/share/java"11:47
Rirto6I've already created 3 or 4 different Installer Scripts for Windows11:47
Rirto6Including XML type ones11:48
persiait's lots less complicated then that :)11:48
Rirto6Sounds more complicated actually11:48
Rirto6persia: There were so many files11:48
* Rirto6 just deleted all processing files/folder/archives11:49
* Rirto6 is about to start from scratch11:49
* Rirto6 is downloading Processing11:50
Rirto6persia: Wait, it downloaded 66MB, then decompressed11:51
Rirto6persia: We are talking about over 2½ thousand files11:52
Rirto6persia: Just confirming, I'm excluding /processing-1.0.9/lib from the first tarball?12:00
* Rirto6 JARred /processing-1.0.9/java & /processing-1.0.9/libraries, excluded the directories & packaged everything but those [now JARred] directories & /processing-1.0.9/lib.12:04
Rirto6persia: Please tell me if I'm doing/have done anything wrong12:04
Rirto6(the archive is a tar.gz)12:05
persiaI'd have created the jars during compilation, but that works, kinda.12:10
Rirto6persia: I think this project is too complicated for my first Debian (.deb) package12:12
persiaPretty much anything that doesn't fall into the trivial case "works with rules.tiny with minimal fuss" is not a good place to start.12:13
Rirto6Can you help me with just getting the .deb file to successfully install the program, and we can worry tomorrow night about making it adhere to the debian policy12:13
Rirto6?12:13
persiaYou don't have a working .deb file yet?12:14
persiaWhat part of the debian/install file isn't working for you?12:14
Rirto6Not sure12:15
Rirto6I'll try once more12:15
Rirto6brb12:15
Rirto6persia: I must be doing something extremely wrong12:21
Rirto6I have a 7.7kb .deb file12:21
persiapastebin your debian/install file?12:21
Rirto6Sorry, back now12:26
Rirto6persia: No need for pastebin, just have the one line;12:26
Rirto6processing usr/bin12:26
persiaOh, so you need some more lines to install the rest of the package :)12:28
persiaJust add one line for each file or directory you want to install.12:28
Rirto6persia: No, I mean, I can't find the program 'processing' anywhere12:31
Rirto6I thought I'd test it out on at least one12:31
persiaDid you install the generated .deb file?12:34
persiaIt should contain /usr/bin/processing12:34
Rirto6persia: http://pastebin.com/d34f1c2bb12:43
Rirto6Finally got it to work, however get that^12:43
persiapastebin your debian/install ?12:44
Rirto6processing usr/bin/processing12:44
persiaDrop the last entry fthere.12:44
persiaYou want just "processing usr/bin"12:44
persiaWith that line, you're suggesting it should make a /usr/bin/processing in which to put the proessing file.12:44
Rirto6Hmm12:46
Rirto6That's weird12:46
Rirto6Because without that it didn't work at all12:46
Rirto6All well, now, to sed!12:46
Rirto6(& beyond)12:47
Rirto6[to generate the file]12:47
Rirto6Already have one which has a similiar function to generate the XML files for Windows12:47
Rirto6Which I was using with sed, awk & find within Cygwin12:48
persiaYou really don't want to do it that way.12:49
persiaIt may be helpful for you to get a package in the next couple hours, but it will ultimately be a complete waste of time.12:49
Rirto6eh12:55
* Rirto6 was bringing in his monitor from downstairs, hasn't started work on the install file yet12:55
persiaSo, what you want to do, if you want to do it right, is to set up ant to build all the source into a small (known) number of jars12:56
persiaAnd then just list those jars in debian/install.12:56
persiaBut that's more work.12:56
persia(although also significantly more likely to be correct and cause fewer bugs later)12:57
Rirto6Great12:58
Rirto6I'll do a bad package tonight12:58
Rirto6& a good package tomorrow night12:58
persiaRight :)12:58
Rirto6=]12:58
* Rirto6 is close13:08
Rirto6find $PWD -follow -type f | sed -e 's|/[^/]*\(/.*\)/.*| & \1|13:08
Rirto6Has all the info we want13:08
Rirto6just wrong order :P13:08
Rirto6Wait13:09
Rirto6Right order!13:09
Rirto6Tis perfect (just need to get rid of the starting space)13:09
persiaThat gets every file.13:12
persiaI did mention that you could add a line for a directory, right?13:12
persiaSo "tools /usr/share/processing" would copy the entire tools folder?13:12
Rirto6Isn't specifying files better?13:12
persiaAnd that result would be a bit more readable, no?13:12
persiaNo.13:12
Rirto6Okay13:13
persiaMaking the packaging easy to understand is best.13:13
Rirto6Well simple edit for that13:13
persiaYeah.  If you can't do debian/install in a text editor, you're doing it wrong :)13:13
Rirto6find $PWD -follow -type d | sed -e 's|/[^/]*\(/.*\)/.*|& \1|'13:13
persiaNo, you don't need -follow13:14
Rirto6How's that command, lists directories only13:14
persiaAnd you don't need find.13:14
persiaThere's just 5-6 directories you care about.13:14
persiatools/ libraries/ java/ reference/ examples/13:14
persiaJust add a line for each one, and you're done, if you don't care about policy.13:14
Rirto6rly, that all?13:14
Rirto6Just the root ones?13:14
persiaYes.  Like I said, it's really simple.13:14
Rirto6But... the script!13:14
persiaThat will copy the entire tree.13:15
Rirto6aww13:15
persiaI *know* you don't want to install all that stuff, but it gets you a package quickly.13:15
persiaA bloated, potentially unredistributable package, that doesn't comply with policy, but a package.13:15
Rirto6Well all I need for tomorrow is a working package13:16
Rirto6Tomorrow night I'll work on making it compliant13:17
Rirto6Then hopefully the next day I'll get it into a repository13:17
* Rirto6 just closed 30 windows that were distracting13:18
* Rirto6 has finished scripting the installer13:23
* Rirto6 can now create the installer in under 40 seconds13:23
Rirto6:P13:23
Rirto6(delete everything but a tar.gz file,  & everything from the original tgz file)13:24
persiaWell, debian/copyright will be a challenge.  I'd set aside a couple days for that, given the source.13:24
Rirto6So what, a week?13:25
persiaFor a large java environment like that, two seems more reasonable.13:25
persiaOne week is enough to get it packaged right and do the license review.13:25
persiaBut it usually takes at least another week to port it to system libraries and work with upstream for awkward bits that need adjustment.13:26
persiaOf course, that assumes the source is in decent shape.  Eclipse made everyone run screaming for a couple years, and is just now getting sorted.13:26
Rirto6Well I'll get the one week down first13:27
Rirto6Then release it with everything I used to create it13:28
Rirto6Which will hopefully get a bigger userbase to help me with the 2nd week13:28
Rirto6persia: Will you be on tomorrow night for more advice?13:31
persiaI'm often around, but can't promise to have lots of time.13:32
persiaBut just ask questions generally: there's other people around who can help (most of whom have packaged more things from scratch than I)13:33
Rirto6Well thanks, you have been of great help13:37
Rirto6Let's quickly summarise what needs to be done13:37
Rirto6Copyright file needs to be reviewed. System libraries need to be ported, and worked on with upstream to fix the awkward bits that need adjustment. Setup ant to build all the source into a small, known, number of jars. Then all I need to do is list those jars in the install file.13:39
Rirto6Is that about it?13:39
* Rirto6 has to go now13:45
Rirto6Thanks again13:45
persiaThat was about it, but I got latent.13:58

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!