On Mon, Jul 19, 2004 at 12:09:53AM -0700, Kris Kennaway wrote:
> On Mon, Jul 19, 2004 at 12:22:21AM -0600, Travis Poppe wrote:

> For i386 they're updated every week or so, sometimes more frequently.
> 
> > Are these new
> > packages that are being rebuilt automatically defaulted to by pkg_add -r? 
> 
> If you're using -STABLE or -CURRENT, yes.  -RELEASE gets package sets
> produced at the time of release, which means they are unchanging.

However packages for 4.10-STABLE should work on a 4.10-RELEASE box.
It seems odd to me that there's no way of overriding the logic in
'pkg_add -r' that chooses the subdirectory of the FTP sites to search
for packages.  Before I go and try and chip some of the rust off my C
programming skills, how does this sound:

Add another environment variable 'PACKAGECOLLECTION' that pkg_add(1)
refers to.  This should be set to the name of one of the
subdirectories under

    ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/

(Or whatever architecture is appropriate). Values might be:

    packages-4-stable
    packages-5.2.1-release
    packages-current

In fact, wotthehell: takes more time to describe than to do.  Here's
the patch to usr.sbin/pkg_install/add/main.c:

--- main.c.orig Mon Jul 19 10:31:16 2004
+++ main.c      Mon Jul 19 10:46:17 2004
@@ -256,13 +256,20 @@
     if (strlcat(sitepath, u.machine, sizeof(sitepath)) >= sizeof(sitepath))
        return NULL;
 
-    reldate = getosreldate();
-    for(i = 0; releases[i].directory != NULL; i++) {
-       if (reldate >= releases[i].lowver && reldate <= releases[i].hiver) {
-           if (strlcat(sitepath, releases[i].directory, sizeof(sitepath))
-               >= sizeof(sitepath))
-               return NULL;
-           break;
+    if (getenv("PACKAGECOLLECTION")) {
+       if (strlcat(sitepath, "/", sizeof(sitepath)) >= sizeof(sitepath) ||
+           strlcat(sitepath, getenv("PACKAGECOLLECTION"), sizeof(sitepath))
+           >= sizeof(sitepath))
+           return NULL;
+    } else {
+       reldate = getosreldate();
+       for(i = 0; releases[i].directory != NULL; i++) {
+           if (reldate >= releases[i].lowver && reldate <= releases[i].hiver) {
+               if (strlcat(sitepath, releases[i].directory, sizeof(sitepath))
+                   >= sizeof(sitepath))
+                   return NULL;
+               break;
+           }
        }
     }
 
On this 4.10-STABLE system that gives this effect:

    % env PACKAGECOLLECTION=packages-4.10-release pkg_add -n -v -r cvsup-without-gui
    looking up ftp.freebsd.org
    connecting to ftp.freebsd.org:21
    setting passive mode
    opening data connection
    initiating transfer
    Fetching 
ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-4.10-release/Latest/cvsup-without-gui.tgz...+CONTENTS
    +COMMENT
    +DESC
    +MTREE_DIRS
    man/man1/cvpasswd.1.gz
    man/man1/cvsup.1.gz
    man/man8/cvsupd.8.gz
    bin/cvpasswd
    bin/cvsup
    sbin/cvsupd
    share/cvsup/License
    tar command returns 0 status
     Done.


        Cheers,

        Matthew



-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

Attachment: pgpKKuV8McnGQ.pgp
Description: PGP signature

Reply via email to