On Sun, Jun 03, 2007 at 01:51:40PM +0100, Andrew Fyfe wrote:
Roman Kyrylych wrote:
2007/6/3, Dale Ogilvie <pnyli0002@sneakemail.com>:
Hello,
I've made a few alterations to the recently comitted xdelta mods for makepkg & wget-xdelta.sh.
Please check these out in my forum post: http://bbs.archlinux.org/viewtopic.php?pid=255563#p255563
In short, I fixed a couple of bugs, although oldversion detection is still not bullet-proof due to difficulties parsing out the package name. The main problem is that package names can include hyphens...
My best effort looks like this, the first 0-9 is meant to be the start of the pkg version, and the last being the release number:
ls {"$cache_dir","$PKGDEST"}/${pkgname}-[0-9]*-[0-9]*${PKGEXT}
This will fail if there happens to be a sub-package of foo such as:
foo-1st-sub-1.0-1.i686.pkg.tar.gz
...or a package that happens to be:
foo-A0-1.i686.pkg.tar.gz
The right way would be to split by hyphens: package name is everything minus 2 chunks separated by 2 rightmost hyphens. But my bash/sed/awk/cut/whatever skills were not enought when I've tried to do such parsing. :-P Or maybe there is already such solution that I'm not aware of?
sed to the rescue :D just whipped this up http://tinyurl.com/24fl8g This brings the version comparison into line with the rest of pacman - it works most of the time but version numbers containing letters will confuse it.
I'm much more partial to the reverse, parse off the first two hyphens, reverse method. Sed can do that very easily. Jason