Author: bdrewery (ports committer)
Date: Thu Oct 24 10:49:55 2013
New Revision: 257051
URL: http://svnweb.freebsd.org/changeset/base/257051

Log:
  Add support for using "pkg+http://"; for the PACKAGESITE.
  
  pkg 1.2 is adding this support as well. This should help
  lessen the confusion on why the default SRV PACKAGESITE
  does not load in a browser.
  
  Adapated from:        matthew's upstream pkg change
  Approved by:  bapt
  MFC after:    2 days

Modified:
  head/usr.sbin/pkg/config.c
  head/usr.sbin/pkg/config.h
  head/usr.sbin/pkg/pkg.c

Modified: head/usr.sbin/pkg/config.c
==============================================================================
--- head/usr.sbin/pkg/config.c  Thu Oct 24 10:34:13 2013        (r257050)
+++ head/usr.sbin/pkg/config.c  Thu Oct 24 10:49:55 2013        (r257051)
@@ -62,7 +62,7 @@ static struct config_entry c[] = {
        [PACKAGESITE] = {
                PKG_CONFIG_STRING,
                "PACKAGESITE",
-               "http://pkg.FreeBSD.org/${ABI}/latest";,
+               URL_SCHEME_PREFIX "http://pkg.FreeBSD.org/${ABI}/latest";,
                NULL,
                false,
        },

Modified: head/usr.sbin/pkg/config.h
==============================================================================
--- head/usr.sbin/pkg/config.h  Thu Oct 24 10:34:13 2013        (r257050)
+++ head/usr.sbin/pkg/config.h  Thu Oct 24 10:49:55 2013        (r257051)
@@ -30,6 +30,7 @@
 #define _PKG_CONFIG_H
 
 #define _LOCALBASE "/usr/local"
+#define URL_SCHEME_PREFIX "pkg+"
 
 typedef enum {
        PACKAGESITE = 0,

Modified: head/usr.sbin/pkg/pkg.c
==============================================================================
--- head/usr.sbin/pkg/pkg.c     Thu Oct 24 10:34:13 2013        (r257050)
+++ head/usr.sbin/pkg/pkg.c     Thu Oct 24 10:49:55 2013        (r257051)
@@ -168,6 +168,13 @@ bootstrap_pkg(void)
                warnx("No MIRROR_TYPE defined");
                return (-1);
        }
+
+       /* Support pkg+http:// for PACKAGESITE which is the new format
+          in 1.2 to avoid confusion on why http://pkg.FreeBSD.org has
+          no A record. */
+       if (strncmp(URL_SCHEME_PREFIX, packagesite,
+           strlen(URL_SCHEME_PREFIX)) == 0)
+               packagesite += strlen(URL_SCHEME_PREFIX);
        snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite);
 
        snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX",
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to