pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install pkg_install-20170419:
details: https://anonhg.NetBSD.org/pkgsrc/rev/72819d13bf1e
branches: trunk
changeset: 361358:72819d13bf1e
user: joerg <joerg%pkgsrc.org@localhost>
date: Wed Apr 19 21:42:50 2017 +0000
description:
pkg_install-20170419:
- Convert to libarchive 3.x interfaces, avoiding the legacy glue.
- Rename local copy of netpgpverify to match installed headers.
- Shuffle bootstrap code to reduce special cases in pkg_add.
- Always read/write file names in tar archives as binary. While they are
supposed to be UTF-8, locale conversion creates more problems than it
solves here.
- Fix const correctness in gpg_verify.
- Add format string annotation for xasprintf for GCC-like compilers.
- Restrict supported archive formats for binary packages to ar (signed
packages) and tar (actual content) with uncompressed/gzip/bzip2/xz as
compression choices. This reduces the exposed libarchive surface.
- The pkg-vulnerability file correspondingly supports only the same
compression choices.
diffstat:
pkgtools/pkg_install/Makefile | 14 ++--
pkgtools/pkg_install/files/add/perform.c | 27 +++-------
pkgtools/pkg_install/files/admin/main.c | 8 +-
pkgtools/pkg_install/files/create/build.c | 20 +++----
pkgtools/pkg_install/files/create/util.c | 13 +----
pkgtools/pkg_install/files/info/perform.c | 35 +++++--------
pkgtools/pkg_install/files/lib/Makefile.in | 6 +-
pkgtools/pkg_install/files/lib/defs.h | 5 +-
pkgtools/pkg_install/files/lib/gpgsig.c | 16 +++--
pkgtools/pkg_install/files/lib/lib.h | 10 +++-
pkgtools/pkg_install/files/lib/pkg_io.c | 47 ++++++++++++++----
pkgtools/pkg_install/files/lib/pkg_signature.c | 41 +++++++---------
pkgtools/pkg_install/files/lib/version.h | 4 +-
pkgtools/pkg_install/files/lib/vulnerabilities-file.c | 34 ++++++++-----
14 files changed, 144 insertions(+), 136 deletions(-)
diffs (truncated from 857 to 300 lines):
diff -r e3b5bc1d3612 -r 72819d13bf1e pkgtools/pkg_install/Makefile
--- a/pkgtools/pkg_install/Makefile Wed Apr 19 21:27:31 2017 +0000
+++ b/pkgtools/pkg_install/Makefile Wed Apr 19 21:42:50 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.219 2017/01/03 17:53:14 jperkin Exp $
+# $NetBSD: Makefile,v 1.220 2017/04/19 21:42:50 joerg Exp $
# Notes to package maintainers:
#
@@ -104,8 +104,8 @@
VERSION!= ${AWK} '/PKGTOOLS_VERSION/ {print $$3}' \
${FILESDIR}/lib/version.h
-# raw format appeared in libarchive 2.8.
-BUILDLINK_API_DEPENDS.libarchive+= libarchive>=2.8.0
+# Requires 3.x filter API and bugfixes.
+BUILDLINK_API_DEPENDS.libarchive+= libarchive>=3.3.1
.include "../../archivers/bzip2/builtin.mk"
.include "../../archivers/xz/builtin.mk"
@@ -181,9 +181,9 @@
CPPFLAGS+= -I${WRKDIR}/libfetch
LDFLAGS+= -L${WRKDIR}/libfetch
# Avoid duplicate and conflicting headers, pull in any we need
-# directly with <netpgpgverify/*.h>
+# directly with <netpgpg/*.h>
CPPFLAGS+= -I${WRKDIR}
-LDFLAGS+= -L${WRKDIR}/netpgpverify
+LDFLAGS+= -L${WRKDIR}/netpgp
CONFIGURE_ENV+= LIBS=${LIBS:Q}
@@ -199,7 +199,7 @@
@${CP} -R ${FILESDIR.libarchive} ${WRKDIR}/libarchive
.endif
@${CP} -R ${FILESDIR.libfetch} ${WRKDIR}/libfetch
- @${CP} -R ${FILESDIR.netpgpverify} ${WRKDIR}/netpgpverify
+ @${CP} -R ${FILESDIR.netpgpverify} ${WRKDIR}/netpgp
pre-configure:
.if empty(USE_BUILTIN.bzip2:M[yY][eE][sS])
@@ -223,7 +223,7 @@
${SETENV} ${MAKE_ENV} ${BSD_MAKE_ENV} \
${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
-f ${MAKE_FILE} depend all
- cd ${WRKDIR}/netpgpverify && \
+ cd ${WRKDIR}/netpgp && \
${SED} -e '/zlib/d' Makefile.lib.in >Makefile.in && \
${RM} -f bzlib.h zlib.h && \
${CONFIG_SHELL} ${CONFIG_SHELL_FLAGS} ./configure && \
diff -r e3b5bc1d3612 -r 72819d13bf1e pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c Wed Apr 19 21:27:31 2017 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c Wed Apr 19 21:42:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.108 2015/12/27 12:36:42 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.109 2017/04/19 21:42:50 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.108 2015/12/27 12:36:42 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.109 2017/04/19 21:42:50 joerg Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -50,6 +50,7 @@
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -827,8 +828,7 @@
out:
if (!NoRecord)
pkgdb_close();
- archive_write_close(writer);
- archive_write_finish(writer);
+ archive_write_free(writer);
return r;
}
@@ -1373,9 +1373,7 @@
static int
pkg_do(const char *pkgpath, int mark_automatic, int top_level)
{
-#ifndef BOOTSTRAP
char *archive_name;
-#endif
int status, invalid_sig;
struct pkg_task *pkg;
@@ -1383,26 +1381,19 @@
status = -1;
-#ifdef BOOTSTRAP
- pkg->archive = archive_read_new();
- archive_read_support_compression_all(pkg->archive);
- archive_read_support_format_all(pkg->archive);
- if (archive_read_open_filename(pkg->archive, pkgpath, 1024)) {
- warnx("no pkg found for '%s', sorry.", pkgpath);
- archive_read_free(pkg->archive);
- goto clean_find_archive;
- }
-#else
pkg->archive = find_archive(pkgpath, top_level, &archive_name);
if (pkg->archive == NULL) {
warnx("no pkg found for '%s', sorry.", pkgpath);
goto clean_find_archive;
}
+#ifndef BOOTSTRAP
invalid_sig = pkg_verify_signature(archive_name, &pkg->archive, &pkg->entry,
&pkg->pkgname);
+#else
+ invalid_sig = 0;
+#endif
free(archive_name);
-#endif
if (pkg->archive == NULL)
goto clean_memory;
@@ -1572,7 +1563,7 @@
free_plist(&pkg->plist);
free_meta_data(pkg);
if (pkg->archive)
- archive_read_finish(pkg->archive);
+ archive_read_free(pkg->archive);
free(pkg->other_version);
free(pkg->pkgname);
clean_find_archive:
diff -r e3b5bc1d3612 -r 72819d13bf1e pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c Wed Apr 19 21:27:31 2017 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c Wed Apr 19 21:42:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.64 2015/01/02 14:26:16 wiz Exp $ */
+/* $NetBSD: main.c,v 1.65 2017/04/19 21:42:50 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.64 2015/01/02 14:26:16 wiz Exp $");
+__RCSID("$NetBSD: main.c,v 1.65 2017/04/19 21:42:50 joerg Exp $");
/*-
* Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -608,8 +608,8 @@
if (pkg_full_signature_check(archive_name, &pkg))
rc = 1;
free(archive_name);
- if (!pkg)
- archive_read_finish(pkg);
+ if (pkg != NULL)
+ archive_read_free(pkg);
}
return rc;
} else if (strcasecmp(argv[0], "x509-sign-package") == 0) {
diff -r e3b5bc1d3612 -r 72819d13bf1e pkgtools/pkg_install/files/create/build.c
--- a/pkgtools/pkg_install/files/create/build.c Wed Apr 19 21:27:31 2017 +0000
+++ b/pkgtools/pkg_install/files/create/build.c Wed Apr 19 21:42:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: build.c,v 1.16 2014/12/30 15:13:20 wiz Exp $ */
+/* $NetBSD: build.c,v 1.17 2017/04/19 21:42:50 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: build.c,v 1.16 2014/12/30 15:13:20 wiz Exp $");
+__RCSID("$NetBSD: build.c,v 1.17 2017/04/19 21:42:50 joerg Exp $");
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -233,6 +233,7 @@
archive = archive_write_new();
archive_write_set_format_pax_restricted(archive);
+ archive_write_set_options(archive, "hdrcharset=BINARY");
if ((resolver = archive_entry_linkresolver_new()) == NULL)
errx(2, "cannot create link resolver");
archive_entry_linkresolver_set_strategy(resolver,
@@ -250,20 +251,18 @@
}
if (strcmp(CompressionType, "bzip2") == 0)
- archive_write_set_compression_bzip2(archive);
+ archive_write_add_filter_bzip2(archive);
else if (strcmp(CompressionType, "gzip") == 0)
- archive_write_set_compression_gzip(archive);
+ archive_write_add_filter_gzip(archive);
else if (strcmp(CompressionType, "xz") == 0)
- archive_write_set_compression_xz(archive);
- else if (strcmp(CompressionType, "none") == 0)
- archive_write_set_compression_none(archive);
- else
+ archive_write_add_filter_xz(archive);
+ else if (strcmp(CompressionType, "none") != 0)
errx(1, "Unspported compression type for -F: %s",
CompressionType);
archive_name = xasprintf("%s.%s", pkg, suffix);
- if (archive_write_open_file(archive, archive_name))
+ if (archive_write_open_filename(archive, archive_name))
errx(2, "cannot create archive: %s", archive_error_string(archive));
free(archive_name);
@@ -324,9 +323,8 @@
archive_entry_linkresolver_free(resolver);
- if (archive_write_close(archive))
+ if (archive_write_free(archive))
errx(2, "cannot finish archive: %s", archive_error_string(archive));
- archive_write_finish(archive);
free(initial_cwd);
}
diff -r e3b5bc1d3612 -r 72819d13bf1e pkgtools/pkg_install/files/create/util.c
--- a/pkgtools/pkg_install/files/create/util.c Wed Apr 19 21:27:31 2017 +0000
+++ b/pkgtools/pkg_install/files/create/util.c Wed Apr 19 21:42:50 2017 +0000
@@ -39,27 +39,18 @@
#if HAVE_ERR_H
#include <err.h>
#endif
+#include <fcntl.h>
#if HAVE_PWD_H
#include <grp.h>
#endif
+#include <limits.h>
#if HAVE_PWD_H
#include <pwd.h>
#endif
-#if HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-#if HAVE_STRING_H
#include <string.h>
-#endif
-#if HAVE_TIME_H
#include <time.h>
-#endif
-#if HAVE_UNISTD_H
#include <unistd.h>
-#endif
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
#include "lib.h"
#include "create.h"
diff -r e3b5bc1d3612 -r 72819d13bf1e pkgtools/pkg_install/files/info/perform.c
--- a/pkgtools/pkg_install/files/info/perform.c Wed Apr 19 21:27:31 2017 +0000
+++ b/pkgtools/pkg_install/files/info/perform.c Wed Apr 19 21:42:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.62 2014/12/30 15:13:20 wiz Exp $ */
+/* $NetBSD: perform.c,v 1.63 2017/04/19 21:42:50 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,13 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-#if HAVE_SYS_QUEUE_H
-#include <sys/queue.h>
-#endif
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-__RCSID("$NetBSD: perform.c,v 1.62 2014/12/30 15:13:20 wiz Exp $");
+__RCSID("$NetBSD: perform.c,v 1.63 2017/04/19 21:42:50 joerg Exp $");
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -73,6 +67,12 @@
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
#ifndef BOOTSTRAP
#include <archive.h>
@@ -81,22 +81,13 @@
#if HAVE_ERR_H
Home |
Main Index |
Thread Index |
Old Index