tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg_chk likes obsolete packages
On 18 July 2012 23:42, Mike M. Volokhov <mike.volokhov%gmail.com@localhost>
wrote:
> Hi,
>
> I found that pkgtools/pkg_chk doesn't pay attention if available
> binary package older than already installed one. It results in
> a weird attempt to install obsolete packages. For example:
Its not so much that it likes obsolete packages, as that it tries to
ensure the installed packages exactly match what is in the binary
package set (or in the pkgsrc tree). There have been a couple of times
when I have depended on that behaviour of replacing a 'newer'
installed version with what is in the pointed to pkgsrc tree
However, I can definitely see a use case for your patch. I really
don't want to add another option to pkg_chk, but maybe this deserves
one...
Hmm, I could repurpose -B (Check the "Build version" of packages) to
mean "exactly match build version and even downgrade), and have your
modified behaviour as the default (though I'm not sure about
conflating the two behaviours of downgrading and checking build
version).
What do you think?
> $ pkg_info -e R
>
> R-2.14.2
> $ pkg_chk -C ./pkg_chk.conf -P /usr/pkgsrc/packages/All -ab
> math/R - R-2.14.2 < R-2.14.0nb3 (binary package available)
>
> I'd suggest the following fix to pkg_chk and bump its version to 2.1:
>
> --- files/pkg_chk.sh 2009-12-10 15:19:42.000000000 +0200
> +++ files/pkg_chk.sh 2012-07-19 01:16:58.000000000 +0300
> @@ -57,21 +57,26 @@
> continue
> fi
> if [ ! -d $PKG_DBDIR/$PKGNAME ];then
> - msg_n "$pkgdir - "
> pkg=$(echo $PKGNAME | ${SED} 's/-[0-9].*//')
> + pkgmatch=$(echo $PKGNAME | ${SED} 's/-\([0-9].*\)/>=\1/')
> pkginstalled=$(sh -c "${PKG_INFO} -e $pkg" || true)
> - INSTALL=
> - if [ -n "$pkginstalled" ];then
> - msg_n "$pkginstalled < $PKGNAME"
> - MISMATCH_TODO="$MISMATCH_TODO $pkginstalled"
> + if ! ${PKG_ADMIN} pmatch "$pkgmatch" "$pkginstalled" ; then
> + msg_n "$pkgdir - "
> + INSTALL=
> + if [ -n "$pkginstalled" ];then
> + msg_n "$pkginstalled < $PKGNAME"
> + MISMATCH_TODO="$MISMATCH_TODO $pkginstalled"
> + else
> + msg_n "$PKGNAME missing"
> + MISSING_TODO="$MISSING_TODO $PKGNAME $pkgdir"
> + fi
> + if is_binary_available $PKGNAME ;then
> + msg_n " (binary package available)"
> + fi
> + msg
> else
> - msg_n "$PKGNAME missing"
> - MISSING_TODO="$MISSING_TODO $PKGNAME $pkgdir"
> + verbose "$PKGNAME: OK"
> fi
> - if is_binary_available $PKGNAME ;then
> - msg_n " (binary package available)"
> - fi
> - msg
> else
> if [ -n "$opt_B" ];then
> # sort here temporarily to handle older +BUILD_VERSION
> @@ -282,6 +287,8 @@
>
> list_bin_pkgs ()
> {
> + # XXX ls -t is usually enough to get newer packages first, but it
> + # depends on how files appeared in the $PACKAGES - beware
> ls -t $PACKAGES | grep "$PKG_SUFX_RE"'$' | ${SED} "s|^|$PACKAGES/|"
> }
>
> ^--- <don't miss the empty line with single space here>
>
> --
> Cheers,
> Mishka.
Home |
Main Index |
Thread Index |
Old Index