pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files pkg_install-20090424:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8bc8635ba83e
branches:  trunk
changeset: 392047:8bc8635ba83e
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri Apr 24 14:00:25 2009 +0000

description:
pkg_install-20090424:
Make pkg_delete -d the default behavior, remove the option.
Remove pkg_create -R support (reorder @dirrm entries).
Introduce new plist command @pkgdir, which makes pkg_add add
this directory if it doesn't exist already and pkg_delete remove it
only if no other package has a @pkgdir entry for it. Otherwise
directories are pruned when the last file or directory in them is
removed. @dirrm is now a pure hint, if the directory doesn't exist, it
will be silently skipped.

diffstat:

 pkgtools/pkg_install/files/add/perform.c       |   13 +-
 pkgtools/pkg_install/files/admin/check.c       |    5 +-
 pkgtools/pkg_install/files/admin/main.c        |    8 +-
 pkgtools/pkg_install/files/create/create.h     |    3 +-
 pkgtools/pkg_install/files/create/main.c       |   13 +-
 pkgtools/pkg_install/files/create/pkg_create.1 |   30 +--
 pkgtools/pkg_install/files/create/pl.c         |   64 ++-----
 pkgtools/pkg_install/files/delete/pkg_delete.1 |   16 +-
 pkgtools/pkg_install/files/delete/pkg_delete.c |   12 +-
 pkgtools/pkg_install/files/info/show.c         |    8 +-
 pkgtools/pkg_install/files/lib/lib.h           |   12 +-
 pkgtools/pkg_install/files/lib/plist.c         |  225 +++++++++++++++---------
 pkgtools/pkg_install/files/lib/version.h       |    4 +-
 13 files changed, 219 insertions(+), 194 deletions(-)

diffs (truncated from 879 to 300 lines):

diff -r aafd2c7db67a -r 8bc8635ba83e pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Fri Apr 24 11:54:14 2009 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Fri Apr 24 14:00:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.85 2009/04/06 14:34:15 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.86 2009/04/24 14:00:25 joerg Exp $       */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.85 2009/04/06 14:34:15 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.86 2009/04/24 14:00:25 joerg Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -666,6 +666,13 @@
                                printf("%s", p->name);
                        break;
 
+               case PLIST_PKGDIR:
+                       fullpath = xasprintf("%s/%s", pkg->prefix, p->name);
+                       mkdir_p(fullpath);
+                       free(fullpath);
+                       add_pkgdir(pkg->pkgname, pkg->prefix, p->name);
+                       continue;
+
                case PLIST_CMD:
                        if (format_cmd(cmd, sizeof(cmd), p->name, pkg->prefix, last_file))
                                return -1;
@@ -1386,7 +1393,7 @@
                            pkg->other_version, pkg->pkgname);
                        warnx("Remember to run pkg_admin rebuild-tree after fixing this.");
                }
-               delete_package(FALSE, FALSE, &pkg->plist, FALSE, Destdir);
+               delete_package(FALSE, &pkg->plist, FALSE, Destdir);
        }
 
 nuke_pkgdb:
diff -r aafd2c7db67a -r 8bc8635ba83e pkgtools/pkg_install/files/admin/check.c
--- a/pkgtools/pkg_install/files/admin/check.c  Fri Apr 24 11:54:14 2009 +0000
+++ b/pkgtools/pkg_install/files/admin/check.c  Fri Apr 24 14:00:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: check.c,v 1.8 2009/04/23 19:35:52 joerg Exp $  */
+/*     $NetBSD: check.c,v 1.9 2009/04/24 14:00:25 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: check.c,v 1.8 2009/04/23 19:35:52 joerg Exp $");
+__RCSID("$NetBSD: check.c,v 1.9 2009/04/24 14:00:25 joerg Exp $");
 
 /*-
  * Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -173,6 +173,7 @@
                case PLIST_OPTION:
                case PLIST_PKGCFL:
                case PLIST_BLDDEP:
+               case PLIST_PKGDIR:
                        break;
                }
        }
diff -r aafd2c7db67a -r 8bc8635ba83e pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Fri Apr 24 11:54:14 2009 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Fri Apr 24 14:00:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.50 2009/04/23 19:35:52 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.51 2009/04/24 14:00:25 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.50 2009/04/23 19:35:52 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.51 2009/04/24 14:00:25 joerg Exp $");
 
 /*-
  * Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -175,6 +175,10 @@
                                (*cnt)++;
                        }
                        break;
+               case PLIST_PKGDIR:
+                       add_pkgdir(PkgName, dirp, p->name);
+                       (*cnt)++;
+                       break;
                case PLIST_CWD:
                        if (strcmp(p->name, ".") != 0) {
                                dirp = p->name;
diff -r aafd2c7db67a -r 8bc8635ba83e pkgtools/pkg_install/files/create/create.h
--- a/pkgtools/pkg_install/files/create/create.h        Fri Apr 24 11:54:14 2009 +0000
+++ b/pkgtools/pkg_install/files/create/create.h        Fri Apr 24 14:00:25 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: create.h,v 1.9 2007/08/03 13:15:59 joerg Exp $ */
+/* $NetBSD: create.h,v 1.10 2009/04/24 14:00:25 joerg Exp $ */
 
 /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */
 
@@ -59,7 +59,6 @@
 extern size_t PlayPenSize;
 extern int PlistOnly;
 extern int RelativeLinks;
-extern int ReorderDirs;
 extern int update_pkgdb;
 extern int create_views;
 
diff -r aafd2c7db67a -r 8bc8635ba83e pkgtools/pkg_install/files/create/main.c
--- a/pkgtools/pkg_install/files/create/main.c  Fri Apr 24 11:54:14 2009 +0000
+++ b/pkgtools/pkg_install/files/create/main.c  Fri Apr 24 14:00:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.12 2009/02/02 12:35:01 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.13 2009/04/24 14:00:25 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.12 2009/02/02 12:35:01 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.13 2009/04/24 14:00:25 joerg Exp $");
 
 /*
  * FreeBSD install - a package for the installation and maintainance
@@ -26,7 +26,7 @@
 #include "lib.h"
 #include "create.h"
 
-static const char Options[] = "B:C:D:EFI:K:L:OP:RS:T:UVb:c:d:f:g:i:k:ln:p:r:s:u:v";
+static const char Options[] = "B:C:D:EFI:K:L:OP:S:T:UVb:c:d:f:g:i:k:ln:p:r:s:u:v";
 
 char   *Prefix = NULL;
 char   *Comment = NULL;
@@ -53,14 +53,13 @@
 int    create_views = 0;
 int     PlistOnly = 0;
 int     RelativeLinks = 0;
-int     ReorderDirs = 0;
 Boolean File2Pkg = FALSE;
 
 static void
 usage(void)
 {
        fprintf(stderr,
-           "usage: pkg_create [-ElORUVv] [-B build-info-file] [-b build-version-file]\n"
+           "usage: pkg_create [-ElOUVv] [-B build-info-file] [-b build-version-file]\n"
             "                  [-C cpkgs] [-D displayfile] [-I realprefix] [-i iscript]\n"
             "                  [-K pkg_dbdir] [-k dscript] [-L SrcDir]\n"
             "                  [-n preserve-file] [-P dpkgs] [-p prefix] [-r rscript]\n"
@@ -100,10 +99,6 @@
                        PlistOnly = 1;
                        break;
 
-               case 'R':
-                       ReorderDirs = 1;
-                       break;
-
                case 'U':
                        update_pkgdb = 0;
                        break;
diff -r aafd2c7db67a -r 8bc8635ba83e pkgtools/pkg_install/files/create/pkg_create.1
--- a/pkgtools/pkg_install/files/create/pkg_create.1    Fri Apr 24 11:54:14 2009 +0000
+++ b/pkgtools/pkg_install/files/create/pkg_create.1    Fri Apr 24 14:00:25 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_create.1,v 1.18 2009/04/23 19:34:04 joerg Exp $
+.\" $NetBSD: pkg_create.1,v 1.19 2009/04/24 14:00:25 joerg Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -24,7 +24,7 @@
 .\" [jkh] Took John's changes back and made some additional extensions for
 .\" better integration with FreeBSD's new ports collection.
 .\"
-.Dd July 28, 2008
+.Dd April 24, 2009
 .Dt PKG_CREATE 1
 .Os
 .Sh NAME
@@ -32,7 +32,7 @@
 .Nd a utility for creating software package distributions
 .Sh SYNOPSIS
 .Nm
-.Op Fl ElORUVv
+.Op Fl ElOUVv
 .Bk -words
 .Op Fl B Ar build-info-file
 .Ek
@@ -256,10 +256,6 @@
 .Pq base
 to start from in selecting files for
 the package.
-.It Fl R
-Re-order any directories in the PLIST file into reverse alphabetic
-order, so that child directories will automatically be removed before
-parent directories.
 .It Fl S Ar size-all-file
 Store the given file for later querying with the
 .Xr pkg_info 1
@@ -435,20 +431,18 @@
 will derive this field from the
 .Ar pkg-name
 and add it automatically if none is given.
-.It Cm @dirrm Ar name
+.It Cm @pkgdir Ar name
 Declare directory
 .Pa name
-to be deleted at deinstall time.
-By default, directories created by a package installation are not deleted
-when the package is deinstalled; this provides an explicit directory cleanup
-method.
-This directive should appear at the end of the package list.
-If more than one
-.Cm @dirrm
-directives are used, the directories are removed in the order specified.
-The
+as managed.
+If it does not exist at installation time, it is created.
+If this directory is no longer referenced by packages and the last
+file or directory in it is deleted, the directory is removed as well.
+.It Cm @dirrm Ar name
+This command is supported for compatibility only.
+If directory
 .Pa name
-directory will not be removed unless it is empty.
+exists, it will be deleted at deinstall time.
 .It Cm @display Ar name
 Declare
 .Pa name
diff -r aafd2c7db67a -r 8bc8635ba83e pkgtools/pkg_install/files/create/pl.c
--- a/pkgtools/pkg_install/files/create/pl.c    Fri Apr 24 11:54:14 2009 +0000
+++ b/pkgtools/pkg_install/files/create/pl.c    Fri Apr 24 14:00:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pl.c,v 1.12 2009/02/02 12:35:01 joerg Exp $    */
+/*     $NetBSD: pl.c,v 1.13 2009/04/24 14:00:25 joerg Exp $    */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: pl.c,v 1.12 2009/02/02 12:35:01 joerg Exp $");
+__RCSID("$NetBSD: pl.c,v 1.13 2009/04/24 14:00:25 joerg Exp $");
 
 /*
  * FreeBSD install - a package for the installation and maintainance
@@ -74,39 +74,6 @@
 }
 
 /*
- * (Reversed) comparison routine for directory name sorting
- */
-static int
-dircmp(const void *vp1, const void *vp2)
-{
-       return strcmp((const char *) vp2, (const char *) vp1);
-}
-
-/*
- * Re-order the PLIST_DIR_RM entries into reverse alphabetic order
- */
-static void
-reorder(package_t *pkg, int dirc)
-{
-       plist_t *p;
-       char  **dirv;
-       int     i;
-
-       dirv = xcalloc(dirc, sizeof(char *));
-
-       for (p = pkg->head, i = 0; p; p = p->next) {
-               if (p->type == PLIST_DIR_RM)
-                       dirv[i++] = p->name;
-       }
-       qsort(dirv, dirc, sizeof(char *), dircmp);
-       for (p = pkg->head, i = 0; p; p = p->next) {
-               if (p->type == PLIST_DIR_RM)
-                       p->name = dirv[i++];
-       }
-       free(dirv);
-}
-
-/*
  * Check a list for files that require preconversion
  */
 void
@@ -120,26 +87,36 @@
        char    name[MaxPathSize];
        char   *cwd = NULL;
        char   *srcdir = NULL;
-       int     dirc;
+       char   *pkgname = NULL;
        int     cc;



Home | Main Index | Thread Index | Old Index