Re: pkgng suggestion: renaming /usr/sbin/pkg to /usr/sbin/pkg-bootstrap

From: Garrett Cooper <yanegomi_at_gmail.com>
Date: Sun, 26 Aug 2012 16:09:34 -0700 (PDT)
On Sun, 26 Aug 2012, Doug Barton wrote:

...

> There really is no need to be so clever here. The bootstrapping issue is
> going to be a minor annoyance that affects a small percentage of our users.

 	I think Doug's correct in this case about it being a "one-time 
problem" as installing via bsdinstall, etc should take care of this (I 
disagree with the "small percentage of our users" part though). There's 
still a chicken and egg problem with installing packaging via bsdinstall, 
etc though, as ports requires pkg* in order to function; I really hope 
that some of the naysayers have considered this "minor" issue as this 
would be a stop-gap to removing pkg(8) from base.
 	Rather than providing a solution for that problem because that's a 
bigger architectural issue (and not my job to solve), I offer this patch I 
quickly hacked up instead as my 2 cents for the discussion on how to make 
users aware that pkg_install is dying/dead, as this is one case that 
needs to be better handled.
Thanks,
-Garrett

PS It's really sad that no one really has been updating UPDATING in either 
ports or src, as I think this would help alleviate the need for 
unnecessary obfuscation.


Index: UPDATING
===================================================================
--- UPDATING	(revision 239716)
+++ UPDATING	(working copy)
_at__at_ -24,6 +24,10 _at__at_
  	disable the most expensive debugging functionality run
  	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)

+2014XXXX:
+	pkg_install has been replaced with pkgng; please see webpage
+	XXX/install port YYY for more details.
+
  20120727:
  	The sparc64 ZFS loader has been changed to no longer try to auto-
  	detect ZFS providers based on diskN aliases but now requires these
Index: usr.sbin/pkg_install/version/main.c
===================================================================
--- usr.sbin/pkg_install/version/main.c	(revision 239290)
+++ usr.sbin/pkg_install/version/main.c	(working copy)
_at__at_ -123,6 +123,8 _at__at_
      argc -= optind;
      argv += optind;

+    PKG_PORTS_MSG();
+
      return pkg_perform(argv);
  }

Index: usr.sbin/pkg_install/add/main.c
===================================================================
--- usr.sbin/pkg_install/add/main.c	(revision 239290)
+++ usr.sbin/pkg_install/add/main.c	(working copy)
_at__at_ -215,6 +215,8 _at__at_
      argc -= optind;
      argv += optind;

+    PKG_PORTS_MSG();
+
      if (AddMode != SLAVE) {
  	pkgs = (char **)malloc((argc+1) * sizeof(char *));
  	for (ch = 0; ch <= argc; pkgs[ch++] = NULL) ;
Index: usr.sbin/pkg_install/info/main.c
===================================================================
--- usr.sbin/pkg_install/info/main.c	(revision 239290)
+++ usr.sbin/pkg_install/info/main.c	(working copy)
_at__at_ -238,6 +238,8 _at__at_
      argc -= optind;
      argv += optind;

+    PKG_PORTS_MSG();
+
      if (Flags & SHOW_PTREV) {
  	if (!Quiet)
  	    printf("Package tools revision: ");
Index: usr.sbin/pkg_install/delete/main.c
===================================================================
--- usr.sbin/pkg_install/delete/main.c	(revision 239290)
+++ usr.sbin/pkg_install/delete/main.c	(working copy)
_at__at_ -128,6 +128,8 _at__at_
      argc -= optind;
      argv += optind;

+    PKG_PORTS_MSG();
+
      /* Get all the remaining package names, if any */
      while (*argv) {
  	/* Don't try to apply heuristics if arguments are regexs */
Index: usr.sbin/pkg_install/create/main.c
===================================================================
--- usr.sbin/pkg_install/create/main.c	(revision 239290)
+++ usr.sbin/pkg_install/create/main.c	(working copy)
_at__at_ -229,6 +229,8 _at__at_
      argc -= optind;
      argv += optind;

+    PKG_PORTS_MSG();
+
      /* Get all the remaining package names, if any */
      while (*argv)
  	*pkgs++ = *argv++;
Index: usr.sbin/pkg_install/lib/lib.h
===================================================================
--- usr.sbin/pkg_install/lib/lib.h	(revision 239290)
+++ usr.sbin/pkg_install/lib/lib.h	(working copy)
_at__at_ -31,6 +31,7 _at__at_
  #include <sys/utsname.h>
  #include <ctype.h>
  #include <dirent.h>
+#include <err.h>
  #include <stdarg.h>
  #include <stdio.h>
  #include <stdlib.h>
_at__at_ -239,4 +240,33 _at__at_
  extern int	AutoAnswer;
  extern int	Verbose;

+#define	EOL_VERSION	11000000
+
+#define	PKG_INSTALL_DEPRECATION_MSG	\
+	"pkg_install has been deprecated in favor of pkgng; please see UPDATING for more details"
+
+#if __FreeBSD_version > EOL_VERSION
+
+#define PKG_PORTS_MSG() \
+do { \
+	if (Quiet) { \
+		exit(1); \
+	} else { \
+		warnx(PKG_INSTALL_DEPECATION_MSG); \
+	} \
+} while (0) 
+
+#else
+
+#define PKG_PORTS_MSG() \
+do { \
+	if (Quiet) { \
+		exit(1); \
+	} else { \
+		errx(1, PKG_INSTALL_DEPRECATION_MSG); \
+	} \
+} while (0)
+
+#endif /* __FreeBSD_version > EOL_VERSION */
+
  #endif /* _INST_LIB_LIB_H_ */
Index: usr.sbin/pkg_install/updating/main.c
===================================================================
--- usr.sbin/pkg_install/updating/main.c	(revision 239290)
+++ usr.sbin/pkg_install/updating/main.c	(working copy)
_at__at_ -104,6 +104,8 _at__at_
  	argc -= optind;
  	argv += optind;

+	PKG_PORTS_MSG();
+
  	/* Check if passed date has a correct format. */
  	if (dflag == 1) {
  		linelength = strlen(date);
Received on Sun Aug 26 2012 - 21:13:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:30 UTC