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-20090527:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bdbae5d9dcc1
branches:  trunk
changeset: 393818:bdbae5d9dcc1
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Wed May 27 20:26:03 2009 +0000

description:
pkg_install-20090527:
Try harder to mimic the old pkg_delete behavior and provide a
topologically sorted output for pkg_info -r. Bail out on dependency
cycles based on recursion depth, currently 64K.

diffstat:

 pkgtools/pkg_install/files/info/perform.c |  17 +++++++++++------
 pkgtools/pkg_install/files/lib/version.h  |   4 ++--
 2 files changed, 13 insertions(+), 8 deletions(-)

diffs (78 lines):

diff -r fb8d4d2fdd0d -r bdbae5d9dcc1 pkgtools/pkg_install/files/info/perform.c
--- a/pkgtools/pkg_install/files/info/perform.c Wed May 27 20:09:58 2009 +0000
+++ b/pkgtools/pkg_install/files/info/perform.c Wed May 27 20:26:03 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.56 2009/04/22 19:18:06 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.57 2009/05/27 20:26:03 joerg Exp $       */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -13,7 +13,7 @@
 #if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.56 2009/04/22 19:18:06 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.57 2009/05/27 20:26:03 joerg Exp $");
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -287,12 +287,15 @@
 }
 
 static void
-build_full_reqby(lpkg_head_t *reqby, struct pkg_meta *meta)
+build_full_reqby(lpkg_head_t *reqby, struct pkg_meta *meta, int limit)
 {
        char *iter, *eol, *next;
        lpkg_t *lpp;
        struct pkg_meta *meta_dep;
 
+       if (limit == 65536)
+               errx(1, "Cycle in the dependency tree, bailing out");
+
        if (meta->is_installed == 0 || meta->meta_required_by == NULL)
                return;
 
@@ -316,12 +319,14 @@
                lpp = alloc_lpkg(iter);
                if (next != eol)
                        *eol = '\n';
-               TAILQ_INSERT_TAIL(reqby, lpp, lp_link);
+
                meta_dep = read_meta_data_from_pkgdb(lpp->lp_name);
                if (meta_dep == NULL)
                        continue;
-               build_full_reqby(reqby, meta_dep);
+               build_full_reqby(reqby, meta_dep, limit + 1);
                free_pkg_meta(meta_dep);
+
+               TAILQ_INSERT_TAIL(reqby, lpp, lp_link);
        }
 }
 
@@ -438,7 +443,7 @@
                if ((Flags & SHOW_FULL_REQBY) && meta->is_installed) {
                        lpkg_head_t reqby;
                        TAILQ_INIT(&reqby);
-                       build_full_reqby(&reqby, meta);
+                       build_full_reqby(&reqby, meta, 0);
                        show_list(&reqby, "Full required by list:\n");
                }
                if (Flags & SHOW_DESC) {
diff -r fb8d4d2fdd0d -r bdbae5d9dcc1 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Wed May 27 20:09:58 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Wed May 27 20:26:03 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.128 2009/05/18 10:01:37 wiz Exp $        */
+/*     $NetBSD: version.h,v 1.129 2009/05/27 20:26:03 joerg Exp $      */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20090518"
+#define PKGTOOLS_VERSION "20090527"
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index