1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-21 15:45:02 +00:00

Use --fast-read mode to extract metadata from package file. Since metadata

files are located at the very beginning of the package, this patch in
conjuction with latest tar(1) --fast-mode fix greatly speeds up pkg_info(1)
operation on package files.

MFC after:	1 week
This commit is contained in:
Maxim Sobolev 2002-09-09 06:06:09 +00:00
parent 301ca7cf84
commit d083e1c6a4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103116

View File

@ -88,7 +88,7 @@ pkg_do(char *pkg)
{
Boolean installed = FALSE, isTMP = FALSE;
char log_dir[FILENAME_MAX];
char fname[FILENAME_MAX];
char fname[FILENAME_MAX], extrlist[FILENAME_MAX];
Package plist;
FILE *fp;
struct stat sb;
@ -131,7 +131,21 @@ pkg_do(char *pkg)
goto bail;
}
Home = make_playpen(PlayPen, sb.st_size / 2);
if (unpack(fname, "+*")) {
snprintf(extrlist, sizeof(extrlist), "--fast-read %s %s %s",
CONTENTS_FNAME, COMMENT_FNAME, DESC_FNAME);
if (Flags & SHOW_DISPLAY)
snprintf(extrlist, sizeof(extrlist), "%s %s", extrlist,
DISPLAY_FNAME);
if (Flags & SHOW_INSTALL)
snprintf(extrlist, sizeof(extrlist), "%s %s %s", extrlist,
INSTALL_FNAME, POST_INSTALL_FNAME);
if (Flags & SHOW_DEINSTALL)
snprintf(extrlist, sizeof(extrlist), "%s %s %s", extrlist,
DEINSTALL_FNAME, POST_DEINSTALL_FNAME);
if (Flags & SHOW_MTREE)
snprintf(extrlist, sizeof(extrlist), "%s %s", extrlist,
MTREE_FNAME);
if (unpack(fname, extrlist)) {
warnx("error during unpacking, no info for '%s' available", pkg);
code = 1;
goto bail;