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 [EMAIL PROTECTED]; 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 [EMAIL PROTECTED]; 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 [EMAIL PROTECTED]; 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"
 
_______________________________________________
crux-devel mailing list
[email protected]
http://lists.crux.nu/mailman/listinfo/crux-devel

Reply via email to