Subject: Re: pkg_info broken for meta-pkgs
To: None <gavan@coolfactor.org>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-pkg
Date: 08/06/2004 04:42:57
OK, how about not trying to unpack all the +-files (ALL_FNAMES), but only
the ones actually used, as dictated by command line flags? The patch below
works for me, with some common cases tested (pkg_info -qL, -m, with no
args on the x11-links package).
Comments?
- Hubert
Index: info/perform.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/info/perform.c,v
retrieving revision 1.52
diff -u -r1.52 perform.c
--- info/perform.c 7 May 2004 16:40:30 -0000 1.52
+++ info/perform.c 6 Aug 2004 02:30:44 -0000
@@ -97,16 +97,38 @@
/*
* Apply a crude heuristic to see how much space the package will
* take up once it's unpacked. I've noticed that most packages
- * compress an average of 75%, but we're only unpacking the + files so
- * be very optimistic.
+ * compress an average of 75%, but we're only unpacking the + files
+ * needed so be very optimistic.
*/
+ char flist[sizeof(ALL_FNAMES)];
+
+ /* Determine which +-files to unpack - not all may be present! */
+ strcat(flist, CONTENTS_FNAME); strcat(flist, " ");
+ strcat(flist, COMMENT_FNAME); strcat(flist, " ");
+ strcat(flist, DESC_FNAME); strcat(flist, " ");
+ if (Flags & SHOW_MTREE) { strcat(flist, MTREE_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_BUILD_VERSION) { strcat(flist, BUILD_VERSION_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_BUILD_INFO) { strcat(flist, BUILD_INFO_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_PKG_SIZE) { strcat(flist, SIZE_PKG_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_ALL_SIZE) { strcat(flist, SIZE_ALL_FNAME); strcat(flist, " "); }
+#if 0
+ if (Flags & SHOW_REQBY) { strcat(flist, REQUIRED_BY_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_DISPLAY) { strcat(flist, DISPLAY_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_INSTALL) { strcat(flist, INSTALL_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_DEINSTALL) { strcat(flist, DEINSTALL_FNAME); strcat(flist, " "); }
+ if (Flags & SHOW_REQUIRE) { strcat(flist, REQUIRE_FNAME); strcat(flist, " "); }
+ /* PRESERVE_FNAME? */
+#endif
+
+ printf("HF: flist='%s'\n", flist);
+
if (stat(fname, &sb) == FAIL) {
warnx("can't stat package file '%s'", fname);
code = 1;
goto bail;
}
Home = make_playpen(PlayPen, PlayPenSize, sb.st_size / 2);
- if (unpack(fname, ALL_FNAMES)) {
+ if (unpack(fname, flist)) {
warnx("error during unpacking, no info for '%s' available", pkg);
code = 1;
goto bail;
--
,,_
If wishes were wings, o" )~ would fly. -- Go www.NetBSD.org!
''''