Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
improve a new ebuild full of nastiness
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
GenKreton
l33t
l33t


Joined: 20 Sep 2003
Posts: 828
Location: Cambridge, MA

PostPosted: Tue Nov 02, 2004 6:32 am    Post subject: improve a new ebuild full of nastiness Reply with quote

I just made an ebuild for delineate and before I submit it on bugs.gentoo.org to hopefully resolve a bug filled, I would like you guys to help fix some of the nasty hacks I had to implement to get this fully working.

Here it is:
Code:
ESCRIPTION="Delineate is a tool for converting raster images to SVG. It can convert PEG, PNG, GIF, BMP, TIFF, PNM, PBM, PGM, PPM, IFF, PCD, PSD, and RAS."
HOMEPAGE="http://delineate.sourceforge.net/"
SRC_URI="mirror://sourceforge/delineate/delineate-${PV}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""
DEPEND="virtual/x11
   >=virtual/jre-1.4
   >=media-gfx/autotrace-0.31.1
   >=media-gfx/potrace-1.5"
S="${WORKDIR}/"

src_unpack() {
   unpack ${A}
}

src_install() {
   dodir /opt
   mv ${S}/* ${D}/opt/delineate
}

pkg_postinst() {
   chmod 777 -R /opt/delineate/${PV}/settings /opt/delineate/${PV}/delineate.sh
   echo "#!/bin/sh" > /usr/bin/delineate
   echo "cd /opt/delineate/${PV}/" >> /usr/bin/delineate
   echo "exec ${JAVA_HOME}/bin/java -jar delineate.jar ./settings/parameters-autotrace.xml ./settings/parameters-potrace.xml" >> /usr/bin/delineate
}


The fact I had to echo a shell script of my own to fix the crappy one made by the developers bothers me most. Their script which I was just going to link to /usr/bin/ needs to be run in the directory, and I didn't know how else to do it.

This is my first ebuild from scratch (done bunch of version bumps and minor changes though) - so be gentle :)
Back to top
View user's profile Send private message
TrueDFX
Retired Dev
Retired Dev


Joined: 02 Jun 2004
Posts: 1348

PostPosted: Tue Nov 02, 2004 6:53 am    Post subject: Re: improve a new ebuild full of nastiness Reply with quote

Hi,
GenKreton wrote:
I just made an ebuild for delineate and before I submit it on bugs.gentoo.org to hopefully resolve a bug filled, I would like you guys to help fix some of the nasty hacks I had to implement to get this fully working.

Here it is:
Code:
ESCRIPTION="Delineate is a tool for converting raster images to SVG. It can convert PEG, PNG, GIF, BMP, TIFF, PNM, PBM, PGM, PPM, IFF, PCD, PSD, and RAS."
You missed a D, and personally I feel the description is a bit long (it doesn't need the second sentence), but that part's just my opinion. Also, unless you simply didn't include this in your post, you should start with the header from /usr/portage/skel.ebuild.
Quote:
Code:
HOMEPAGE="http://delineate.sourceforge.net/"
SRC_URI="mirror://sourceforge/delineate/delineate-${PV}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""
DEPEND="virtual/x11
   >=virtual/jre-1.4
   >=media-gfx/autotrace-0.31.1
   >=media-gfx/potrace-1.5"
S="${WORKDIR}/"

src_unpack() {
   unpack ${A}
}
This is what your ebuild does if you don't define src_unpack at all. You can safely drop it.
Quote:
Code:
src_install() {
   dodir /opt
   mv ${S}/* ${D}/opt/delineate
}

pkg_postinst() {
   chmod 777 -R /opt/delineate/${PV}/settings /opt/delineate/${PV}/delineate.sh
   echo "#!/bin/sh" > /usr/bin/delineate
   echo "cd /opt/delineate/${PV}/" >> /usr/bin/delineate
   echo "exec ${JAVA_HOME}/bin/java -jar delineate.jar ./settings/parameters-autotrace.xml ./settings/parameters-potrace.xml" >> /usr/bin/delineate
}
It's better to make your pkg_postinst part of src_install, and chmod ${D}/opt/delineate/... and write to ${D}/usr/bin/delineate instead. With your solution, the script won't be deleted after removing the package.
Quote:
The fact I had to echo a shell script of my own to fix the crappy one made by the developers bothers me most. Their script which I was just going to link to /usr/bin/ needs to be run in the directory, and I didn't know how else to do it.
You could have your ebuild add a cd to the existing script instead. That way, when the command to run delineate changes in a future version, you won't need to modify the ebuild.
Quote:
This is my first ebuild from scratch (done bunch of version bumps and minor changes though) - so be gentle :)
Nice job for a first time :)
Back to top
View user's profile Send private message
GenKreton
l33t
l33t


Joined: 20 Sep 2003
Posts: 828
Location: Cambridge, MA

PostPosted: Tue Nov 02, 2004 7:05 am    Post subject: Reply with quote

Thanks for the quick reply

The D was dropped in the copy and paste. I went over the common errors guide and added the necessary 3 line header.

Based on your advice I dropped the whole second sentence from the description and made the other changes.

My only problem is, I don't know how to just add the cd command to the script, then symlink it like I would prefer.
Back to top
View user's profile Send private message
TrueDFX
Retired Dev
Retired Dev


Joined: 02 Jun 2004
Posts: 1348

PostPosted: Tue Nov 02, 2004 7:14 am    Post subject: Reply with quote

GenKreton wrote:
Thanks for the quick reply

The D was dropped in the copy and paste. I went over the common errors guide and added the necessary 3 line header.

Based on your advice I dropped the whole second sentence from the description and made the other changes.

My only problem is, I don't know how to just add the cd command to the script, then symlink it like I would prefer.


One way to do it:
Code:
sed -i -e "1s:\$:\ncd /opt/delineate/${PV}:" ${D}/opt/delineate/${PV}/delineate.sh
dodir /usr/bin
dosym /opt/delineate/${PV}/delineate.sh /usr/bin/delineate

(Edit: Forgot to add dodir.)
Back to top
View user's profile Send private message
GenKreton
l33t
l33t


Joined: 20 Sep 2003
Posts: 828
Location: Cambridge, MA

PostPosted: Tue Nov 02, 2004 7:35 am    Post subject: Reply with quote

I have some man page reading on sed to do in the morning to understand what I just did, but for now bug #43130 has an ebuild, if they ever accept it.

Thanks a lot for your help TrueDFX
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum