keenerd / packer

Bash wrapper for pacman and AUR.
247 stars 48 forks source link

Fix file path with epochs #128

Closed rinon closed 5 years ago

rinon commented 9 years ago

It might be better to actually handle the full file path including all possible options that makepkg throws in. However, this simple patch allows packages with epochs to actually build and install. Please fix this ASAP...

sakaru commented 9 years ago

I believe your fix will break if there are multiple matching files. For instance, I have PKGDEST=$HOME/packages set in my /etc/makepkg.conf. As a result I have a lot of old packages in there:

$ ls chromium-pepper-flash*
chromium-pepper-flash-1:15.0.0.223-1-x86_64.pkg.tar.xz
chromium-pepper-flash-1:15.0.0.223-2-x86_64.pkg.tar.xz
chromium-pepper-flash-1:15.0.0.239-1-x86_64.pkg.tar.xz
chromium-pepper-flash-1:16.0.0.235-1-x86_64.pkg.tar.xz
chromium-pepper-flash-1:16.0.0.235-2-x86_64.pkg.tar.xz

Instead, my suggested fix is:

$ diff /usr/bin/packer my_packer
339c339,340
<     pkgtarfiles="$pkgtarfiles $i-$pkgver-$pkgrel*$PKGEXT"
---
>     [[ $epoch ]] && epoch="$epoch:"
>     pkgtarfiles="$pkgtarfiles $i-$epoch$pkgver-$pkgrel*$PKGEXT"
AladW commented 8 years ago

makepkg does it like this:

get_full_version() {
    if (( epoch > 0 )); then
        printf "%s\n" "$epoch:$pkgver-$pkgrel"
    else
        printf "%s\n" "$pkgver-$pkgrel"
    fi
}

and

pkglist+=("$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}")