Date: Wed, 12 May 2010 00:00:26 GMT From: Garrett Cooper <gcooper@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 178128 for review Message-ID: <201005120000.o4C00QrL094699@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@178128?ac=10 Change 178128 by gcooper@starr-bastion on 2010/05/11 23:59:48 Push tar-like -X support into pkg_create(8) again. Affected files ... .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/Makefile#5 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/perform.c#16 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_bsdtar_platform.h#1 add .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_config.h#1 add .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_line_reader.c#1 add .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_line_reader.h#1 add .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_matching.c#1 add .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_matching.h#1 add .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_pathmatch.c#1 add .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/tar_pathmatch.h#1 add Differences ... ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/Makefile#5 (text+ko) ==== @@ -3,6 +3,8 @@ PROG= pkg_create SRCS= main.c perform.c pl.c +SRCS+= tar_line_reader.c tar_matching.c tar_pathmatch.c + WARNS?= 3 WFORMAT?= 1 ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/perform.c#16 (text+ko) ==== @@ -19,8 +19,9 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/usr.sbin/pkg_install/create/perform.c,v 1.85 2010/04/23 11:07:43 flz Exp $"); +__FBSDID("$FreeBSD$"); +/* XXX (gcooper): needs to come before sys/stat.h for stat(2). */ #include <sys/types.h> #include <sys/mman.h> #include <sys/stat.h> @@ -36,6 +37,7 @@ #include <archive.h> #include <archive_entry.h> +#include "tar_matching.h" #include <pkg.h> #include "create.h" @@ -374,6 +376,7 @@ struct stat *sb; struct archive *archive = NULL; struct archive_entry *entry = NULL; + struct lafe_matching *match_patterns = NULL; char *destbase = NULL; char *destfile = NULL; char *prefix = NULL; @@ -432,6 +435,20 @@ error = archive_error_string(archive); else { + /* + * XXX (gcooper): replace these bits with a proper callback + * via archive(3) when the time rolls around. + */ + if (ExcludeFrom != NULL) { + if (lafe_exclude_from_file(&match_patterns, + ExcludeFrom) < 0) + error = strerror(EINVAL); + } + + } + + if (error == NULL) { + switch(Zipper) { case BZIP2: cname = "bzipp"; @@ -465,14 +482,6 @@ error = archive_error_string(archive); if (error != NULL) { -#ifdef NOTYET - /* - * XXX (gcooper): Need to fill bits for the exclude - * stuff - */ - if (ExcludeFrom != NULL) ; -#endif - if (Verbose) printf("Creating %sed tar ball in '%s'\n", cname, tball); @@ -544,7 +553,9 @@ PATH_MAX) error = strerror(ENAMETOOLONG); - ADD_FILE(srcfile, destfile, archive_entry_open_flags); + if (lafe_excluded(match_patterns, srcfile) != 0) + ADD_FILE(srcfile, destfile, + archive_entry_open_flags); break; @@ -683,16 +694,11 @@ warn("%s: failed to remove incomplete package - '%s'", __func__, tball); } - if (destbase != NULL) - free(destbase); - if (destfile != NULL) - free(destfile); - if (srcbase != NULL) - free(srcbase); - if (srcfile != NULL) - free(srcfile); - if (destfile != NULL) - free(destfile); + free(destbase); + free(destfile); + free(srcbase); + free(srcfile); + free(destfile); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005120000.o4C00QrL094699>