Gentoo Archives: gentoo-devhelp

From: Mike Frysinger <vapier@g.o>
To: gentoo-devhelp@l.g.o
Subject: [gentoo-devhelp] Re: [gentoo-dev] My first ebuild: app-cdr/furiusisomount-0.11.3.1
Date: Sun, 25 Sep 2011 19:22:34
Message-Id: CAJaTeTqh68cuDmGNKCrE53v92aRyd+ZPD-E0y4mjkxSQGWB-rQ@mail.gmail.com
1 [ bcc gentoo-dev, to gentoo-devhelp]
2
3 On Sat, Sep 24, 2011 at 05:59, Moritz Schlarb <mail@××××××××××××××.de> wrote:
4 > Hello developers!
5 >
6 > I wrote my first ebuild and I would like to ask for some feedback on it.
7
8 we use the gentoo-devhelp list for this stuff
9
10 > Because the application neither has a makefile nor is using distribute
11 > since it's python, I have to install all files by hand, or have I?
12
13 use the distutils eclass ? see if it has a setup.py or something like that.
14
15 > DESCRIPTION="Simple Gtk+ Interface to Mount ISO, IMG, BIN, MDF and NRG Image files without burning to disk."
16
17 the description is generally a sentence fragment, so drop the period at the end
18
19 > #http://launchpad.net/furiusisomount/python/0.11.3.1/+download/furiusisomount_0.11.3.1.tar.gz
20
21 don't leave uncomment URLs in there
22
23 > KEYWORDS="~x86"
24
25 generally we default to ~amd64 ~x86. especially since you said this
26 is python code and not compiled.
27
28 > src_prepare() {
29 > mv ${PN}_${PV} ${P}
30
31 mucking with source tree layout is generally a src_unpack operation
32
33 > sed -i -e "s/\"\(src\/main.py\)\"/\/usr\/share\/${PN}\/\1/" ${P}/furiusisomount || die "sed failed"
34
35 use ":" as your separator and you wan't have to escape all of the
36 forward slashes.
37
38 when dealing with long lines, it's customary to wrap it like so:
39 sed -i \
40 <-e option> \
41 <-e option> \
42 path/to/file || die
43
44 also, there's no need to add a message to `die` here since the PM is
45 smart enough to show you the snippet of code that failed as well as
46 the line number
47
48 > src_install() {
49
50 i think once you convert to distutils, much of this will go away.
51 i'll respond just to give you an idea of how to do things in general.
52
53 > dodir /usr/share/${PN}/
54 >
55 > dodir /usr/share/${PN}/src
56 > insinto /usr/share/${PN}/src
57
58 there's no need for these dodir's as the doins and such helpers will
59 automatically create the required directories
60
61 > for i in $(find src -name '*.py' ) ; do
62
63 when you use variables, you need to do "local i" so you don't
64 clobber/export them unintentionally
65
66 i imagine the `find` could be replaced with: src/*.py
67
68 > doins $i
69
70 need to use "|| die" when using `doins`
71 -mike