You are not logged in.

#1 2005-10-11 10:58:50

butters
Member
Registered: 2005-08-31
Posts: 35

autogen PKGBUILD from source tarball

I had an idea while reading about the (lackluster) checkinstall utility:

http://asic-linux.com.mx/~izto/checkinstall/

The basic problem is that the user still needs to run ./configure, which will fail if the user is missing any dependencies.  It's a simple shell script that somewhat automates the best-case scenario for source-based package management.

But what if Arch had a tool that extracts a source tarball, parses its configure script to find compile-time and runtime dependencies (and a few flags maybe), looks at the Makefile to determine the correct variable to set the install path, and generates a default PKGBUILD from this information.  It might not always produce a working PKGBUILD, but it should produce something pretty close.

How feasible do you think this is?  Do you think this might be one more step towards empowering the user to get involved and create a first PKGBUILD?  Is this idea useless it it doesn't always produce a working PKGBUILD, or is anything better than starting with PKGBUILD.proto?

Offline

#2 2005-10-11 12:17:53

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: autogen PKGBUILD from source tarball

I once had a similar (but then again, quite different) idea. Because alot of the PKGBUILDs I wrote only differed from the prototype in $pkgname, $pkgver, $source and $depends, and I actually often filled in the latter with info from namcap after building the package, I thought; hey, why not have makepkg get the dependencies from namcap rather than $depends? And if the build process could be guessed by analyzing the source archive (gobolinux has an interesting script), you might not need to write a PKGBUILD at all!!

Your idea is probably better because you don't have to modify makepkg.

Wouldn't this be fun?:

~$ automakepkg ftp://ftp.gnu.org/gnu/wget/wget-1.10.1.tar.gz
Fetching source archive...................................Done
Extracting source archive.................................Done
Analysing source files....................................Done

Generated build instructions:

pkgname=wget
pkgver=1.10.1
pkgrel=1
depends=('glibc' 'openssl')
backup=('etc/wgetrc')
source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz)
md5sums=('879a15cc9093796b8a5035ff0d0d25ad')

build() {
  cd $startdir/src/$pkgname-$pkgver
  ./configure --prefix=/usr --sysconfdir=/etc
  make || return 1
  make DESTDIR=$startdir/pkg install
}

Does this look ok? [Yn]y
Let's go then, starting build()
...
Finished building
Do you want to install the package now? [yN]y
sudo pacman -A wget-1.10.1-1.pkg.tar.gz
Password:

A script, generate-pkgbuild which takes a source tarball as argument, would be an interesting experiment. The level of integration shown above would not be hard if we had a script that actually got the PKGBUILD right most of the time. Now, imagine a graphical interface for answering "yes" to those questions - the user would be able to download a source tarball and double-click it to install - under control of pacman!!

The idea of setting depends by analyzing $startdir/pkg after build() has finished still appeals to me though. This has a greater chance of finding the right dependencies. On the other hand, finding deps in two ways, first by the generate script, then by checking the pkg with namcap, makes it more waterproof.


All of your mips are belong to us!!

Offline

#3 2006-01-17 11:38:48

Youdaman
Member
From: Sydney, Australia
Registered: 2006-01-14
Posts: 41

Re: autogen PKGBUILD from source tarball

I notice it's been a while since the previous post in this thread -- does this checkinstall-like tool exist yet?

Offline

#4 2006-03-05 23:08:24

texray
Member
From: Wiesbaden, Germany
Registered: 2006-03-05
Posts: 2

Re: autogen PKGBUILD from source tarball

Hi,
I'm using Arch for a few weeks now, before that I was a Slackware user for a long time. In Slackware I used checkinstall much, because Slackware's own software repository isn't that big.
I missed checkinstall in Arch, so I wrote a script that resembles checkinstall. It works the same way, you type ./configure; make, and instead of 'make install', you use 'pacinstall'
Your are asked for some info (name, version, url and so on), a package is created and installed by pacman.

Fetch it here: http://kantico.de/texray/code/pacinstall
The only dependency is installwatch, the same thing checkinstall is based on.

This works well for ad-hoc package creation and installation and is a lot faster and more intuitive than writing a PKGFILE first (at least for me smile)
The ideas mentioned here (like finding the dependencies and creating a PKGFILE automatically) would be fun, but I don't think that this can be made reliably. That's why I stuck to the simple idea behind checkinstall.

Another thing: pacinstall asks you to enter dependencies. Of course, at the time when the package is installed, the software is already compiled. This means the depencies have to be met before configure runs, you enter them just to be included in the package. Even if you don't intend to distribute the package, it's a good idea to enter the dependencies, to keep track of broken deps when you uninstall the package.

Offline

#5 2006-03-05 23:20:31

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: autogen PKGBUILD from source tarball

Remember, if you find that your package build works, post it to the aur tongue

Offline

#6 2006-03-06 09:50:21

texray
Member
From: Wiesbaden, Germany
Registered: 2006-03-05
Posts: 2

Re: autogen PKGBUILD from source tarball

Well, in the guidelines it says to package the PKGFILE etc., but no binaries.
Pacinstall does not generate a PKGFILE but a complete binary package (as it just runs make install, keeps track of all files created or modified then creates a .FILELIST and .PKGINFO and packages everything).
To "cleanly" create an AUR compliant package, you still have to write a PKGFILE, but pacinstall can be used to quickly install a program and check if it's worth getting a PKGFILE written for and making it "permament" (posting it to the AUR, that is).
Thanks for the reminder anyways smile

Offline

Board footer

Powered by FluxBB