Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Need help with python app ebuild (prewikka)
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
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat May 07, 2005 2:21 pm    Post subject: Need help with python app ebuild (prewikka) Reply with quote

Current prewikka ebuild at bugzilla: http://bugs.gentoo.org/show_bug.cgi?id=87617

I'm trying to create an ebuild for prelude prewikka an applicazion written in python, this is my
Code:
net-analyzer/prewikka/prewikka-0.9.0_rc5.ebuild

Code:
inherit distutils flag-o-matic versionator

MY_P="${PN}-$(replace_version_separator 3 '-')"
DESCRIPTION="Prelude-IDS Manager"
HOMEPAGE="http://www.prelude-ids.org/"
SRC_URI="http://www.prelude-ids.org/download/releases/${MY_P}.tar.gz"
LICENSE="GPL-2"

KEYWORDS="~x86 ~sparc ~ppc"
IUSE=""
DEPEND=">=dev-lang/python-2.3
        dev-python/cheetah"

S=${WORKDIR}/${MY_P}


Here is the official install instruction https://trac.prelude-ids.org/wiki/InstallingPrewikka

My ebuild launch
Code:
python setup.py install
correctly... I suppose :) but I obtain this error
Code:
running install
creating /etc/prewikka
ACCESS DENIED  mkdir:     /etc/prewikka
error: could not create '/etc/prewikka': Permission denied

!!! ERROR: net-analyzer/prewikka-0.9.0_rc5 failed.
!!! Function distutils_src_install, Line 43, Exitcode 1
!!! (no error message)
!!! If you need support, post the topmost build error, NOT this status message.

--------------------------- ACCESS VIOLATION SUMMARY ---------------------------LOG FILE = "/tmp/sandbox-net-analyzer_-_prewikka-0.9.0_rc5-12681.log"

mkdir:     /etc/prewikka
--------------------------------------------------------------------------------


How can I solve this?
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic


Last edited by mrfree on Sun May 08, 2005 11:15 am; edited 1 time in total
Back to top
View user's profile Send private message
dol-sen
Developer
Developer


Joined: 30 Jun 2002
Posts: 2153
Location: Richmond, BC, Canada

PostPosted: Sat May 07, 2005 4:20 pm    Post subject: Reply with quote

Have a look at porthole's ebuild. Follow it as an example. First portage installs an app to a temp area then merges it to the main root system afterwards.
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat May 07, 2005 5:41 pm    Post subject: Reply with quote

Thz, I've tryed to add to my ebuild
Code:
pkg_preinst() {
        keepdir /etc/prewikka
        fowners root:portage /etc/prewikka
        fperms g+w /etc/prewikka
}

but the error persist...

This is the part of the source code of interest, that override default install:
Code:
class my_install(install):
    def finalize_options(self):
        ### if no prefix is given, configuration should go to /etc or in {prefix}/etc otherwise
        if self.prefix:
            self.conf_prefix = self.prefix + "/etc/prewikka"
        else:
            self.conf_prefix = "/etc/prewikka"

        install.finalize_options(self)

    def install_conf(self):
        self.mkpath(self.conf_prefix)
        for file in self.distribution.conf_files:
            dest = self.conf_prefix + "/" + os.path.basename(file)
            if os.path.exists(dest):
                dest += "-dist"
            self.copy_file(file, dest)

    def init_siteconfig(self):
        config = open("prewikka/siteconfig.py", "w")
        print >> config, "htdocs_dir = '%s'" % os.path.abspath((self.prefix + "/share/prewikka/htdocs"))
        print >> config, "database_dir = '%s'" % os.path.abspath((self.prefix + "/share/prewikka/database"))
        print >> config, "conf_dir = '%s'" % os.path.abspath((self.conf_prefix))
        config.close()

    def run(self):
        os.umask(022)
        self.install_conf()
        self.init_siteconfig()
        install.run(self)

        for dir in ("/",
                    "share/prewikka",
                    "share/prewikka/htdocs",
                    "share/prewikka/htdocs/images", "share/prewikka/htdocs/js", "share/prewikka/htdocs/css",
                    "share/prewikka/database", "share/prewikka/cgi-bin"):
            os.chmod(self.prefix + "/" + dir, 0755)
        os.chmod(self.conf_prefix, 0755)

        if not self.dry_run:
            for filename in self.get_outputs():
                if filename.find(".conf") != -1:
                    continue
                mode = os.stat(filename)[stat.ST_MODE]
                mode |= 044
                if mode & 0100:
                    mode |= 011
                os.chmod(filename, mode)

_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Sat May 07, 2005 5:47 pm    Post subject: Reply with quote

You have to specify the install prefix as ${D}; the sandbox won't let you write directly to the live filesystem.
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat May 07, 2005 6:02 pm    Post subject: Reply with quote

Maedhros wrote:
You have to specify the install prefix as ${D}; the sandbox won't let you write directly to the live filesystem.

Works :)
Code:
src_install() {
        distutils_src_install --prefix ${D}
}

#pkg_preinst() {
#        keepdir /etc/prewikka
#        fowners root:portage /etc/prewikka
#        fperms g+w /etc/prewikka
#}


But now...
Code:
>>> Install prewikka-0.9.0_rc5 into /var/tmp/portage/prewikka-0.9.0_rc5/image/ category net-analyzer
running install
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/etc
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/etc/prewikka
copying conf/prewikka.conf -> /var/tmp/portage/prewikka-0.9.0_rc5/image//etc/prewikka
running build
running build_py
copying prewikka/siteconfig.py -> build/lib/prewikka
running build_scripts
running install_lib
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/lib
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/lib/python2.3
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/lib/python2.3/site-packages
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/lib/python2.3/site-packages/prewikka
copying build/lib/prewikka/Database.py -> /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image//lib/python2.3/site-packages/prewikka
copying build/lib/prewikka/User.py -> /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image//lib/python2.3/site-packages/prewikka

[...]

copying htdocs/images/led_Y.gif -> /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/htdocs/images
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/htdocs/css
copying htdocs/css/style.css -> /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/htdocs/css
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/htdocs/js
copying htdocs/js/functions.js -> /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/htdocs/js
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/database
copying database/pgsql.sql -> /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/database
copying database/mysql.sql -> /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/database
error: /var/tmp/portage/prewikka-0.9.0_rc5/image//share/prewikka: No such file or directory

!!! ERROR: net-analyzer/prewikka-0.9.0_rc5 failed.
!!! Function distutils_src_install, Line 43, Exitcode 1
!!! (no error message)
!!! If you need support, post the topmost build error, NOT this status message.


Edit: can be the double slash in "error: /var/tmp/portage/prewikka-0.9.0_rc5/image//share/prewikka: No such file or directory"?
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat May 07, 2005 7:17 pm    Post subject: Reply with quote

The setup.py script seems to works well because if I run it as a regular user and I use a directory in my home with prefix option, installation end without errors :?
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat May 07, 2005 7:26 pm    Post subject: Reply with quote

Here is the problem!!!
Code:
[...]
running install_data
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka
creating /var/tmp/portage/prewikka-0.9.0_rc5/image/var/tmp/portage/prewikka-0.9.0_rc5/image/share/prewikka/cgi-bin
[...]

the prefix path is repeated 2 times 8O

But in the starting installation stage the path is correct

Why??? :roll:

PS: if it's useful I can post the full install messages
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Sat May 07, 2005 8:41 pm    Post subject: Reply with quote

Umm... can you post the whole ebuild as it is at the moment?
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sun May 08, 2005 11:12 am    Post subject: Reply with quote

I've solved the problem with this trick ;)

Code:
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit distutils flag-o-matic versionator

MY_P="${PN}-$(replace_version_separator 3 '-')"
DESCRIPTION="Prelude-IDS Manager"
HOMEPAGE="http://www.prelude-ids.org/"
SRC_URI="http://www.prelude-ids.org/download/releases/${MY_P}.tar.gz"
LICENSE="GPL-2"

KEYWORDS="~x86 ~sparc ~ppc"
IUSE=""
DEPEND=">=dev-lang/python-2.3
        dev-python/cheetah"

S=${WORKDIR}/${MY_P}

src_install() {
        # distutils_src_install doesn't work
        ## distutils_src_install --prefix=${D}

        python setup.py install --prefix=${D} || die
}


This is the distutils eclass implementation /usr/portage/eclass/distutils.eclass of interest:
Code:
distutils_src_install() {
        if has_version ">=dev-lang/python-2.3"; then
                ${python} setup.py install --root=${D} --no-compile "$@" || die
        else
                ${python} setup.py install --root=${D} "$@" || die
        fi
[...]


The only difference seem to be that distutils_src_install use --root=${D} parameter together with my --prefix=${D}
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sun May 08, 2005 12:40 pm    Post subject: Reply with quote

There are some other problems here :?

1) probably I need to set --prefix=${D}/usr because
Code:
# equery f prewikka
[ Searching for packages matching prewikka... ]
net-analyzer/prewikka-0.9.0_rc5-r1
* Contents of net-analyzer/prewikka-0.9.0_rc5-r1:
/bin
/bin/prewikka-httpd
/etc
/etc/prewikka
/etc/prewikka/prewikka.conf
/lib
/lib/python2.3
/lib/python2.3/site-packages
/lib/python2.3/site-packages/__init__.py
/lib/python2.3/site-packages/__init__.pyc
/lib/python2.3/site-packages/prewikka
/lib/python2.3/site-packages/prewikka/Auth.py
/lib/python2.3/site-packages/prewikka/Auth.pyc
/lib/python2.3/site-packages/prewikka/Config.py
[...]
/lib/python2.3/site-packages/prewikka/views/usermanagement.py
/lib/python2.3/site-packages/prewikka/views/usermanagement.pyc
/share
/share/prewikka
/share/prewikka/cgi-bin
/share/prewikka/cgi-bin/prewikka.cgi
/share/prewikka/database
[...]
/share/prewikka/htdocs/js
/share/prewikka/htdocs/js/functions.js

But the correct path are /usr/lib/python2.3/[...], /usr/bin and so on...

2) using this new prefix setting /etc/prewikka become /usr/etc/prewikka and this is not good :)

3) seems that during the emerge the package store path prefix infos because:
Code:
# PYTHONPATH="/lib/python2.3/site-packages" /bin/prewikka-httpd
Traceback (most recent call last):
  File "/bin/prewikka-httpd", line 132, in ?
    server = PrewikkaServer(("0.0.0.0", 8000), PrewikkaRequestHandler)
  File "/bin/prewikka-httpd", line 39, in __init__
    self.core = Core.Core()
  File "/lib/python2.3/site-packages/prewikka/Core.py", line 55, in __init__
    self._env.config = Config.Config(siteconfig.conf_dir + "/prewikka.conf")
  File "/lib/python2.3/site-packages/prewikka/Config.py", line 37, in __init__
    file.load()
  File "/lib/python2.3/site-packages/prewikka/MyConfigParser.py", line 125, in load
    for line in open(self.filename).readlines():
IOError: [Errno 2] No such file or directory: '/var/tmp/portage/prewikka-0.9.0_rc5-r1/image/etc/prewikka/prewikka.conf'

/var/tmp/portage/prewikka-0.9.0_rc5-r1/image is the ${D} path used in ebuild

Editing by hand the config file /lib/python2.3/site-packages/prewikka/siteconfig.py with the correct path prewikka works
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Tue Jul 19, 2005 8:07 am    Post subject: Reply with quote

I used the ebuild that is in portage tree and I got the following error:
Code:
 /usr/bin/prewikka-httpd
Traceback (most recent call last):
  File "/usr/bin/prewikka-httpd", line 34, in ?
    from prewikka import Core, Request, siteconfig
  File "/usr/lib/python2.3/site-packages/prewikka/Core.py", line 31, in ?
    import prelude, preludedb
ImportError: No module named prelude


Is there a missing dependency?
Back to top
View user's profile Send private message
Pythonhead
Developer
Developer


Joined: 16 Dec 2002
Posts: 1801
Location: Redondo Beach, Republic of Calif.

PostPosted: Tue Jul 19, 2005 4:53 pm    Post subject: Reply with quote

zbindere wrote:

ImportError: No module named prelude[/code]

Is there a missing dependency?


Maybe dev-libs/libprelude with USE='python'
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Thu Jul 21, 2005 8:10 pm    Post subject: Reply with quote

Code:
emerge -pv libprelude

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] dev-libs/libprelude-0.8.10-r1  +ssl 877 kB


no python use flag I think
Back to top
View user's profile Send private message
Pythonhead
Developer
Developer


Joined: 16 Dec 2002
Posts: 1801
Location: Redondo Beach, Republic of Calif.

PostPosted: Thu Jul 21, 2005 11:27 pm    Post subject: Reply with quote

Newer versions have it:

dev-libs/libprelude-0.9.0_rc8 +perl +python
Back to top
View user's profile Send private message
tecknojunky
Veteran
Veteran


Joined: 19 Oct 2002
Posts: 1937
Location: Montréal

PostPosted: Sun Aug 14, 2005 7:38 pm    Post subject: Reply with quote

Pythonhead wrote:
Newer versions have it:

dev-libs/libprelude-0.9.0_rc8 +perl +python
Still...
Code:
# emerge -pv libprelude

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] dev-libs/libprelude-0.9.0_rc11  -perl +python 0 kB

Total size of downloads: 0 kB
...yet...
Code:
# /usr/bin/prewikka-httpd
Traceback (most recent call last):
  File "/usr/bin/prewikka-httpd", line 34, in ?
    from prewikka import Core, Request, siteconfig
  File "/usr/lib/python2.3/site-packages/prewikka/Core.py", line 31, in ?
    import prelude, preludedb
ImportError: No module named preludedb

_________________
(7 of 9) Installing star-trek/species-8.4.7.2::talax.
Back to top
View user's profile Send private message
Pythonhead
Developer
Developer


Joined: 16 Dec 2002
Posts: 1801
Location: Redondo Beach, Republic of Calif.

PostPosted: Sun Aug 14, 2005 8:05 pm    Post subject: Reply with quote

Maybe:
Code:
USE='python' dev-libs/libpreludedb
Back to top
View user's profile Send private message
tecknojunky
Veteran
Veteran


Joined: 19 Oct 2002
Posts: 1937
Location: Montréal

PostPosted: Sun Aug 14, 2005 10:28 pm    Post subject: Reply with quote

Pythonhead wrote:
Maybe:
Code:
USE='python' dev-libs/libpreludedb
Dho! Thanks. That was it. :oops:
_________________
(7 of 9) Installing star-trek/species-8.4.7.2::talax.
Back to top
View user's profile Send private message
capitanjackal
n00b
n00b


Joined: 26 Aug 2003
Posts: 69
Location: Quarata (CALIFORNIA)

PostPosted: Thu Oct 13, 2005 1:49 am    Post subject: Reply with quote

Hi all
I had prewikka-httpd working, but from today when I try to start it I see:

sovranosuperocculto prewikka # prewikka-httpd
Traceback (most recent call last):
File "/usr/bin/prewikka-httpd", line 34, in ?
from prewikka import Core, Request, siteconfig
ImportError: No module named prewikka


and now if I try to re emerge I have:

sovranosuperocculto snort # emerge prewikka
Calculating dependencies ...done!
>>> emerge (1 of 1) net-analyzer/prewikka-0.9.0 to /
>>> md5 files ;-) prewikka-0.9.0.ebuild
>>> md5 files ;-) files/digest-prewikka-0.9.0
>>> md5 src_uri ;-) prewikka-0.9.0.tar.gz
>>> Unpacking source...
>>> Unpacking prewikka-0.9.0.tar.gz to /var/tmp/portage/prewikka-0.9.0/work
>>> Source unpacked.
Traceback (most recent call last):
File "setup.py", line 34, in ?
from Cheetah.CheetahWrapper import CheetahWrapper
ImportError: No module named Cheetah.CheetahWrapper

!!! ERROR: net-analyzer/prewikka-0.9.0 failed.
!!! Function distutils_src_compile, Line 35, Exitcode 1
!!! compilation failed
!!! If you need support, post the topmost build error, NOT this status message.


Any idea ?

thanks

Giacomo
_________________
Meglio una Fiat 500 con 500 watts che una Fiat Punto con punti watts!
PS: ho comprato la punto! sono un l00s3r
Back to top
View user's profile Send private message
capitanjackal
n00b
n00b


Joined: 26 Aug 2003
Posts: 69
Location: Quarata (CALIFORNIA)

PostPosted: Thu Oct 13, 2005 9:27 pm    Post subject: Reply with quote

    emerge dev-python/cheetah

fixed the problem!


Now I noticed another problem:
I can login in prewikka only while the terminal from where I launch prewikka-httpd is open, if I put in background the process and close the terminal I cannot login to prewikka anymore.

any idea ?

Giacomo
_________________
Meglio una Fiat 500 con 500 watts che una Fiat Punto con punti watts!
PS: ho comprato la punto! sono un l00s3r
Back to top
View user's profile Send private message
subtlepoint
n00b
n00b


Joined: 27 Feb 2005
Posts: 15

PostPosted: Mon May 22, 2006 9:55 pm    Post subject: Reply with quote

capitanjackal wrote:
    emerge dev-python/cheetah

fixed the problem!


Now I noticed another problem:
I can login in prewikka only while the terminal from where I launch prewikka-httpd is open, if I put in background the process and close the terminal I cannot login to prewikka anymore.

any idea ?

Giacomo


I have the same problem.. anyone?
Back to top
View user's profile Send private message
capitanjackal
n00b
n00b


Joined: 26 Aug 2003
Posts: 69
Location: Quarata (CALIFORNIA)

PostPosted: Tue May 23, 2006 12:57 pm    Post subject: Reply with quote

Use daemontools

Giacomo
_________________
Meglio una Fiat 500 con 500 watts che una Fiat Punto con punti watts!
PS: ho comprato la punto! sono un l00s3r
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