You are not logged in.

#1 2008-08-26 12:02:55

voidzero
Member
Registered: 2007-06-21
Posts: 109

[solved] Making Turbogears package

I'm using this package build:

pkgname=turbogears
pkgver=1.0.5
pkgrel=1
pkgdesc="A rapid web development megaframework"
arch=('i686' 'x86_64')
url="http://www.turbogears.org"
license=('GPL')
depends=('python')
source=('http://www.turbogears.org/download/tgsetup.py')
md5sums=('66e3dc1413895b1334da2e79b7a1329e')
options=(!strip !zipman)

build() {
        DIR=$PWD
        mkdir -p ../pkg/usr/bin
        mkdir -p ../pkg/usr/lib/python2.5
        mkdir -p ../pkg/usr/lib/python2.5/site-packages
        PYTHONPATH=$PWD/../pkg/usr/lib/python2.5/site-packages python tgsetup.py -U -d ../pkg/usr/lib/python2.5/site-packages --prefix=../pkg/usr
}

In the pkg folder I end up with only pkg/usr/
But... when looking at the package using mc, I see:

/PasteDeploy-1.3.2-py2.5.egg
/PasteScript-1.6.3-py2.5.egg
/TurboGears-1.0.5-py2.5.egg
/lib
/python2.5
/site-packages
/turbogears
/usr

How can I get a working package?

Last edited by voidzero (2008-08-26 17:36:37)

Offline

#2 2008-08-26 13:19:55

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] Making Turbogears package

Read the tgsetup.py script to see how to set the destination directory for the install. I doubt that it's with PYTHONPATH. PYTHONPATH is used to tell a python script (here, the install script) where to find modules for it to USE.

I haven't looked at the turbogears install script, but for other python packages I have the PKGBUILD lines look like this:

cd $srcdir/$pkgname
python setup.py build install --root="$pkgdir" || return 1

Perhaps the tgsetup.py script works similarly. Read it and see how it's parsing its arguments to extract the destination directory.

You'll probably want to delete that PYTHONPATH line because when you do a makepkg in a clean directory, the directories/modules it's supposedly pointing to don't yet exist.

Perhaps the -d DIR or --prefix=DIR arguments you're passing the tgsetup.py script do set the destination directory. (Do you need both?) Try changing them to use absolute paths: so just "$pkgdir/usr..." instead of "../pkg/usr".

Try also putting an explicit:
cd "$srcdir/$pkgname"
or
cd "$srcdir/$pkgname-$pkgver"
at the start of the build function. I don't know if makepkg guarantees that build() will start in any specific directory. (The build() function you've got assumes it's running one level below the PKGBUILD file, e.g, in the $srcdir. Would it even run there? Doesn't it need to be inside $srcdir/turbogears* to find the tgsetup.py script?)

Offline

#3 2008-08-26 13:26:42

voidzero
Member
Registered: 2007-06-21
Posts: 109

Re: [solved] Making Turbogears package

I think that tgsetup.py calls easy_install, which has a --install-dir (-d) option, but no --root option. The reason I set PYTHONPATH is that this must be set to the dir that installs it, if I don't do that, it will not install. But the biggest strangeness is that the package contains dirs that are not in pkg/. I've tried multiple options.

There's no extraction so there is no $srcdir/$pkgname, it just starts in $srcdir and runs tgsetup.py from there. The relative paths are also no problem. I'm just confused why makepkg includes different files than the ones from pkg/...

Last edited by voidzero (2008-08-26 13:42:27)

Offline

#4 2008-08-26 15:46:05

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] Making Turbogears package

OK, I just skimmed the easy_setup docs and it looks like you're doing the right thing with the arguments to tgsetup (taking your word for it that it works like easy_setup). I dunno. To simplify debugging, though, I'd still recommend adding a "cd $srcdir" to the start of the build() function. And replacing the "../pkg/"s with "$pkgdir/". Perhaps these aren't causing any problems; but it's easy to make sure. Then I'd suggest adding a "-v" or "-v -v" to tgsetup so you get more feedback about what it's installing where.

I agree it's bizarre that the package contains stuff that's not in pkg. Does it contain actual files, or only emtpy dirs?

Offline

#5 2008-08-26 17:11:07

voidzero
Member
Registered: 2007-06-21
Posts: 109

Re: [solved] Making Turbogears package

OK, well I did as you said and updated my PKGBUILD thusly:

# Made by: voidzero.
pkgname=turbogears
pkgver=1.0.5
pkgrel=1
pkgdesc="A rapid web development megaframework"
arch=('i686' 'x86_64')
url="http://www.turbogears.org"
license=('GPL')
depends=('python')
source=('http://www.turbogears.org/download/tgsetup.py')
md5sums=('66e3dc1413895b1334da2e79b7a1329e')
options=(!strip !zipman)

build() {
        cd $srcdir
        mkdir -p $pkgdir/usr/bin
        mkdir -p $pkgdir/usr/lib/python2.5
        mkdir -p $pkgdir/usr/lib/python2.5/site-packages
        PYTHONPATH=$pkgdir/usr/lib/python2.5/site-packages python tgsetup.py -U -d $pkgdir/usr/lib/python2.5/site-packages --prefix=$pkgdir/usr -v
}

And then I looked at my package with mc. I see all kinds of folders. This time I decided to unpack the archive to confirm that what mc shows me is the real deal. Apparantly not....... because the extraction only shows the usr/ dir, like it should!

Thank you for your help and time Profjim; even though maybe the pkgbuild actually wasn't broken you helped me to improve it. Just as good! smile

-v0

Offline

#6 2008-08-26 17:22:40

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] Making Turbogears package

I'm not sure whether you're saying that your makepkg actually was successful or not...

Anyway, I'm interested in this working because I intend to use turbogears, but I don't have my system set up that far yet.

Here's a PKGBUILD that seems to work for me... but a couple of packaging concerns arise. For one, there's that easy-install.pth file in pkg/usr/lib/python2.5/site-packages. I think you can just rm it at the end of the build() but I'm not sure. Second, this tgsetup script installs a lot of packages that the user doesn't yet have installed. What if I already had Paste or CherryPy installed via another package? Then the two packages would conflict. I can think of two work-arounds: 1. at the end of your build() function, delete all the non-TG specific directories from pkg/usr/lib/python2.5/site-packages, and list the other stuff as depends=(). Alternatively, list the other stuff as a provides=() for your package, and list any overlapping packages in AUR/the repos as conflicts=().

Finally, the python version shouldn't be hard-coded. python2.6 is almost here. Not to mention py3k, but perhaps it's too much to expect TG to build on that right away.

Anyway, here's the PKGBUILD I hacked up...


pkgname=turbogears
pkgver=1.0.5
pkgrel=1
pkgdesc="the rapid web development megaframework you've been looking for."
url="http://www.turbogears.org"
license=("MIT")        # not sure about this---this is what the turbogears 1.0.4 package on AUR specifies
arch=('i686' 'x86_64')
depends=('python')

# these are listed in the turbogears 1.0.4 package
#depends=('cherrypy2>=2.3.0' 'cherrypy2<=2.9.9' \
#         'python-turbojson>=1.1.2' 'python-turbocheetah>=1.0' \
#         'python-turbokid>=1.0.4' 'python-sqlobject>=0.9' \
#         'python-simplejson>=1.3' 'python-formencode>=0.9' \
#         'python-configobj>=4.4.0' 'python-pastescript>=1.3.6' \
#         'python-ruledispatch>=0.5a0.dev_r2303' 'python-decoratortools>=1.7' \
#         'python-elementtree>=1.2.6' 'python-cheetah>=2.0.1')

makedepends=('setuptools')
conflicts=()
replaces=()
backup=()
#install=
source=('http://www.turbogears.org/download/tgsetup.py')

build() {
  cd $startdir/src
  local sitepkg="$pkgdir/usr/lib/python2.5/site-packages"
  mkdir -p "$sitepkg"
  PYTHONPATH="$sitepkg" python tgsetup.py -d "$sitepkg" --prefix="$pkgdir/usr"
  find "$sitepkg" -type f -name '*.pyc' -delete
  rm "$sitepkg/site.py"
}

Offline

#7 2008-08-26 17:28:23

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] Making Turbogears package

I just realized I may have been misinterpreting you all along. I thought you were saying, you're only ending up with an EMPTY usr directory, but viewing the package in mc is showing these other files too (in the wrong place). I now think you're saying, no the usr directory is correctly populated; the only problem was the extraneous files that mc seemed to be reporting. But when you de-tar the package you see that the extraneous files really aren't there. The problem is with mc. Is that right?

Anyway, I'm glad you're building successfully. The packaging concerns I just voiced are worth thinking about in any case.

Offline

#8 2008-08-26 17:32:02

voidzero
Member
Registered: 2007-06-21
Posts: 109

Re: [solved] Making Turbogears package

now think you're saying, no the usr directory is correctly populated; the only problem was the extraneous files that mc seemed to be reporting. But when you de-tar the package you see that the extraneous files really aren't there. The problem is with mc. Is that right?

Exactly!

I submitted my latest PKGBUILD to the AUR because I only read your reply afterwards. Want me to update it to your build() process?

Offline

#9 2008-08-26 17:35:25

voidzero
Member
Registered: 2007-06-21
Posts: 109

Re: [solved] Making Turbogears package

Your packagebuild installs only tg-admin and the TurboGears egg with easy-install.pth. Is that what you wanted? Mine installs everything else also, like cherrypy and so.

Offline

#10 2008-08-26 17:43:01

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] Making Turbogears package

I was just playing around; I'm not sure what needs to be installed and what doesn't. I think my PKGBUILD as I posted it also includes cherrypy and a bunch of other stuff too. But you should either rm that stuff (and put it into separate packages if they don't already exist, and list them as depends), or have your package report that it's installing them. Else users who may have those modules installed via other packages will get conflicts.

Offline

#11 2008-08-26 17:51:39

voidzero
Member
Registered: 2007-06-21
Posts: 109

Re: [solved] Making Turbogears package

Oh. Wait. It only installs what you don't yet have. Since I had already installed my package, makepkg only reinstalled TurboGears and not CherryPy and so. Maybe we should just use easy_install and forget the package idea. I'm a bit stuck here.

Offline

#12 2008-08-26 18:06:28

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] Making Turbogears package

Yeah, it installs what you don't yet have. Don't be stuck, you just need to do some research. What are all the modules that the tgsetup.py script might install? Which of them are provided by any other arch packages? How can you tell the tgsetup.py script to ignore the user's existing main site-package directory? Probably there's some switch or environment variable you can use for that; or at worst, you'll have to have your PKGBUILD do a sed on the tgsetup.py. Have the PKGBUILD induce the tgsetup.py script to run as though in an environment where NONE of the modules that it might install are already present. (You want users who use the PKGBUILD to get consistent results, after all.) Then for each of those modules, you need to decide whether your package is going to take responsibility for them---in that case, if there are any other packages X that also provide the module, you should say your package provides=(X,...) and conflicts=(X...). OR you might separate the module out from this package and instead have this package depends=(X...) some other package X which provides that module. (X might be some other package you yourself provide.) In the latter case, your PKGBUILD should rm that module from $pkgdir/usr/lib/python*/site-packages at the end of its build(). The goal is to get the same package built no matter which machine the makepkg was run on.

It'll take some work and planning but what you need to do seems clear enough, doesn't it?

Offline

Board footer

Powered by FluxBB