pkgmk source verification is not always needed
Hi, I keep my old laptop by installing packages manually instead of building it, I ear about pkg-get but in the practice I can do whatever it does by using prt-get and configuring PKGMK_PACKAGE_DIR variable in pkgmk.conf. However after playing a bit, see that pkgmk does something odd: bash-3.2# cd /usr/ports/core/autoconf bash-3.2# grep PKGMK_PACKAGE_DIR /etc/pkgmk.conf PKGMK_PACKAGE_DIR="/usr/pkg" bash-3.2# pkgmk -utd -cf /etc/pkgmk.conf =======> Package '/usr/pkg/autoconf#2.62-1.pkg.tar.gz' is not up to date. bash-3.2# file /usr/pkg/pkg-get#0.4.5-2.pkg.tar.gz /usr/pkg/pkg-get#0.4.5-2.pkg.tar.gz: gzip compressed data, from Unix, last modified: Sat Jun 7 00:46:33 2008 bash-3.2# bash -x /usr/bin/pkgmk -utd -cf /etc/pkgmk.conf 2>&1 | tail -10 ++ '[' '!' -e Pkgfile ']' ++ '[' '!' /usr/pkg/autoconf#2.62-1.pkg.tar.gz -nt Pkgfile ']' ++ RESULT=yes ++ break ++ echo yes + '[' yes = yes ']' + info 'Package '\''/usr/pkg/autoconf#2.62-1.pkg.tar.gz'\'' is not up to date.' + echo '=======> Package '\''/usr/pkg/autoconf#2.62-1.pkg.tar.gz'\'' is not up to date.' =======> Package '/usr/pkg/autoconf#2.62-1.pkg.tar.gz' is not up to date. + exit 0 It tries to check if the package is newer than the Pkgfile (test FILE1 -nt FILE2), so it breaks and returns yes as result for `build_needed`. Here is a piece of `build_needed` function: [...] RESULT="no" for FILE in $PKGMK_PKGFILE ${source[@]}; do FILE=`get_filename $FILE` if [ ! -e $FILE ] || [ ! $TARGET -nt $FILE ]; then RESULT="yes" break [...] After 'touch' the package it should do the trick, but also the problem appears and seems that I need all sources for checking if package is up to date. IMO it shouldn't be the default action to take, and maybe by would be better a switch option. I attached a patch with my idea. I prefer to comment this improvement before reporting it in FS, what are your opinions? Best regards, Jose V Beneyto diff --git a/scripts/pkgmk.in b/scripts/pkgmk.in index 9b193bb..42b7f11 100755 --- a/scripts/pkgmk.in +++ b/scripts/pkgmk.in @@ -466,13 +466,16 @@ build_needed() { RESULT="yes" if [ -f $TARGET ]; then RESULT="no" - for FILE in $PKGMK_PKGFILE ${source[@]}; do - FILE=`get_filename $FILE` - if [ ! -e $FILE ] || [ ! $TARGET -nt $FILE ]; then - RESULT="yes" - break - fi - done + [ ! $TARGET -nt $PKGMK_PKGFILE ] && RESULT="yes" + if [ "$PKGMK_CHECK_SOURCES" != "no" ]; then + for FILE in ${source[@]}; do + FILE=`get_filename $FILE` + if [ ! -e $FILE ] || [ ! $TARGET -nt $FILE ]; then + RESULT="yes" + break + fi + done + fi fi echo $RESULT @@ -503,6 +506,7 @@ print_help() { echo " -um, --update-md5sum update md5sum" echo " -im, --ignore-md5sum build package without checking md5sum" echo " -cm, --check-md5sum do not build, only check md5sum" + echo " -cs, --check-sources do not build without having sources" echo " -ns, --no-strip do not strip executable binaries or libraries" echo " -f, --force build package even if it appears to be up to date" echo " -c, --clean remove package and downloaded files" @@ -538,6 +542,8 @@ parse_options() { PKGMK_IGNORE_MD5SUM="yes" ;; -cm|--check-md5sum) PKGMK_CHECK_MD5SUM="yes" ;; + -cs|--check-sources) + PKGMK_CHECK_SOURCES="yes" ;; -ns|--no-strip) PKGMK_NO_STRIP="yes" ;; -f|--force) @@ -669,6 +675,7 @@ PKGMK_KEEP_WORK="no" PKGMK_UPDATE_MD5SUM="no" PKGMK_IGNORE_MD5SUM="no" PKGMK_CHECK_MD5SUM="no" +PKGMK_CHECK_SOURCES="no" PKGMK_NO_STRIP="no" PKGMK_CLEAN="no"
Jose V Beneyto [2008-06-07 02:37]:
I keep my old laptop by installing packages manually instead of building it, I ear about pkg-get but in the practice I can do whatever it does by using prt-get and configuring PKGMK_PACKAGE_DIR variable in pkgmk.conf. However after playing a bit, see that pkgmk does something odd:
Teaching pkgmk not try to making anything seems a bit odd. I think I'd rather patch prt-get to call pkgadd directly instead of whatever it does atm :] Regards, Tilman -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
After 'touch' the package it should do the trick, but also the problem appears and seems that I need all sources for checking if package is up to date. IMO it shouldn't be the default action to take, and maybe by would be better a switch option. I attached a patch with my idea. That doesn't really make sense to me. If you change a patch and run
Hi, On Sat, Jun 07, 2008 at 02:37:55 +0200, Jose V Beneyto wrote: [...] pkgmk, it should really rebuild the package without any special arguments. Another thing that this would break is when we get reports that the md5sum changed of an existing tarball. If I redownload the source, it should really also rebuild the source IMO. This is probably a corner case though. pkgmk is a tool to build packages from source. Adding additional code to handle cases where no source is available doesn't make sense to me. Johannes -- Johannes Winkelmann mailto:jw@smts.ch Zurich, Switzerland http://jw.smts.ch
On Sat, 07 Jun 2008 02:37:55 +0200 Jose V Beneyto <sepen@users.sourceforge.net> wrote:
Hi,
I keep my old laptop by installing packages manually instead of building it, I ear about pkg-get but in the practice I can do whatever it does by using prt-get and configuring PKGMK_PACKAGE_DIR variable in pkgmk.conf. However after playing a bit, see that pkgmk does something odd:
If all you want to do is gracefully prevent packages from being built, this is what I do on my underpowered laptop using and NFS shared PKGMK_PACKAGE_DIR, prt-get sysup --config-append="addcommand true" -- Lucas Hazel <lucas@die.net.au>
participants (4)
-
Johannes Winkelmann
-
Jose V Beneyto
-
Lucas Hazel
-
Tilman Sauerbeck