You are not logged in.

#1 2005-12-30 22:52:32

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

PKGBUILD in Python

hello guys.

a few days ago i was coding a little on libpysrc which is a makepkg replacement written in python and one other guy (xevz) asked me why i didn't use python for PKGBULDs too. well, all i can say is w00t big_smile suddenly i could remove 250+ lines of ugly hackish code and replace them with 5. 8)

ok, here's the beuty:

pkgname = "ion3-devel"
pkgver = "20051210"
pkgrel = "1"
pkgdesc = "a tiling windowmanager with tabbed frames scriptable in Lua."
url = "http://iki.fi/tuomov/ion"
depends = ['x-server', 'lua']
makedepends = ['autoconf']
source = ["http://modeemi.fi/~tuomov/ion/dl/ion-3ds-%s.tar.gz" % (pkgver)]
sha1 = ["cad133a7a22556ba0f0402270c4f53cf217a7486"]

def build():
  cd("%s/src/ion-3ds-%s" % (startdir, pkgver))
  shell("autoreconf")
  shell("./configure --prefix=/usr --sysconfdir=/etc --enable-Xutf8")
  shell("make")
  shell("make prefix=%s/pkg/usr ETCDIR=%s/pkg/etc/ion3 VARDIR=%s/pkg/var/cache/ion3 
         LOCALEDIR=%s/pkg/usr/share/locale install"% (startdir, startdir, startdir, startdir))

there's only 3 outside vars so far, startdir, cd and shell. so what do you think of the idea? now if i could just get that bloody fakeroot to work with it. sad suggestions/patches very much appreciated.


arch + gentoo + initng + python = enlisy

Offline

#2 2005-12-30 22:55:54

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: PKGBUILD in Python

I don't think it looks as elegant as the bash version, especially with the shell() shell() shell() shell() stuff...

What are you planning on doing with python PKGBUILDs?  What's the end goal?

Offline

#3 2005-12-30 23:00:01

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: PKGBUILD in Python

well, i don't know yet phrak. that guy xevz initially got the idea from heretix which uses buildscripts written in ruby.


arch + gentoo + initng + python = enlisy

Offline

#4 2005-12-30 23:15:14

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD in Python

xerxes..
I agree with phrak.. ugly and a bit hackish still...

If I were writing a pkgbuild format, I would probably use a parser that read in plain text files, and then acted on then.

I believe python has YAML support. YAML would make a decent pkgbuild format..something like..

pkgname: ion3-devel
pkgver: 20051210
pkgrel: 1
pkgdesc: a tiling windowmanager with tabbed frames scriptable in Lua.
url : [url]http://iki.fi/tuomov/ion[/url]
depends: |- 
          x-server
          lua
makedepends:-
          autoconf
source:- 
          [url]http://modeemi.fi/~tuomov/ion/dl/ion-3ds-%s.tar.gz[/url]
" % (pkgver)]
sha1:|-
          cad133a7a22556ba0f0402270c4f53cf217a7486

build:|-
          ./configure --foo --blah
          more shell code...

The bonus is..it would be readable by multiple languages..yaml has parse libraries out there for many languages..

Something to think about at least.[/code]


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#5 2005-12-30 23:16:06

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD in Python

*dupe post*
stupid slow forum load..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#6 2005-12-30 23:41:17

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: PKGBUILD in Python

hmm, not so bad idea cactus but that should mean that you have to hack together more ugly code in the library which i want to avoid.


arch + gentoo + initng + python = enlisy

Offline

#7 2005-12-30 23:56:12

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD in Python

Not much..
you just 'push' the call to shell on each element of the build array, to the library..

foreach x in build:
  shell(x)

or whatever..

And... I actually flubbed the src line above.. it should look differently..

The only real thing I could see as an issue would be..
the use of the initial variables later in the build script.

That would be the required *hackish* use.. but it could be limited by the places it is allowed..
in the src and the build sections..

it would require a special delimiter that you parse those blocks through first, after reading..

only a bit hackish..

A yaml syntax pkgbuild script, with a python package builder, and a python pacman..
This is starting to get damn cool.

go xerxes!
smile


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#8 2005-12-31 00:02:46

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: PKGBUILD in Python

cactus wrote:

A yaml syntax pkgbuild script, with a python package builder, and a python pacman..
This is starting to get damn cool.

What if I don't want python installed? What if I'm running on a 300MHz P2 with like 64M of RAM and 300M of disk space?

Offline

#9 2005-12-31 00:17:35

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: PKGBUILD in Python

then you should get a new box, the eighties are over phrak big_smile

and yaml seems to have very bad support in python so i guess i stay with python for now. and the end goal of writing everything in python is that you get code that is easy to maintain and write graphical frontends to. and where fit aurbuild and pacbuild in? iirc they're written in python too.


arch + gentoo + initng + python = enlisy

Offline

#10 2005-12-31 02:11:07

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD in Python

there are yaml libraries that work pretty well.
I don't know why python hasn't rolled one in yet.. they seem to roll in just about everything else..
wink


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#11 2005-12-31 20:45:01

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: PKGBUILD in Python

python supports anything that is useful tongue


arch + gentoo + initng + python = enlisy

Offline

#12 2005-12-31 20:48:21

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD in Python

python supports bosoms.. film at 11


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#13 2006-01-02 12:35:25

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,893
Website

Re: PKGBUILD in Python

pyfakeroot ?


Mr Green

Offline

#14 2006-01-02 23:59:54

deficite
Member
From: Augusta, GA
Registered: 2005-06-02
Posts: 693

Re: PKGBUILD in Python

I don't know if I like this idea much. If you look at your python PKGBUILD you are still using bash you just have to type shell() around every command. I don't see why we'd need all the functionality of python just to build a program anyway.

Offline

#15 2006-01-03 17:28:40

neotuli
Lazy Developer
From: London, UK
Registered: 2004-07-06
Posts: 1,204
Website

Re: PKGBUILD in Python

I may be getting into this a bit late in the action (hell, I don't look at the forums much these days).

Anyhow, to the point, I think this is just reinventing the wheel, and at that, it's just making things more complicated than they need to be.

I'm not just saying that to say it, I'm saying that from experience.  A couple weeks ago I went and coded a gensync/updatesync replacement in python. The idea was that an entire pacman database could be represented in python as one big happy array of packages (neatly wrapped in a class), which would make it easy to add, remove, parse...etc. I wrote nearly the whole damned thing when I stopped to ask myself, "Now why the blazing hell did I do that? We've already got one of these."

The point? Makepkg is a well established program written as a bash script, because it works best as a bash script. Both the python version and the YAML version, at least to me, look a lot more messy, and less straightforward than the bash version.
Why make things more complicated than they need to be?


The suggestion box only accepts patches.

Offline

#16 2006-01-03 20:28:17

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: PKGBUILD in Python

for fun?


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

Board footer

Powered by FluxBB