[pacman-dev] Handling modules

Jürgen Hötzel juergen at hoetzel.info
Fri Mar 9 14:31:09 EST 2007


On Fri, Mar 09, 2007 at 10:48:35AM -0600, Aaron Griffin wrote:
> On 3/9/07, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
> > On 3/9/07, James <iphitus at gmail.com> wrote:
> > > 4) Modules.
> > > I still think that there has to be a better way of dealing with
> > > modules. We've put this discussion off once already saying "pacman3".
> > > Now pacman3-RC1 is upon us, it's time to start looking at how we can
> > > improve these, so that it can swiftly be implemented and included in
> > > future releases.
> 
> I have a proof-of-concept somewhere that checked a PKGBUILD for
> "build_module" instead of "build".  If found, it runs it once for each
> kernel installed on the system (checking pacman first to make sure it
> is a real package and not a custom kernel).

I recommend a more gerneral solution. A buildsystem/package manager should
not be aware of kernels, just packages.
 
> Couple this with repo-add which gets all information from the package
> (and does not need to know about the PKGBUILD) and this would be a
> real straightforward fix to building multiple modules with one
> PKGBUILD.
> 
> Now the *real* question is - how do we install them?  I can think of a
> decent use-case:
> 
> $ pacman -S ndiswrapper
> - ndiswrapper is no longer a package.  It is a group.  Each package
> has a setting somewhere (TYPE="module" ??) indicating that this is a
> module.  Pacman then loops through the group, if a packahe TYPE is
> "module", it checks to see if the kernel is installed.  If it is, it
> adds it to the target list.

The decision which modules to install should be left to the user, maybe he
wants modules installed for the stock kernel but not for another release.

> - so the result would install ndiswrapper-ARCH, ndiswrapper-beyond,
> and ndiswrapper-thinkpad on my machine.
> 
> One problem I can think of is as follows:
> pacman -S ndiswrapper
> - install ndiswrapper-ARCH
> 
> pacman -S kernel26beyond
> - this should ALSO install ndiswrapper-beyond at the same time

Just keep it the arch way: freedom of choice, user-controlled package
management. Package management should not make any assumption about
optional packages.

I wrote a patch (enclosed) for makepkg to implement some kind of
metapackages. This is a more general solution than a module-specific way.

I attached ndiswrapper PKGBUILD/metscripts for stock an ck kernels to illustrate my
ideas.

This way we could also implement subpackages with a single PKGBUILD.

Jürgen


-------------- next part --------------
#$Id: PKGBUILD,v 1.32 2007/02/12 08:13:10 aaron Exp $
#Maintainer: Aaron Griffin <aaron at archlinux.org>

pkgname=ndiswrapper${subname}
_kernver=2.6.20-${kernrelase}
pkgver=1.37
pkgrel=1
pkgdesc="Module for NDIS (Windows Network Drivers) drivers supplied by vendors. For arch 2.6 kernel ${subname}."
arch=(i686 x86_64)
url="http://ndiswrapper.sourceforge.net"
install="ndiswrapper.install"
depends=('ndiswrapper-utils' "kernel26${subname}")
source=(http://easynews.dl.sourceforge.net/sourceforge/ndiswrapper/ndiswrapper-$pkgver.tar.gz)
md5sums=('55ee2bd959bfdd3ea4ced6ee8d325c0e')
build()
{
  cd $startdir/src/ndiswrapper-$pkgver/driver
  make KVERS=$_kernver 
  make DESTDIR=$startdir/pkg KVERS=$_kernver install || return 1
  rm $startdir/pkg/lib/modules/$_kernver/modules.* #wtf?

  sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" $startdir/*.install
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stock.meta.sh
Type: application/x-sh
Size: 29 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20070309/c0e40517/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ck.meta.sh
Type: application/x-sh
Size: 29 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20070309/c0e40517/attachment-0001.sh>
-------------- next part --------------
Index: scripts/makepkg
===================================================================
RCS file: /home/cvs-pacman/pacman-lib/scripts/makepkg,v
retrieving revision 1.56
diff -u -r1.56 makepkg
--- scripts/makepkg	3 Mar 2007 18:38:57 -0000	1.56
+++ scripts/makepkg	9 Mar 2007 19:18:41 -0000
@@ -517,6 +517,14 @@
 	#    done
 fi
 
+metascripts=$(find $(dirname $BUILDSCRIPT) -name "*meta.sh")
+if [[ -z $metascripts ]]; then
+	metascripts="/dev/null"	# workaround if no metascripts available
+fi
+
+for metascript in ${metascripts};do 
+
+source $metascript
 source $BUILDSCRIPT
 
 # check for no-no's in the build script
@@ -1039,6 +1047,8 @@
 
 installpackage
 
+done
+
 exit 0
 # vim: set ts=2 sw=2 noet:
 


More information about the pacman-dev mailing list