[aur-general] provides version for VCS packages

Côme Pruvost come.pruvost at gmail.com
Thu Dec 3 09:16:45 EST 2009


Hello !

It's been some time I'm facing the same problem. When one build a
package from VCS, one should include the original package name
(usually $pkgname with -svn -git ... removed) in the provides array so
packages depending on the program provided can find it.
For example, if I want to package python-poppler-bzr, I will include
"provides=('python-poppler')" so desigle can satisfy its own
"depends=('python-poppler')".

But now, imagine that desigle needs a recent version of
python-poppler, and so it has "depends=('python-poppler>=0.2')".
Then, makepkg will not detect python-poppler provided by
python-poppler-bzr because it cannot compare versions.
One then have to specify the version of the package provided. In case
of a VCS, it's not always easy because it can change from a revision
to another. So one need a way to get that version, and use it in the
provides array.

That's here I need your advice, because I successfully tested some
workarounds, but I'm not really sure of their "ugliness"...

Solution 1: Use pkg-config file (not always present) with awk
build() {
  ...
  _realver=`cat path/to/package.pc | awk '/^Version/{print $2}'`
  provides=("realname=${_realver}")
}
Pros : rather easy
Cons : Needs awk and some people hate awk, needs file.pc set.

Solution 2: Use pkg-config with grep and sed because some people hate awk
build() {
  ...
  _realver=`cat path/to/package.pc | grep 'Version' | sed 's/Version: //'`
  provides=("realname=${_realver}")
}
Pros : only generic tools are used
Cons : still needs file.pc, less clear

Solution 3: Use configure.ac
build {
  ...
  echo "provides=(realpkg=@VERSION@)" > ${pkgname}.provides.in
  echo "AC_OUTPUT([${pkgname}.provides])" >> configure.ac
  ./autogen.sh
  ...
  source ${pkgname}.provides
}
Pros : should work in more cases, fun somehow isn't it ?
Cons : rather complex, maybe incorrect with the new autoconf syntax
(AC_CONFIG_FILES) and it seems that files are then generated two
times.

Well, thanks for reading, let's discuss that now :)

Cilyan


More information about the aur-general mailing list