From flz@xbsd.org  Thu Feb  3 23:47:31 2005
Return-Path: <flz@xbsd.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 261DA16A4CE; Thu,  3 Feb 2005 23:47:31 +0000 (GMT)
Received: from gate.xbsd.org (xbsd.org [82.233.2.192])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 16DF043D4C; Thu,  3 Feb 2005 23:47:30 +0000 (GMT)
	(envelope-from flz@xbsd.org)
Received: from localhost (localhost.xbsd.org [127.0.0.1])
	by gate.xbsd.org (Postfix) with ESMTP id 80B91119FD;
	Fri,  4 Feb 2005 00:49:33 +0100 (CET)
Received: from gate.xbsd.org ([127.0.0.1])
 by localhost (gate.xbsd.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 83592-09; Fri,  4 Feb 2005 00:49:26 +0100 (CET)
Received: by gate.xbsd.org (Postfix, from userid 2001)
	id F2FB0119F1; Fri,  4 Feb 2005 00:49:25 +0100 (CET)
Message-Id: <20050203234925.F2FB0119F1@gate.xbsd.org>
Date: Fri,  4 Feb 2005 00:49:25 +0100 (CET)
From: Florent Thoumie <flz@xbsd.org>
Reply-To: Florent Thoumie <flz@xbsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: hq@FreeBSD.org
Subject: src/usr.sbin/pkg_install - Add 3 new macros to clean pkg-plist
X-Send-Pr-Version: 3.113
X-GNATS-Notify: hq@FreeBSD.org

>Number:         77082
>Category:       bin
>Synopsis:       pkg_install(1) - Add 3 new macros to clean pkg-plist
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 03 23:50:20 GMT 2005
>Closed-Date:    Fri Apr 02 11:22:21 UTC 2010
>Last-Modified:  Fri Apr 02 11:22:21 UTC 2010
>Originator:     Florent Thoumie
>Release:        FreeBSD 5.3-RELEASE i386
>Organization:
Xbsd.org
>Environment:

System: FreeBSD gate.xbsd.org 5.3-RELEASE FreeBSD 5.3-RELEASE #2: Wed Nov 24 16:35:34 CET 2004 root@gate.xbsd.org:/usr/src/sys/i386/compile/GATE i386

>Description:

Rationale:

Packing lists are clobbered with lines like :

@exec [ ! -f %B/foo ] && cp %B/%f %B/foo
@unexec cmp -s %D/etc/foo %D/etc/foo-dist && rm %D/etc/foo
@unexec rmdir %D/share/foo 2> /dev/null || true

This patch introduces 3 new macros :

@dirrmie name : remove directory if empty, actually just don't bother with error messages
when trying to remove the directory.
@cpin name : copy if non-existent, copy name from name-dist if name doesn't exist yet.
@rmiu name : remove if unchanged, remove name if name and name-dist are no different.

A simple port is attached to test these new macros.

>How-To-Repeat:
	
>Fix:

	

--- pkg_install.diff begins here ---
diff -ruN src/usr.sbin/pkg_install/add/extract.c src/usr.sbin/pkg_install.new/add/extract.c
--- src/usr.sbin/pkg_install/add/extract.c	Wed Jul 28 09:19:15 2004
+++ src/usr.sbin/pkg_install.new/add/extract.c	Fri Feb  4 00:00:35 2005
@@ -137,6 +137,7 @@
     /* Do it */
     while (p) {
 	char cmd[FILENAME_MAX];
+	char tmp[FILENAME_MAX], tmp2[FILENAME_MAX];
 
 	switch(p->type) {
 	case PLIST_NAME:
@@ -266,6 +267,25 @@
 
 	case PLIST_IGNORE:
 	    p = p->next;
+	    break;
+
+	case PLIST_CPIN:
+	    sprintf(tmp, "%s/%s", Directory, p->name);
+	    sprintf(tmp2, "%s/%s-dist", Directory, p->name);
+	    PUSHOUT(Directory);
+	    if (!fexists(tmp2)) {
+		warnx("file '%s' does not exist!\n"
+	"this packing list is incorrect - ignoring delete request", tmp2);
+	    }
+	    else if (!fexists(tmp)) {
+		if (Verbose)
+		    printf("Installing '%s' in '%s' (non-existent)\n", tmp2, tmp);
+		if (!Fake && vsystem("cp %s %s", tmp2, tmp)) {
+		    errx(2, "%s: unable to copy '%s' to '%s'", __func__, p->name,
+			    tmp2, tmp);
+		}
+	    }
+	    last_file = p->name;
 	    break;
 
 	default:
diff -ruN src/usr.sbin/pkg_install/create/pkg_create.1 src/usr.sbin/pkg_install.new/create/pkg_create.1
--- src/usr.sbin/pkg_install/create/pkg_create.1	Sat Jul  3 01:12:52 2004
+++ src/usr.sbin/pkg_install.new/create/pkg_create.1	Fri Feb  4 00:00:35 2005
@@ -504,6 +504,29 @@
 The
 .Pa name
 directory will not be removed unless it is empty.
+.It Cm @dirrmie Ar name
+Same as
+.Cm @dirrm ,
+but there will be no error message nor warning if the directory is not
+empty.
+.It Cm @cpin Ar name
+Declare file
+.Pa name
+to be copied from file
+.Pa name-dist
+if it does not exist yet.
+.Cm @cpin
+stands for copy if non-existent.
+.It Cm @rmiu Ar name
+Declare file
+.Pa name
+to be deleted at deinstall time. Note that this file will only be deleted
+if it is the same file as
+.Pa name-dist.
+.Cm @rmiu
+(which stands for remove if unchanged) is intended to be used in conjonction
+with
+.Cm @cpin .
 .It Cm @mtree Ar name
 Declare
 .Pa name
diff -ruN src/usr.sbin/pkg_install/delete/pkg_delete.1 src/usr.sbin/pkg_install.new/delete/pkg_delete.1
--- src/usr.sbin/pkg_install/delete/pkg_delete.1	Sat Jul  3 01:12:52 2004
+++ src/usr.sbin/pkg_install.new/delete/pkg_delete.1	Fri Feb  4 00:00:35 2005
@@ -60,6 +60,9 @@
 .Cm @mode
 (check for setuid),
 .Cm @dirrm ,
+.Cm @dirrmie ,
+.Cm @cpin ,
+.Cm @rmiu ,
 .Cm @exec ,
 and
 .Cm @unexec
diff -ruN src/usr.sbin/pkg_install/info/show.c src/usr.sbin/pkg_install.new/info/show.c
--- src/usr.sbin/pkg_install/info/show.c	Mon May 26 19:06:05 2003
+++ src/usr.sbin/pkg_install.new/info/show.c	Fri Feb  4 00:00:35 2005
@@ -179,6 +179,18 @@
 	    printf(Quiet ? "@dirrm %s\n" : "\tDeinstall directory remove: %s\n", p->name);
 	    break;
 
+	case PLIST_DIR_RMIE:
+	    printf(Quiet ? "@dirrmie %s\n" : "\tDeinstall directory remove if empty: %s\n", p->name);
+	    break;
+
+	case PLIST_RMIU:
+	    printf(Quiet ? "@rmiu %s\n" : "\tFile (removed if unchanged): %s\n", p->name);
+	    break;
+
+	case PLIST_CPIN:
+	    printf(Quiet ? "@cpin %s\n" : "\tFile (copied if non-existent): %s\n", p->name);
+	    break;
+
 	case PLIST_OPTION:
 	    printf(Quiet ? "@option %s\n" :
 		"\tOption \"%s\" controlling package installation behaviour\n",
diff -ruN src/usr.sbin/pkg_install/lib/file.c src/usr.sbin/pkg_install.new/lib/file.c
--- src/usr.sbin/pkg_install/lib/file.c	Wed Jul 28 18:03:13 2004
+++ src/usr.sbin/pkg_install.new/lib/file.c	Fri Feb  4 00:00:35 2005
@@ -113,6 +113,20 @@
     return FALSE;
 }
 
+/*
+ * Returns 0 if the two files are the same, 1 if they are different and
+ * other values and another value if an error occured.
+ */
+int
+isdifferent(const char *fname, const char *sname)
+{
+    char cmd[FILENAME_MAX];
+    if (!fname || !sname)
+	return FALSE;
+    snprintf(cmd, FILENAME_MAX, "/usr/bin/cmp -s %s %s", fname, sname);
+    return vsystem(cmd);
+}
+
 /* Returns TRUE if file is a URL specification */
 Boolean
 isURL(const char *fname)
diff -ruN src/usr.sbin/pkg_install/lib/lib.h src/usr.sbin/pkg_install.new/lib/lib.h
--- src/usr.sbin/pkg_install/lib/lib.h	Tue Jan  4 17:18:55 2005
+++ src/usr.sbin/pkg_install.new/lib/lib.h	Fri Feb  4 00:07:09 2005
@@ -108,7 +108,8 @@
     PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE,
     PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY,
     PLIST_PKGDEP, PLIST_CONFLICTS, PLIST_MTREE, PLIST_DIR_RM, 
-    PLIST_IGNORE_INST, PLIST_OPTION, PLIST_ORIGIN, PLIST_DEPORIGIN
+    PLIST_DIR_RMIE, PLIST_RMIU, PLIST_CPIN, PLIST_IGNORE_INST,
+    PLIST_OPTION, PLIST_ORIGIN, PLIST_DEPORIGIN
 };
 typedef enum _plist_t plist_t;
 
@@ -170,6 +171,7 @@
 Boolean         isfile(const char *);
 Boolean		isempty(const char *);
 Boolean		issymlink(const char *);
+int		isdifferent(const char *, const char *);
 Boolean		isURL(const char *);
 char		*fileGetURL(const char *, const char *);
 char		*fileFindByPath(const char *, const char *);
diff -ruN src/usr.sbin/pkg_install/lib/plist.c src/usr.sbin/pkg_install.new/lib/plist.c
--- src/usr.sbin/pkg_install/lib/plist.c	Wed Jul 28 09:19:15 2004
+++ src/usr.sbin/pkg_install.new/lib/plist.c	Fri Feb  4 00:00:35 2005
@@ -247,6 +247,12 @@
 	return PLIST_MTREE;
     else if (!strcmp(cmd, "dirrm"))
 	return PLIST_DIR_RM;
+    else if (!strcmp(cmd, "dirrmie"))
+	return PLIST_DIR_RMIE;
+    else if (!strcmp(cmd, "rmiu"))
+	return PLIST_RMIU;
+    else if (!strcmp(cmd, "cpin"))
+	return PLIST_CPIN;
     else if (!strcmp(cmd, "option"))
 	return PLIST_OPTION;
     else
@@ -378,6 +384,18 @@
 	    fprintf(fp, "%cdirrm %s\n", CMD_CHAR, plist->name);
 	    break;
 
+	case PLIST_DIR_RMIE:
+	    fprintf(fp, "%cdirrmie %s\n", CMD_CHAR, plist->name);
+	    break;
+
+	case PLIST_RMIU:
+	    fprintf(fp, "%crmiu %s\n", CMD_CHAR, plist->name);
+	    break;
+
+	case PLIST_CPIN:
+	    fprintf(fp, "%ccpin %s\n", CMD_CHAR, plist->name);
+	    break;
+
 	case PLIST_OPTION:
 	    fprintf(fp, "%coption %s\n", CMD_CHAR, plist->name);
 	    break;
@@ -413,7 +431,7 @@
     const char *Where = ".", *last_file = "";
     Boolean fail = SUCCESS;
     Boolean preserve;
-    char tmp[FILENAME_MAX], *name = NULL;
+    char tmp[FILENAME_MAX], tmp2[FILENAME_MAX], *name = NULL;
 
     preserve = find_plist_option(pkg, "preserve") ? TRUE : FALSE;
     for (p = pkg->head; p; p = p->next) {
@@ -500,6 +518,7 @@
 	    break;
 
 	case PLIST_DIR_RM:
+	case PLIST_DIR_RMIE:
 	    sprintf(tmp, "%s/%s", Where, p->name);
 	    if (!isdir(tmp) && fexists(tmp)) {
 		warnx("cannot delete specified directory '%s' - it is a file!\n"
@@ -508,8 +527,26 @@
 	    else {
 		if (Verbose)
 		    printf("Delete directory %s\n", tmp);
-		if (!Fake && delete_hierarchy(tmp, ign_err, FALSE)) {
+		if (!Fake && delete_hierarchy(tmp, ign_err, FALSE) && p->type != PLIST_DIR_RMIE) {
 		    warnx("unable to completely remove directory '%s'", tmp);
+		    fail = FAIL;
+		}
+	    }
+	    last_file = p->name;
+	    break;
+
+	case PLIST_RMIU:
+	    sprintf(tmp, "%s/%s", Where, p->name);
+	    sprintf(tmp2, "%s/%s-dist", Where, p->name);
+	    if (!fexists(tmp) || !fexists(tmp2)) {
+		warnx("specified file '%s' or '%s' does not exist!\n"
+	"this packing list is incorrect - ignoring delete request", tmp, tmp2);
+	    }
+	    else if (!isdifferent(tmp, tmp2)) {
+		if (Verbose)
+		    printf("Delete file %s (unchanged)\n", tmp);
+		if (!Fake && vsystem("%s %s %s", REMOVE_CMD, (ign_err ? "-f" : ""), tmp)) {
+		    warnx("unable to remove file '%s'", tmp);
 		    fail = FAIL;
 		}
 	    }
--- pkg_install.diff ends here ---

--- dummy-1.0.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	dummy
#	dummy/Makefile
#	dummy/pkg-descr
#	dummy/pkg-plist
#
echo c - dummy
mkdir -p dummy > /dev/null 2>&1
echo x - dummy/Makefile
sed 's/^X//' >dummy/Makefile << 'END-of-dummy/Makefile'
XPORTNAME=	dummy
XPORTVERSION=	1.0
XCATEGORIES=	misc
XDISTFILES=	
X
XMAINTAINER=	ports@FreeBSD.org
XCOMMENT=	Dummy port
X
XNO_BUILD=	yes
X
Xdo-install:
X	${MKDIR} ${DATADIR}
X	${INSTALL_DATA} ${.CURDIR}/Makefile ${DATADIR}/Makefile-dist
X	[ ! -f ${DATADIR}/Makefile ] && ${INSTALL_DATA} ${.CURDIR}/Makefile ${DATADIR}/Makefile
X
X.include <bsd.port.mk>
END-of-dummy/Makefile
echo x - dummy/pkg-descr
sed 's/^X//' >dummy/pkg-descr << 'END-of-dummy/pkg-descr'
XThis is a dummy port, for testing purposes.
X
XWWW: http://www.freebsd.org/
X
X- Florent Thoumie
Xflz@xbsd.org
END-of-dummy/pkg-descr
echo x - dummy/pkg-plist
sed 's/^X//' >dummy/pkg-plist << 'END-of-dummy/pkg-plist'
X@rmiu %%DATADIR%%/Makefile
X%%DATADIR%%/Makefile-dist
X@cpin %%DATADIR%%/Makefile
X@dirrmie %%DATADIR%%
END-of-dummy/pkg-plist
exit
--- dummy-1.0.shar ends here ---


>Release-Note:
>Audit-Trail:

From: Florent Thoumie <flz@xbsd.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to clean
 pkg-plist
Date: Fri, 04 Feb 2005 09:01:16 +0100

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enigD9BEE41C74D2D9FE53AAE8AB
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 I was quite satisfied with this patch when i sent it, but i'm
 not anymore. I'll come up with a new patch soon containing some
 improvements.
 
 --------------enigD9BEE41C74D2D9FE53AAE8AB
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.0 (FreeBSD)
 Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
 iD8DBQFCAyvRMxEkbVFH3PQRAiQ+AKCQZ/QSnylnTW3UeYX3rMqFJWIXTwCeNJdx
 8dyVg4b8MIoQh6rkFLmQu38=
 =fBjE
 -----END PGP SIGNATURE-----
 
 --------------enigD9BEE41C74D2D9FE53AAE8AB--

From: Florent Thoumie <flz@xbsd.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc: hq@FreeBSD.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to clean
 pkg-plist
Date: Fri, 04 Feb 2005 16:58:34 +0100

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig94AF4F6B51667C03D3708100
 Content-Type: multipart/mixed;
  boundary="------------000308030407090406080400"
 
 This is a multi-part message in MIME format.
 --------------000308030407090406080400
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Here is a new version.
 
 I've renamed @dirrmie by @dirrmtry, which is more self-explanatory.
 
 @cpin and @rmiu have been replaced by @conf.
 
 @conf %%EXAMPLESDIR%%/etc/foo.conf etc/foo.conf
 
 is equivalent to :
 
 @unexec cmp -s %D/%%EXAMPLESDIR%%/etc/foo.conf %D/etc/foo.conf && rm -f %D/etc/foo.conf
 %%EXAMPLESDIR%%/etc/foo.conf
 @exec [ -f %B/foo.conf ] || cp %B/%f %B/foo.conf
 
 --------------000308030407090406080400
 Content-Type: text/plain;
  name="pkg_install-v2.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="pkg_install-v2.diff"
 
 diff -ruN pkg_install.orig/add/extract.c pkg_install/add/extract.c
 --- pkg_install.orig/add/extract.c	Wed Jul 28 09:19:15 2004
 +++ pkg_install/add/extract.c	Fri Feb  4 14:51:25 2005
 @@ -136,7 +136,8 @@
 
      /* Do it */
      while (p) {
 -	char cmd[FILENAME_MAX];
 +	char cmd[FILENAME_MAX], *name;
 +	char tmp[FILENAME_MAX], tmp2[FILENAME_MAX];
 
  	switch(p->type) {
  	case PLIST_NAME:
 @@ -145,6 +146,14 @@
  		printf("extract: Package name is %s\n", p->name);
  	    break;
 
 +	case PLIST_CONF:
 +	    if (!(name = strchr(p->name, ' ')))
 +	    {
 +		warnx("missing either configuration file name or instance name");
 +	    }
 +	    *name++ = '\0';
 +	    /* FALLTHROUGH */
 +
  	case PLIST_FILE:
  	    last_file = p->name;
  	    if (Verbose)
 @@ -209,6 +218,26 @@
  		    perm_count += add_count;
  		}
  	    }
 +
 +	    if (p->type != PLIST_CONF)
 +		break;
 +
 +	    sprintf(tmp, "%s/%s", Directory, name);
 +	    sprintf(tmp2, "%s/%s", Directory, p->name);
 +	    /*PUSHOUT(Directory);*/
 +	    if (!fexists(tmp2)) {
 +		warnx("file '%s' does not exist!\n"
 +	"this packing list is incorrect - ignoring instanciation request", tmp2);
 +	    }
 +	    else if (!fexists(tmp)) {
 +		if (Verbose)
 +		    printf("Installing '%s' in '%s' (non-existent)\n", tmp2, tmp);
 +		if (!Fake && vsystem("cp %s %s", tmp2, tmp)) {
 +		    errx(2, "%s: unable to copy '%s' to '%s'", __func__, p->name,
 +			    tmp2, tmp);
 +		}
 +	    }
 +	    last_file = p->name;
  	    break;
 
  	case PLIST_CWD:
 diff -ruN pkg_install.orig/create/perform.c pkg_install/create/perform.c
 --- pkg_install.orig/create/perform.c	Wed Jul 28 09:19:15 2004
 +++ pkg_install/create/perform.c	Fri Feb  4 15:47:36 2005
 @@ -310,6 +310,7 @@
      FILE *totar;
      pid_t pid;
      const char *cname;
 +    char *tmp;
 
      args[nargs++] = "tar";	/* argv[0] */
 
 @@ -393,6 +394,13 @@
      for (p = plist->head; p; p = p->next) {
  	if (p->type == PLIST_FILE)
  	    fprintf(totar, "%s\n", p->name);
 +	if (p->type == PLIST_CONF)
 +	{
 +	    tmp = strchr(p->name, ' ');
 +	    *tmp = '\0';
 +	    fprintf(totar, "%s\n", p->name);
 +	    *tmp = ' ';
 +	}
  	else if (p->type == PLIST_CWD && BaseDir && p->name && p->name[0] == '/')
  	    fprintf(totar, "-C\n%s%s\n", BaseDir, p->name);
  	else if (p->type == PLIST_CWD || p->type == PLIST_SRC)
 diff -ruN pkg_install.orig/create/pkg_create.1 pkg_install/create/pkg_create.1
 --- pkg_install.orig/create/pkg_create.1	Sat Jul  3 01:12:52 2004
 +++ pkg_install/create/pkg_create.1	Fri Feb  4 15:53:25 2005
 @@ -504,6 +504,21 @@
  The
  .Pa name
  directory will not be removed unless it is empty.
 +.It Cm @dirrmtry Ar name
 +Same as
 +.Cm @dirrm ,
 +but there will be no error message nor warning if the directory is not
 +empty.
 +.It Cm @conf Ar name Ar instance
 +Declare file
 +.Pa name
 +to be considered as a sample configuration file. At install time,
 +.Pa instance
 +is copied from
 +.Pa name
 +if it does not exist yet.
 +.Pa instance
 +will be also removed at deinstall time if it has not changed.
  .It Cm @mtree Ar name
  Declare
  .Pa name
 diff -ruN pkg_install.orig/create/pl.c pkg_install/create/pl.c
 --- pkg_install.orig/create/pl.c	Tue Jun 29 21:06:41 2004
 +++ pkg_install/create/pl.c	Fri Feb  4 15:40:43 2005
 @@ -65,6 +65,7 @@
      const char *there = NULL;
      char name[FILENAME_MAX];
      PackingList p;
 +    char *tmp = NULL;
 
      for (p = pkg->head; p != NULL; p = p->next)
  	switch (p->type) {
 @@ -80,12 +81,19 @@
  	    there = p->name;
  	    break;
 
 +	case PLIST_CONF:
  	case PLIST_FILE:
 +	    if (p->type == PLIST_CONF && (tmp = strchr(p->name, ' ')))
 +		*tmp = '\0';
 +		
 +	    else tmp = p->name;
  	    if (there)
  		snprintf(name, sizeof(name), "%s/%s", there, p->name);
  	    else
  		snprintf(name, sizeof(name), "%s%s/%s",
  		    BaseDir && where && where[0] == '/' ? BaseDir : "", where, p->name);
 +	    if (p->type == PLIST_CONF && tmp)
 +		*tmp = ' ';
 
  	    add_cksum(pkg, p, name);
  	    break;
 diff -ruN pkg_install.orig/delete/pkg_delete.1 pkg_install/delete/pkg_delete.1
 --- pkg_install.orig/delete/pkg_delete.1	Sat Jul  3 01:12:52 2004
 +++ pkg_install/delete/pkg_delete.1	Fri Feb  4 15:53:51 2005
 @@ -60,6 +60,8 @@
  .Cm @mode
  (check for setuid),
  .Cm @dirrm ,
 +.Cm @dirrmtry ,
 +.Cm @conf ,
  .Cm @exec ,
  and
  .Cm @unexec
 diff -ruN pkg_install.orig/info/show.c pkg_install/info/show.c
 --- pkg_install.orig/info/show.c	Mon May 26 19:06:05 2003
 +++ pkg_install/info/show.c	Fri Feb  4 15:54:33 2005
 @@ -179,6 +179,14 @@
  	    printf(Quiet ? "@dirrm %s\n" : "\tDeinstall directory remove: %s\n", p->name);
  	    break;
 
 +	case PLIST_DIR_RM_TRY:
 +	    printf(Quiet ? "@dirrmtry %s\n" : "\tDeinstall directory remove (don't issue warning): %s\n", p->name);
 +	    break;
 +
 +	case PLIST_CONF:
 +	    printf(Quiet ? "@conf %s\n" : "\tConfiguration file (and instance if non-existent): %s\n", p->name);
 +	    break;
 +
  	case PLIST_OPTION:
  	    printf(Quiet ? "@option %s\n" :
  		"\tOption \"%s\" controlling package installation behaviour\n",
 diff -ruN pkg_install.orig/lib/lib.h pkg_install/lib/lib.h
 --- pkg_install.orig/lib/lib.h	Tue Jan  4 17:18:55 2005
 +++ pkg_install/lib/lib.h	Fri Feb  4 15:56:26 2005
 @@ -108,7 +108,8 @@
      PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE,
      PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY,
      PLIST_PKGDEP, PLIST_CONFLICTS, PLIST_MTREE, PLIST_DIR_RM,
 -    PLIST_IGNORE_INST, PLIST_OPTION, PLIST_ORIGIN, PLIST_DEPORIGIN
 +    PLIST_DIR_RM_TRY, PLIST_CONF, PLIST_IGNORE_INST, PLIST_OPTION,
 +    PLIST_ORIGIN, PLIST_DEPORIGIN
  };
  typedef enum _plist_t plist_t;
 
 diff -ruN pkg_install.orig/lib/plist.c pkg_install/lib/plist.c
 --- pkg_install.orig/lib/plist.c	Wed Jul 28 09:19:15 2004
 +++ pkg_install/lib/plist.c	Fri Feb  4 15:43:33 2005
 @@ -247,6 +247,10 @@
  	return PLIST_MTREE;
      else if (!strcmp(cmd, "dirrm"))
  	return PLIST_DIR_RM;
 +    else if (!strcmp(cmd, "dirrmtry"))
 +	return PLIST_DIR_RM_TRY;
 +    else if (!strcmp(cmd, "conf"))
 +	return PLIST_CONF;
      else if (!strcmp(cmd, "option"))
  	return PLIST_OPTION;
      else
 @@ -378,6 +382,14 @@
  	    fprintf(fp, "%cdirrm %s\n", CMD_CHAR, plist->name);
  	    break;
 
 +	case PLIST_DIR_RM_TRY:
 +	    fprintf(fp, "%cdirrmtry %s\n", CMD_CHAR, plist->name);
 +	    break;
 +
 +	case PLIST_CONF:
 +	    fprintf(fp, "%cconf %s\n", CMD_CHAR, plist->name);
 +	    break;
 +
  	case PLIST_OPTION:
  	    fprintf(fp, "%coption %s\n", CMD_CHAR, plist->name);
  	    break;
 @@ -413,7 +425,7 @@
      const char *Where = ".", *last_file = "";
      Boolean fail = SUCCESS;
      Boolean preserve;
 -    char tmp[FILENAME_MAX], *name = NULL;
 +    char tmp[FILENAME_MAX], tmp2[FILENAME_MAX], *name = NULL;
 
      preserve = find_plist_option(pkg, "preserve") ? TRUE : FALSE;
      for (p = pkg->head; p; p = p->next) {
 @@ -442,6 +454,38 @@
  	    }
  	    break;
 
 +	case PLIST_CONF:
 +	    if (!(name = strchr(p->name, ' ')))
 +	    {
 +		warnx("missing either configuration file name or instance name");
 +		fail = FAIL;
 +	    }
 +	    *name++ = '\0';
 +	    sprintf(tmp, "%s/%s", Where, name);
 +	    sprintf(tmp2, "%s/%s", Where, p->name);
 +	    if (!fexists(tmp) || !fexists(tmp2)) {
 +		warnx("specified file '%s' or '%s' does not exist!\n"
 +	"this packing list is incorrect - ignoring delete request", tmp, tmp2);
 +	    }
 +	    else if (p->next && p->next->type == PLIST_COMMENT && !strncmp(p->next->name, "MD5:", 4)) {
 +	     	char *cp = NULL, buf[33];
 +		cp = MD5File(tmp, buf);
 +
 +	    	if (cp != NULL) {
 +		    /* Mismatch? */
 +	    	    if (!strcmp(cp, p->next->name + 4)) {
 +	
 +			if (Verbose)
 +			    printf("Delete file %s (unchanged)\n", tmp);
 +			if (!Fake && vsystem("%s %s %s", REMOVE_CMD, (ign_err ? "-f" : ""), tmp)) {
 +			    warnx("unable to remove file '%s'", tmp);
 +			    fail = FAIL;
 +			}
 +		    }
 +		}
 +	    }
 +	    /* FALLTHROUGH */
 +
  	case PLIST_FILE:
  	    last_file = p->name;
  	    sprintf(tmp, "%s/%s", Where, p->name);
 @@ -500,6 +544,7 @@
  	    break;
 
  	case PLIST_DIR_RM:
 +	case PLIST_DIR_RM_TRY:
  	    sprintf(tmp, "%s/%s", Where, p->name);
  	    if (!isdir(tmp) && fexists(tmp)) {
  		warnx("cannot delete specified directory '%s' - it is a file!\n"
 @@ -508,7 +553,7 @@
  	    else {
  		if (Verbose)
  		    printf("Delete directory %s\n", tmp);
 -		if (!Fake && delete_hierarchy(tmp, ign_err, FALSE)) {
 +		if (!Fake && delete_hierarchy(tmp, ign_err, FALSE) && p->type != PLIST_DIR_RM_TRY) {
  		    warnx("unable to completely remove directory '%s'", tmp);
  		    fail = FAIL;
  		}
 
 --------------000308030407090406080400
 Content-Type: text/plain;
  name="dummy-1.1.shar"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="dummy-1.1.shar"
 
 # This is a shell archive.  Save it in a file, remove anything before
 # this line, and then unpack it by entering "sh file".  Note, it may
 # create directories; files and directories will be owned by you and
 # have default permissions.
 #
 # This archive contains:
 #
 #	dummy
 #	dummy/Makefile
 #	dummy/pkg-descr
 #	dummy/pkg-plist
 #
 echo c - dummy
 mkdir -p dummy > /dev/null 2>&1
 echo x - dummy/Makefile
 sed 's/^X//' >dummy/Makefile << 'END-of-dummy/Makefile'
 XPORTNAME=	dummy
 XPORTVERSION=	1.1
 XCATEGORIES=	misc
 XDISTFILES=	
 X
 XMAINTAINER=	ports@FreeBSD.org
 XCOMMENT=	Dummy port
 X
 XCONFDIR=	${EXAMPLESDIR}/etc
 XNO_BUILD=	yes
 X
 Xdo-install:
 X	${MKDIR} ${CONFDIR}
 X	${INSTALL_DATA} ${.CURDIR}/Makefile ${CONFDIR}/Makefile
 X	[ ! -f ${PREFIX}/etc/Makefile ] || ${INSTALL_DATA} ${.CURDIR}/Makefile ${PREFIX}/etc/Makefile
 X
 X.include <bsd.port.mk>
 END-of-dummy/Makefile
 echo x - dummy/pkg-descr
 sed 's/^X//' >dummy/pkg-descr << 'END-of-dummy/pkg-descr'
 XThis is a dummy port, for testing purposes.
 X
 XWWW: http://www.freebsd.org/
 X
 X- Florent Thoumie
 Xflz@xbsd.org
 END-of-dummy/pkg-descr
 echo x - dummy/pkg-plist
 sed 's/^X//' >dummy/pkg-plist << 'END-of-dummy/pkg-plist'
 X@conf %%EXAMPLESDIR%%/etc/Makefile etc/Makefile
 X@dirrmtry %%EXAMPLESDIR%%/etc
 X@dirrmtry %%EXAMPLESDIR%%
 END-of-dummy/pkg-plist
 exit
 
 
 --------------000308030407090406080400--
 
 --------------enig94AF4F6B51667C03D3708100
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.0 (FreeBSD)
 Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
 iD8DBQFCA5uwMxEkbVFH3PQRAimcAJ0ZWjDBlTMBW+td95vuqyi+LuPDrwCgjWBO
 thN0YQY/jXX7OCdSFJgXmC8=
 =xpXp
 -----END PGP SIGNATURE-----
 
 --------------enig94AF4F6B51667C03D3708100--

From: Brooks Davis <brooks@one-eyed-alien.net>
To: Florent Thoumie <flz@xbsd.org>
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org,
	hq@freebsd.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to clean pkg-plist
Date: Fri, 4 Feb 2005 10:35:46 -0800

 On Fri, Feb 04, 2005 at 04:58:34PM +0100, Florent Thoumie wrote:
 > Here is a new version.
 > 
 > I've renamed @dirrmie by @dirrmtry, which is more self-explanatory.
 
 It seems like dirrmtry should take an optional message to emit if the
 event that the directory can not be delete.  That way the user can be
 informed that the directory should be removed if they are really done
 using the port.
 
 > @cpin and @rmiu have been replaced by @conf.
 > 
 > @conf %%EXAMPLESDIR%%/etc/foo.conf etc/foo.conf
 > 
 > is equivalent to :
 > 
 > @unexec cmp -s %D/%%EXAMPLESDIR%%/etc/foo.conf %D/etc/foo.conf && rm -f 
 > %D/etc/foo.conf
 > %%EXAMPLESDIR%%/etc/foo.conf
 > @exec [ -f %B/foo.conf ] || cp %B/%f %B/foo.conf
 
 Excellent.
 
 Have you thought about how to solve the boot strapping problems with
 pkg_install/pkg_delete?  Our nominal pkg_install maintainer is MIA at
 the moment.
 
 -- Brooks

From: Florent Thoumie <flz@xbsd.org>
To: Brooks Davis <brooks@one-eyed-alien.net>
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org,
	hq@freebsd.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to clean
 pkg-plist
Date: Fri, 04 Feb 2005 19:41:29 +0100

 Brooks Davis wrote:
 
 > It seems like dirrmtry should take an optional message to emit if the
 > event that the directory can not be delete.  That way the user can be
 > informed that the directory should be removed if they are really done
 > using the port.
 
 	I asked myself if I should put this feature in my patch and
 	I finally haven't because it required some extra-stuff
 	(handling optional arguments for @ commands is painful), and a
 	simple '@unexec [ -d ${PREFIX}/etc ] && echo ...' is easier I
 	guess. But that's no problem for me to include that if everybody
 	thinks it worth it.
 
 > Have you thought about how to solve the boot strapping problems with
 > pkg_install/pkg_delete?
 
 	I have absolutely no idea what you're talking about, I started
 	looking at pkg_install source yesterday at night. Could you
 	give me some pointers about that ?
 
 > Our nominal pkg_install maintainer is MIA at the moment.
 
 	Ok, actually I knew eik has been working on it, but I didn't
 	know who was the active maintainer now.
 
 	I have thought of a new purge command, that would act like
 	dpkg --purge on Debian but AFAIK that would be impossible
 	since it would need persistent package records (that still
 	exists after a package has been removed as long as we have
 	some configuration files for this port in the tree).
 
 -- 
 Florent Thoumie
 flz@xbsd.org

From: Brooks Davis <brooks@one-eyed-alien.net>
To: Florent Thoumie <flz@xbsd.org>
Cc: Brooks Davis <brooks@one-eyed-alien.net>,
	FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org,
	hq@freebsd.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to clean pkg-plist
Date: Fri, 4 Feb 2005 11:04:57 -0800

 On Fri, Feb 04, 2005 at 07:41:29PM +0100, Florent Thoumie wrote:
 > Brooks Davis wrote:
 > 
 > >It seems like dirrmtry should take an optional message to emit if the
 > >event that the directory can not be delete.  That way the user can be
 > >informed that the directory should be removed if they are really done
 > >using the port.
 > 
 > 	I asked myself if I should put this feature in my patch and
 > 	I finally haven't because it required some extra-stuff
 > 	(handling optional arguments for @ commands is painful), and a
 > 	simple '@unexec [ -d ${PREFIX}/etc ] && echo ...' is easier I
 > 	guess. But that's no problem for me to include that if everybody
 > 	thinks it worth it.
 
 Given this workaround, it's probably not a high priority to add this.
 Hmm, what about a seperate @echoifexists or similar command?
 
 > >Have you thought about how to solve the boot strapping problems with
 > >pkg_install/pkg_delete?
 > 
 > 	I have absolutely no idea what you're talking about, I started
 > 	looking at pkg_install source yesterday at night. Could you
 > 	give me some pointers about that ?
 
 The issue is that you need to find a way to keep users from installing
 packages they can't uninstall.  If you add new commands and they are
 used in ports, users with older systems won't have the necessicary
 pkg_delete commands to make them work.  The current system doens't even
 give a graceful way of detecting this condition both in the port and
 when the users installs a pkg from the -stable collections online.
 Longer term, we need some versioning in the plist and ports, but first
 we've got to solve the problem we're stuck with now.
 
 > >Our nominal pkg_install maintainer is MIA at the moment.
 > 
 > 	Ok, actually I knew eik has been working on it, but I didn't
 > 	know who was the active maintainer now.
 
 Last I heard, eik was the one working it, but no one has heard from him
 in a while.  He's been gone long enough that someone else could
 certaintly commit to pkg_install given public review.
 
 > 	I have thought of a new purge command, that would act like
 > 	dpkg --purge on Debian but AFAIK that would be impossible
 > 	since it would need persistent package records (that still
 > 	exists after a package has been removed as long as we have
 > 	some configuration files for this port in the tree).
 
 This would be a really cool feature.  Off hand, you'd probably want to
 create another dirctory under /var/db to store these records.  That
 would certaintly be allowed to support such a feature.
 
 -- Brooks

From: Florent Thoumie <flz@xbsd.org>
To: Brooks Davis <brooks@one-eyed-alien.net>
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org,
	hq@freebsd.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to clean
 pkg-plist
Date: Fri, 04 Feb 2005 20:13:06 +0100

 Brooks Davis wrote:
 > On Fri, Feb 04, 2005 at 07:41:29PM +0100, Florent Thoumie wrote:
 > 
 >>Brooks Davis wrote:
 >>
 >>
 >>>It seems like dirrmtry should take an optional message to emit if the
 >>>event that the directory can not be delete.  That way the user can be
 >>>informed that the directory should be removed if they are really done
 >>>using the port.
 >>
 >>	I asked myself if I should put this feature in my patch and
 >>	I finally haven't because it required some extra-stuff
 >>	(handling optional arguments for @ commands is painful), and a
 >>	simple '@unexec [ -d ${PREFIX}/etc ] && echo ...' is easier I
 >>	guess. But that's no problem for me to include that if everybody
 >>	thinks it worth it.
 > 
 > 
 > Given this workaround, it's probably not a high priority to add this.
 > Hmm, what about a seperate @echoifexists or similar command?
 
 	I have nothing against that. The command above sounded really
 	simple to me that it wouldn't need a separate @ command. But
 	why not.
 
 >>>Have you thought about how to solve the boot strapping problems with
 >>>pkg_install/pkg_delete?
 >>
 >>	I have absolutely no idea what you're talking about, I started
 >>	looking at pkg_install source yesterday at night. Could you
 >>	give me some pointers about that ?
 > 
 > 
 > The issue is that you need to find a way to keep users from installing
 > packages they can't uninstall.  If you add new commands and they are
 > used in ports, users with older systems won't have the necessicary
 > pkg_delete commands to make them work.  The current system doens't even
 > give a graceful way of detecting this condition both in the port and
 > when the users installs a pkg from the -stable collections online.
 > Longer term, we need some versioning in the plist and ports, but first
 > we've got to solve the problem we're stuck with now.
 
 	Ok, what you meant is now clearer to me. I have no good idea of
 	how this exactly works but IIRC i've seen sysutils/pkg_install
 	whose job must be to "solve" this problem. I think we have kind
 	of version, with packing list format version. I need to dig into
 	this. I've only seen a little part of pkg_install actually.
 
 >>>Our nominal pkg_install maintainer is MIA at the moment.
 >>
 >>	Ok, actually I knew eik has been working on it, but I didn't
 >>	know who was the active maintainer now.
 > 
 > 
 > Last I heard, eik was the one working it, but no one has heard from him
 > in a while.  He's been gone long enough that someone else could
 > certaintly commit to pkg_install given public review.
 > 
 > 
 >>	I have thought of a new purge command, that would act like
 >>	dpkg --purge on Debian but AFAIK that would be impossible
 >>	since it would need persistent package records (that still
 >>	exists after a package has been removed as long as we have
 >>	some configuration files for this port in the tree).
 > 
 > 
 > This would be a really cool feature.  Off hand, you'd probably want to
 > create another dirctory under /var/db to store these records.  That
 > would certaintly be allowed to support such a feature.
 
 	I just wanted to add @conf feature because ports lacks some
 	guidelines concerning how to handle configuration, where to
 	put sample, and I needed that support in pkg_install before
 	I can write my patch for bsd.port.mk.
 
 	I'm quite interested in pkg_install, I think there could be
 	a lot of interesting things to add. I'll probably try to add
 	such a purge command later.
 
 -- 
 Florent Thoumie
 flz@xbsd.org
State-Changed-From-To: open->suspended 
State-Changed-By: flz 
State-Changed-When: Tue May 24 21:01:23 GMT 2005 
State-Changed-Why:  
I'm not sure that's the good way to do. 
I'm working on some uniform way to handle such things 
both in ports and package. 

This PR is likely to be closed later. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77082 
State-Changed-From-To: suspended->open 
State-Changed-By: flz 
State-Changed-When: Sun Jun 12 08:49:46 GMT 2005 
State-Changed-Why:  
Will resubmit a diff in two minutes. 


Responsible-Changed-From-To: freebsd-bugs->krion 
Responsible-Changed-By: flz 
Responsible-Changed-When: Sun Jun 12 08:49:46 GMT 2005 
Responsible-Changed-Why:  
krion is new maintainer for pkg_install. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77082 

From: Florent Thoumie <flz@xbsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: krion@FreeBSD.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to
	clean pkg-plist
Date: Sun, 12 Jun 2005 10:55:46 +0200

 --=-T8F0cVb4jIWPes4ghZSf
 Content-Type: multipart/mixed; boundary="=-iWhULcNuiydhcdxmJhB0"
 
 
 --=-iWhULcNuiydhcdxmJhB0
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 	I've removed the @conf part of the patch and added some words to
 	pkg_create(1). This patch is ready to commit.
 
 	For the reminder, it just adds a @dirrmtry command that will act
 	the same way as @dirrm but will not print a warning if the=20
 	directory couldn't have been deleted.
 
 --=20
 Florent Thoumie
 flz@xbsd.org
 
 --=-iWhULcNuiydhcdxmJhB0
 Content-Disposition: attachment; filename=pkginstall-dirrmtry.diff
 Content-Transfer-Encoding: base64
 Content-Type: text/x-patch; name=pkginstall-dirrmtry.diff; charset=iso8859-15
 
 SW5kZXg6IGNyZWF0ZS9wa2dfY3JlYXRlLjENCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NClJDUyBmaWxlOiAvaG9tZS9u
 Y3ZzL3NyYy91c3Iuc2Jpbi9wa2dfaW5zdGFsbC9jcmVhdGUvcGtnX2NyZWF0ZS4xLHYNCnJldHJp
 ZXZpbmcgcmV2aXNpb24gMS42NA0KZGlmZiAtdSAtcjEuNjQgcGtnX2NyZWF0ZS4xDQotLS0gY3Jl
 YXRlL3BrZ19jcmVhdGUuMQk2IEp1biAyMDA1IDAzOjI0OjE0IC0wMDAwCTEuNjQNCisrKyBjcmVh
 dGUvcGtnX2NyZWF0ZS4xCTEyIEp1biAyMDA1IDA4OjQ5OjEwIC0wMDAwDQpAQCAtN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2FybngoImNhbm5v
 dCBkZWxldGUgc3BlY2lmaWVkIGRpcmVjdG9yeSAnJXMnIC0gaXQgaXMgYSBmaWxlIVxuIg0KQEAg
 LTUwOCw3ICs1MTUsNyBAQA0KIAkgICAgZWxzZSB7DQogCQlpZiAoVmVyYm9zZSkNCiAJCSAgICBw
 cmludGYoIkRlbGV0ZSBkaXJlY3RvcnkgJXNcbiIsIHRtcCk7DQotCQlpZiAoIUZha2UgJiYgZGVs
 ZXRlX2hpZXJhcmNoeSh0bXAsIGlnbl9lcnIsIEZBTFNFKSkgew0KKwkJaWYgKCFGYWtlICYmIGRl
 bGV0ZV9oaWVyYXJjaHkodG1wLCBpZ25fZXJyLCBGQUxTRSkgJiYgcC0+dHlwZSAhPSBQTElTVF9E
 SVJfUk1fVFJZKSB7DQogCQkgICAgd2FybngoInVuYWJsZSB0byBjb21wbGV0ZWx5IHJlbW92ZSBk
 aXJlY3RvcnkgJyVzJyIsIHRtcCk7DQogCQkgICAgZmFpbCA9IEZBSUw7DQogCQl9DQo=
 
 
 --=-iWhULcNuiydhcdxmJhB0--
 
 --=-T8F0cVb4jIWPes4ghZSf
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (FreeBSD)
 
 iD8DBQBCq/iSMxEkbVFH3PQRAq2+AJ9a+o1Gtq3zRjxYJmyjEOxR2Gv46ACeKGY2
 vxwyUP9UxRnS5Y4zhL40Sfc=
 =/EMy
 -----END PGP SIGNATURE-----
 
 --=-T8F0cVb4jIWPes4ghZSf--
 

From: Florent Thoumie <flz@xbsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: krion@FreeBSD.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to
	clean pkg-plist
Date: Sun, 12 Jun 2005 11:53:11 +0200

 --=-gEcWHc3o0y2sjMGjYe4l
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 	The diff has been automatically base64 encoded.
 
 	Here is a link to a plain-text version :
 
 	http://www.xbsd.org/~flz/ports/pkginstall-dirrmtry.diff
 
 --=20
 Florent Thoumie
 flz@xbsd.org
 
 --=-gEcWHc3o0y2sjMGjYe4l
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (FreeBSD)
 
 iD8DBQBCrAYHMxEkbVFH3PQRAkfZAJ4gZnTsMCuENc4gcV3+PUtBJXHekgCfdimH
 VD4fsPt0DnWtZXErIN23mGQ=
 =o+IA
 -----END PGP SIGNATURE-----
 
 --=-gEcWHc3o0y2sjMGjYe4l--
 

From: Florent Thoumie <flz@xbsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: krion@FreeBSD.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to
	clean pkg-plist
Date: Sun, 12 Jun 2005 11:51:31 +0200

 --=-3k6Ru/z+HBbz9R3SZOyI
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 	The diff has been automatically base64 encoded.
 
 	Here is a link to a plain-text version :
 
 	http://www.xbsd.org/~flz/ports/pkginstall-dirrmtry.diff
 
 --=20
 Florent Thoumie
 flz@xbsd.org
 
 --=-3k6Ru/z+HBbz9R3SZOyI
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (FreeBSD)
 
 iD8DBQBCrAWiMxEkbVFH3PQRAlYgAJ4+z6tAnM2BMZZMl+Wo97rvAbyulgCfTYCg
 HfeXLPNqt8KFxtL0r/2g7+0=
 =sC2D
 -----END PGP SIGNATURE-----
 
 --=-3k6Ru/z+HBbz9R3SZOyI--
 

From: Florent Thoumie <flz@xbsd.org>
To: Brooks Davis <brooks@one-eyed-alien.net>
Cc: freebsd-bugs@freebsd.org
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to clean
 pkg-plist
Date: Fri, 04 Feb 2005 19:41:29 +0100

 Brooks Davis wrote:
 
 > It seems like dirrmtry should take an optional message to emit if the
 > event that the directory can not be delete.  That way the user can be
 > informed that the directory should be removed if they are really done
 > using the port.
 
 	I asked myself if I should put this feature in my patch and
 	I finally haven't because it required some extra-stuff
 	(handling optional arguments for @ commands is painful), and a
 	simple '@unexec [ -d ${PREFIX}/etc ] && echo ...' is easier I
 	guess. But that's no problem for me to include that if everybody
 	thinks it worth it.
 
 > Have you thought about how to solve the boot strapping problems with
 > pkg_install/pkg_delete?
 
 	I have absolutely no idea what you're talking about, I started
 	looking at pkg_install source yesterday at night. Could you
 	give me some pointers about that ?
 
 > Our nominal pkg_install maintainer is MIA at the moment.
 
 	Ok, actually I knew eik has been working on it, but I didn't
 	know who was the active maintainer now.
 
 	I have thought of a new purge command, that would act like
 	dpkg --purge on Debian but AFAIK that would be impossible
 	since it would need persistent package records (that still
 	exists after a package has been removed as long as we have
 	some configuration files for this port in the tree).
 
 -- 
 Florent Thoumie
 flz@xbsd.org
 _______________________________________________
 freebsd-bugs@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->feedback 
State-Changed-By: krion 
State-Changed-When: Sat Nov 12 11:48:22 GMT 2005 
State-Changed-Why:  
I saw edwin@ wants to add @dirrmtry for bsd.port.mk, could you tweak your patch 
to get it in sync with edwin's one.  I'm either not really happy with 
@cpin name, can we rename it to @cmp or something like that ? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77082 

From: Florent Thoumie <flz@xbsd.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/77082: src/usr.sbin/pkg_install - Add 3 new macros to
	clean pkg-plist
Date: Mon, 14 Nov 2005 12:25:17 +0100

 On Sat, 2005-11-12 at 13:10 +0100, Florent Thoumie wrote:
 > On Sat, 2005-11-12 at 11:52 +0000, Kirill Ponomarew wrote:
 > > Synopsis: src/usr.sbin/pkg_install - Add 3 new macros to clean pkg-plist
 > > 
 > > State-Changed-From-To: open->feedback
 > > State-Changed-By: krion
 > > State-Changed-When: Sat Nov 12 11:48:22 GMT 2005
 > > State-Changed-Why: 
 > > I saw edwin@ wants to add @dirrmtry for bsd.port.mk, could you tweak your patch
 > > to get it in sync with edwin's one.  I'm either not really happy with
 > > @cpin name, can we rename it to @cmp or something like that ?
 > > 
 > > http://www.freebsd.org/cgi/query-pr.cgi?pr=77082
 > 
 > 	Well, he sent a patch for bsd.port.mk and I did it for 
 > 	pkg_install, I have nothing to do at the moment. Once my patch 
 > 	is committed to HEAD (and maybe MFC'ed to RELENG_6), the only 
 > 	thing that I could do is adding test around edwin's lines to 
 > 	check for pkg_install version. Maybe I'm overlooking something.
 > 
 > 	For the @cpin part, my opinion is that it should go in a 
 > 	separate pkg-install script, because if you do it in pkg-plist, 
 > 	you also need to add lines in Makefile.
 > 
 > 	IMHO, everything that is done during install requiring 
 > 	special handling should go to a separate pkg-install script.
 > 
 
 	Seems like I forgot to include gnats in the CC list.
 
 -- 
 Florent Thoumie
 flz@FreeBSD.org
 FreeBSD Committer
 
State-Changed-From-To: feedback->suspended 
State-Changed-By: linimon 
State-Changed-When: Sun Mar 2 02:12:11 UTC 2008 
State-Changed-Why:  
It does not sound as though this is actively being worked on. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77082 
Responsible-Changed-From-To: krion->portmgr 
Responsible-Changed-By: flz 
Responsible-Changed-When: Fri Jul 17 13:42:00 UTC 2009 
Responsible-Changed-Why:  
pkg_install is maintained by portmgr. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77082 

From: Garrett Cooper <yanegomi@gmail.com>
To: bug-followup@FreeBSD.org, flz@xbsd.org
Cc:  
Subject: Re: bin/77082: pkg_install(1) - Add 3 new macros to clean pkg-plist
Date: Tue, 23 Mar 2010 00:49:05 -0700

     It might be helpful to note which items in the current PR have
 been integrated into mainline pkg_install.
 Thanks :)!
 -Garrett
State-Changed-From-To: suspended->closed 
State-Changed-By: flz 
State-Changed-When: Fri Apr 2 11:22:20 UTC 2010 
State-Changed-Why:  
Close this PR before anybody thinks it's a good idea. Oops, too late. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77082 
>Unformatted:
