1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-08 06:48:28 +00:00

Update to pkg 1.2.0 b1

Changes:
- Bug fixes in zsh completion
- Lots of bug fixes discovered by Coverity Scan
- New debug level traces
- Auto upgrade of pkg(8) now restart the upgrade process automatically
- Dependencies on library is now automatic via pkg register and pkg
  create
- YAML is replaced by UCL format:

  Both formats are really simular. pkg(8) will falls back on parsing YAML
  when the UCL parser fail. And will emit a warning to the
  user showing a syntax that is compatible with both YAML and UCL.
  More informations on UCL: https://github.com/vstakhov/libucl

- Do not generate catalogs in pkg 1.0 format anymore.
- Working ssh protocol supported for repositories
- New PKG_SSH_ARGS to allow passing custom arguments to ssh command
  used for the ssh:// protocol
- Allow using '?' operator in pkg query expressions
- New git like aliases to allow creating custom commands
- REPO_DIR is now a list instead of a simple string
- packagesite in pkg.conf is deprecated in favour using dedicated
  repository configuration files
- New 'fingerprint' kind of signature:

    if a repository is declared using the fingerprint type of
    signature, a fingerprint directory should also be provided.
    Inside that fingerprint directory should be 2 directories:
    trusted and revoked.  Those directories will contains files (in
    yaml/ucl format) containing the fingerprint of the trusted
    certificated and the revoked ones:

    --- begins --
    function: sha256
    fingerprint: an_hex_representation_of_the_fingerprint
    --- ends ---

    All unknown attribute will be silently ignored to allow extending
    in the future.

    It also support multiple signatures inside the catalog. the
    catalog should provide the signature in the following form:
    name.sig
    name.cert

- pkg add is now able to read the packages from a pipe or a non-regular
  file '-' is an alias for stdin, this also works from pipes, fifos,
  unix domain sockets etc.
- Support for pkg+foo url scheme where foo can be (http, https, ftp).
- pkg info now default on glob matching
- Print a pkg name only once - even if multiple vulns were found -
  when using -q
- Accept empty/comment only configuration files
- vuxml is now the default source for pkg audir
- expat is now bundled (for vuxml)
- pkg info -q is now equivalent of pkg info -qa
- in case pkg info is querying a file or is a single direct match
  query then default on -f
- pkg repo can now take new arguments:
  pkg repo [path] [rsa_key|'signing_command: <command>']

  This allow calling external command to perform the signing and
  pass the checksum to be signed in the command stdin.
- options can now have a description
- new pkg config subcommand to allow direct query of options
- ABI is now checked again using globs:
  a 'noarch' package should just specify: ARCH: 'freebsd:*'
  a package working on both i386 and amd64: ARCH: 'freebsd:9:x86:*'
- Broken incremental pkg repo support was removed.
- Lots of spelling/grammar fixes
- Properly support srv priority/weigh when ordering mirrors
- Use port specified in the SRV entries to connect to a given mirror
- New pkg bootstrap subcommand that is the counter part of the
  pkg(7) bootstrap subcommand
- Allow ARCH to be printed by pkg info
- Allow to hook plugins, before closing the local db if it was
  opened in RW mode
- Improved build system
This commit is contained in:
Baptiste Daroussin 2013-11-06 16:24:10 +00:00
parent a6873ba824
commit 101824f068
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=333010
17 changed files with 51 additions and 404 deletions

View File

@ -1,8 +1,7 @@
# $FreeBSD$
PORTNAME= pkg
DISTVERSION= 1.1.4
PORTREVISION= 8
DISTVERSION= 1.2.0.b1
CATEGORIES= ports-mgmt
MASTER_SITES= http://files.etoilebsd.net/pkg/ \
http://mirror.shatow.net/freebsd/${PORTNAME}/ \
@ -20,52 +19,14 @@ USE_XZ= yes
# With no dependency at all
NO_CCACHE= yes
USE_LDCONFIG= yes
MANCOMPRESSED= yes
USES= uidfix
MAKE_ENV+= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null \
PORTREVISION=${PORTREVISION}
USE_STAGE= yes
# Use a submake as 'deinstall install' needs to reevaluate PKG_CMD
# so that pkg-static is used from the wrkdir
USE_SUBMAKE= yes
MAN8= pkg.8 \
pkg-add.8 \
pkg-annotate.8 \
pkg-autoremove.8 \
pkg-audit.8 \
pkg-backup.8 \
pkg-check.8 \
pkg-clean.8 \
pkg-convert.8 \
pkg-create.8 \
pkg-delete.8 \
pkg-fetch.8 \
pkg-info.8 \
pkg-install.8 \
pkg-lock.8 \
pkg-query.8 \
pkg-register.8 \
pkg-repo.8 \
pkg-rquery.8 \
pkg-search.8 \
pkg-set.8 \
pkg-shell.8 \
pkg-shlib.8 \
pkg-stats.8 \
pkg-update.8 \
pkg-updating.8 \
pkg-upgrade.8 \
pkg-version.8 \
pkg-which.8
MAN5= pkg.conf.5 \
pkg-repository.5
MAN3= pkg_printf.3
MLINKS= pkg-delete.8 pkg-remove.8 \
pkg-lock.8 pkg-unlock.8 \
pkg.8 pkg-static.8
NO_STAGE= yes
.include <bsd.port.pre.mk>
.if defined(WITH_PKGNG)
@ -114,7 +75,7 @@ LATEST_LINK= pkg-devel
PKG_DEPENDS=
.undef INSTALLS_DEPENDS
.if !exists(${LOCALBASE}/sbin/pkg)
PKG_BIN= ${WRKSRC}/pkg-static/pkg-static
PKG_BIN= ${WRKSRC}/pkg/pkg-static
.endif
.endif
@ -123,7 +84,6 @@ PERIODIC_SECURITY= 410.pkg-audit 460.pkg-checksum
PERIODIC_ALL= ${PERIODIC_DAILY} ${PERIODIC_SECURITY}
post-install:
@${INSTALL_DATA} ${WRKSRC}/pkg/pkg.conf.sample ${PREFIX}/etc
@${CAT} ${PKGMESSAGE}
@${INSTALL_DATA} ${WRKSRC}/pkg/pkg.conf.sample ${STAGEDIR}${PREFIX}/etc
.include <bsd.port.post.mk>

View File

@ -1,2 +1,2 @@
SHA256 (pkg-1.1.4.tar.xz) = d84c9052f18c9d64cb369b9f3e8c1542f79f1152032169b1d28fbc2308c2dcbd
SIZE (pkg-1.1.4.tar.xz) = 1554804
SHA256 (pkg-1.2.0.b1.tar.xz) = e684525444a99d1f6dde5ba4eec42c293b4dc0b79bdfb67deb53325dc9639941
SIZE (pkg-1.2.0.b1.tar.xz) = 1787496

View File

@ -1,11 +0,0 @@
--- ./external/Makefile.orig 2013-07-06 05:48:19.000000000 -0500
+++ ./external/Makefile 2013-10-12 07:25:25.353758158 -0500
@@ -1,8 +1,6 @@
SUBDIR= sqlite
-.if !exists(/usr/include/bsdyml.h)
SUBDIR+= libyaml
-.endif
.if defined(WITH_BUNDLED_LIBELF)
SUBDIR+= libelf

View File

@ -1,15 +0,0 @@
--- ./libpkg/Makefile.orig 2013-07-06 05:48:19.000000000 -0500
+++ ./libpkg/Makefile 2013-10-12 07:25:25.353758158 -0500
@@ -82,12 +82,8 @@
-I${.CURDIR}/../external/sqlite \
-I${.CURDIR}/../external/uthash
-.if !exists(/usr/include/bsdyml.h)
CFLAGS+= -DBUNDLED_YAML -I ${.CURDIR}/../external/libyaml/include
LDADD+= -L${.OBJDIR}/../external/libyaml -lyaml
-.else
-LDADD+= -lbsdyml
-.endif
.if defined(WITH_BUNDLED_LIBELF)
CFLAGS+= -I${.CURDIR}/../external/libelf \

View File

@ -1,59 +0,0 @@
--- libpkg/packing.c.orig 2013-10-05 19:46:59.920058519 +0200
+++ libpkg/packing.c 2013-10-05 19:49:46.531103495 +0200
@@ -36,6 +36,8 @@
#include <string.h>
#include <sys/mman.h>
#include <limits.h>
+#include <pwd.h>
+#include <grp.h>
#include "pkg.h"
#include "private/event.h"
@@ -44,6 +46,7 @@
static const char *packing_set_format(struct archive *a, pkg_formats format);
struct packing {
+ bool pass;
struct archive *aread;
struct archive *awrite;
struct archive_entry_linkresolver *resolver;
@@ -67,6 +70,7 @@
archive_read_disk_set_symlink_physical((*pack)->aread);
if (!is_dir(path)) {
+ (*pack)->pass = false;
(*pack)->awrite = archive_write_new();
archive_write_set_format_pax_restricted((*pack)->awrite);
ext = packing_set_format((*pack)->awrite, format);
@@ -89,6 +93,7 @@
return EPKG_FATAL;
}
} else { /* pass mode directly write to the disk */
+ (*pack)->pass = true;
(*pack)->awrite = archive_write_disk_new();
archive_write_disk_set_options((*pack)->awrite,
EXTRACT_ARCHIVE_FLAGS);
@@ -177,11 +182,21 @@
archive_entry_set_size(entry, 0);
}
- if (uname != NULL && uname[0] != '\0')
+ if (uname != NULL && uname[0] != '\0') {
+ if (pack->pass) {
+ struct passwd *pw = getpwnam(uname);
+ archive_entry_set_uid(entry, pw->pw_uid);
+ }
archive_entry_set_uname(entry, uname);
+ }
- if (gname != NULL && gname[0] != '\0')
+ if (gname != NULL && gname[0] != '\0') {
+ if (pack->pass) {
+ struct group *gr = getgrnam(gname);
+ archive_entry_set_gid(entry, gr->gr_gid);
+ }
archive_entry_set_gname(entry, gname);
+ }
if (perm != 0)
archive_entry_set_perm(entry, perm);

View File

@ -1,47 +0,0 @@
--- libpkg/pkg.c.orig 2013-07-06 12:48:19.000000000 +0200
+++ libpkg/pkg.c 2013-10-05 19:45:16.675062417 +0200
@@ -1181,6 +1181,20 @@
struct pkg_dir *dir = NULL;
char spath[MAXPATHLEN + 1];
char dpath[MAXPATHLEN + 1];
+ bool disable_mtree;
+ const char *prefix;
+ char *mtree;
+
+ pkg_config_bool(PKG_CONFIG_DISABLE_MTREE, &disable_mtree);
+ if (!disable_mtree) {
+ pkg_get(pkg, PKG_PREFIX, &prefix, PKG_MTREE, &mtree);
+ do_extract_mtree(mtree, prefix);
+ }
+
+ /*
+ * Execute pre-install scripts
+ */
+ pkg_script_run(pkg, PKG_SCRIPT_PRE_INSTALL);
if (packing_init(&pack, dest, 0) != EPKG_OK) {
/* TODO */
@@ -1190,15 +1204,21 @@
while (pkg_dirs(pkg, &dir) == EPKG_OK) {
snprintf(spath, sizeof(spath), "%s%s", src, pkg_dir_path(dir));
snprintf(dpath, sizeof(dpath), "%s%s", dest, pkg_dir_path(dir));
- packing_append_file(pack, spath, dpath);
+ packing_append_file_attr(pack, spath, dpath,
+ dir->uname, dir->gname, dir->perm);
}
while (pkg_files(pkg, &file) == EPKG_OK) {
snprintf(spath, sizeof(spath), "%s%s", src, pkg_file_path(file));
snprintf(dpath, sizeof(dpath), "%s%s", dest, pkg_file_path(file));
- packing_append_file(pack, spath, dpath);
+ packing_append_file_attr(pack, spath, dpath,
+ file->uname, file->gname, file->perm);
}
+ /*
+ * Execute post install scripts
+ */
+ pkg_script_run(pkg, PKG_SCRIPT_POST_INSTALL);
return (packing_finish(pack));
}

View File

@ -1,11 +0,0 @@
--- ./libpkg/pkg.h.in.orig 2013-07-06 12:48:19.000000000 +0200
+++ ./libpkg/pkg.h.in 2013-09-19 20:59:25.679219359 +0200
@@ -626,7 +626,7 @@
#define PKG_CONTAINS_STATIC_LIBS (1U << 25)
#define PKG_CONTAINS_H_OR_LA (1U << 26)
-int pkg_analyse_files(struct pkgdb *, struct pkg *);
+int pkg_analyse_files(struct pkgdb *, struct pkg *, const char *stage);
/**
* Suggest if a package could be marked architecture independent or

View File

@ -1,11 +0,0 @@
--- libpkg/pkg_add.c.orig 2013-07-06 12:48:19.000000000 +0200
+++ libpkg/pkg_add.c 2013-09-24 14:22:38.561062335 +0200
@@ -100,7 +100,7 @@
return (retcode);
}
-static int
+int
do_extract_mtree(char *mtree, const char *prefix)
{
struct archive *a = NULL;

View File

@ -1,11 +0,0 @@
--- ./libpkg/pkg_create.c.orig 2013-09-24 16:27:05.716245523 -0500
+++ ./libpkg/pkg_create.c 2013-09-24 16:27:17.642245427 -0500
@@ -323,7 +323,7 @@
goto cleanup;
}
- if (pkg_files(pkg, &file) != EPKG_OK &&
+ if (0 && pkg_files(pkg, &file) != EPKG_OK &&
pkg_dirs(pkg, &dir) != EPKG_OK) {
/* Now traverse the file directories, adding to the archive */
packing_append_tree(pkg_archive, md_dir, NULL);

View File

@ -1,114 +0,0 @@
--- ./libpkg/pkg_elf.c.orig 2013-07-06 12:48:19.000000000 +0200
+++ ./libpkg/pkg_elf.c 2013-09-19 21:49:03.825014672 +0200
@@ -87,6 +87,8 @@
const char *name, bool is_shlib)
{
const char *pkgname, *pkgversion;
+ struct pkg_file *file = NULL;
+ const char *filepath;
switch(filter_system_shlibs(name, NULL, 0)) {
case EPKG_OK: /* A non-system library */
@@ -100,6 +102,15 @@
if (is_shlib)
return (EPKG_OK);
+ /* Search in libraries we do provide */
+ while (pkg_files(pkg, &file) == EPKG_OK) {
+ filepath = pkg_file_path(file);
+ if (strcmp(&filepath[strlen(filepath) - strlen(name)], name) == 0) {
+ pkg_addshlib_required(pkg, name);
+ return (EPKG_OK);
+ }
+ }
+
pkg_get(pkg, PKG_NAME, &pkgname, PKG_VERSION, &pkgversion);
warnx("(%s-%s) %s - shared library %s not found",
pkgname, pkgversion, fpath, name);
@@ -271,6 +282,10 @@
ret = EPKG_END; /* Some error occurred, ignore this file */
goto cleanup;
}
+ if (data->d_buf == NULL) {
+ ret = EPKG_END; /* No osname available */
+ goto cleanup;
+ }
osname = (const char *) data->d_buf + sizeof(Elf_Note);
if (strncasecmp(osname, "freebsd", sizeof("freebsd")) != 0 &&
strncasecmp(osname, "dragonfly", sizeof("dragonfly")) != 0) {
@@ -323,7 +338,7 @@
if (dyn->d_tag != DT_RPATH && dyn->d_tag != DT_RUNPATH)
continue;
- shlib_list_from_rpath(elf_strptr(e, sh_link, dyn->d_un.d_val),
+ shlib_list_from_rpath(elf_strptr(e, sh_link, dyn->d_un.d_val),
dirname(fpath));
break;
}
@@ -377,11 +392,11 @@
}
int
-pkg_analyse_files(struct pkgdb *db, struct pkg *pkg)
+pkg_analyse_files(struct pkgdb *db, struct pkg *pkg, const char *stage)
{
struct pkg_file *file = NULL;
int ret = EPKG_OK;
- const char *fpath;
+ char fpath[MAXPATHLEN];
bool autodeps = false;
bool developer = false;
int (*action)(void *, struct pkg *, const char *, const char *, bool);
@@ -410,7 +425,10 @@
PKG_CONTAINS_H_OR_LA);
while (pkg_files(pkg, &file) == EPKG_OK) {
- fpath = pkg_file_path(file);
+ if (stage != NULL)
+ snprintf(fpath, MAXPATHLEN, "%s/%s", stage, pkg_file_path(file));
+ else
+ strlcpy(fpath, pkg_file_path(file), MAXPATHLEN);
ret = analyse_elf(pkg, fpath, action, db);
if (developer) {
@@ -484,7 +502,7 @@
uint32_t version = 0;
int ret = EPKG_OK;
int i;
- const char *abi, *endian_corres_str, *wordsize_corres_str;
+ const char *abi, *endian_corres_str, *wordsize_corres_str, *fpu;
if (elf_version(EV_CURRENT) == EV_NONE) {
pkg_emit_error("ELF library initialization failed: %s",
@@ -569,10 +587,28 @@
endian_corres_str = elf_corres_to_string(endian_corres,
(int)elfhdr.e_ident[EI_DATA]);
+ /* FreeBSD doesn't support the hard-float ABI yet */
+ fpu = "softfp";
+ if ((elfhdr.e_flags & 0xFF000000) != 0) {
+ /* This is an EABI file, the conformance level is set */
+ abi = "eabi";
+ } else if (elfhdr.e_ident[EI_OSABI] != ELFOSABI_NONE) {
+ /*
+ * EABI executables all have this field set to
+ * ELFOSABI_NONE, therefore it must be an oabi file.
+ */
+ abi = "oabi";
+ } else {
+ /*
+ * We may have failed to positively detect the ABI,
+ * set the ABI to unknown. If we end up here one of
+ * the above cases should be fixed for the binary.
+ */
+ pkg_emit_error("unknown ARM ABI");
+ goto cleanup;
+ }
snprintf(dest + strlen(dest), sz - strlen(dest), ":%s:%s:%s",
- endian_corres_str,
- (elfhdr.e_flags & EF_ARM_NEW_ABI) > 0 ? "eabi" : "oabi",
- (elfhdr.e_flags & EF_ARM_VFP_FLOAT) > 0 ? "softfp" : "vfp");
+ endian_corres_str, abi, fpu);
break;
case EM_MIPS:
/*

View File

@ -1,11 +0,0 @@
--- ./libpkg/pkgdb.c.orig 2013-09-19 20:55:45.183234062 +0200
+++ ./libpkg/pkgdb.c 2013-09-19 20:55:15.578236583 +0200
@@ -2661,7 +2661,7 @@
return (EPKG_FATAL);
}
- if ((ret = pkg_analyse_files(db, pkg)) == EPKG_OK) {
+ if ((ret = pkg_analyse_files(db, pkg, NULL)) == EPKG_OK) {
if (!db->prstmt_initialized &&
prstmt_initialize(db) != EPKG_OK)
return (EPKG_FATAL);

View File

@ -1,13 +0,0 @@
--- ./libpkg/private/elf_tables.h.orig 2013-07-06 12:48:19.000000000 +0200
+++ ./libpkg/private/elf_tables.h 2013-09-19 21:52:03.661029778 +0200
@@ -59,7 +59,9 @@
{ -1, NULL }
};
-#define EF_MIPS_ABI 0x0000F000
+#ifndef EF_MIPS_ABI
+#define EF_MIPS_ABI 0x0000f000
+#endif
#define E_MIPS_ABI_O32 0x00001000
#define E_MIPS_ABI_N32 0x00000020

View File

@ -1,8 +0,0 @@
--- ./libpkg/private/pkg.h.orig 2013-09-24 14:56:39.000000000 +0200
+++ ./libpkg/private/pkg.h 2013-09-24 14:57:23.000000000 +0200
@@ -405,4 +405,5 @@
int pkg_emit_filelist(struct pkg *, FILE *);
int pkg_parse_manifest_archive(struct pkg *pkg, struct archive *a, struct pkg_manifest_key *keys);
+int do_extract_mtree(char *mtree, const char *prefix);
#endif

View File

@ -1,15 +0,0 @@
--- ./pkg-static/Makefile.orig 2013-07-06 05:48:19.000000000 -0500
+++ ./pkg-static/Makefile 2013-10-12 07:25:25.352756808 -0500
@@ -6,12 +6,8 @@
NOMAN= yes
LDADD_STATIC= -L${.OBJDIR}/../external/sqlite
-.if !exists(/usr/include/bsdyml.h)
LDADD_STATIC+= -L${.OBJDIR}/../external/libyaml \
-lyaml
-.else
-LDADD_STATIC+= -lbsdyml
-.endif
.if defined(WITH_BUNDLED_LIBELF)
LDADD_STATIC+= -L${.OBJDIR}/../external/libelf

View File

@ -1,11 +0,0 @@
--- ./pkg/register.c.orig 2013-09-19 20:56:18.299519000 +0200
+++ ./pkg/register.c 2013-09-19 20:56:34.568231772 +0200
@@ -285,7 +285,7 @@
*/
if (!testing_mode)
- pkg_analyse_files(db, pkg);
+ pkg_analyse_files(db, pkg, input_path);
pkg_get(pkg, PKG_ARCH, &arch);
if (arch == NULL) {

View File

@ -1,11 +0,0 @@
--- ./pkg/upgrade.c.orig 2013-09-25 07:37:38.657129024 -0500
+++ ./pkg/upgrade.c 2013-09-25 07:37:52.227152887 -0500
@@ -151,7 +151,7 @@
if (!quiet || dry_run) {
print_jobs_summary(jobs,
- "Uprgades have been requested for the following %d "
+ "Upgrades have been requested for the following %d "
"packages:\n\n", nbactions);
if (!yes && !dry_run)

View File

@ -1,19 +1,54 @@
etc/pkg.conf.sample
sbin/pkg
sbin/pkg-static
sbin/pkg2ng
include/pkg.h
lib/libpkg.so.1
lib/libpkg.so
lib/libpkg.a
etc/periodic/daily/400.status-pkg
etc/bash_completion.d/_pkg.bash
etc/periodic/daily/411.pkg-backup
etc/periodic/daily/490.status-pkg-changes
etc/periodic/security/410.pkg-audit
etc/periodic/security/460.pkg-checksum
etc/periodic/weekly/400.status-pkg
etc/pkg.conf.sample
include/pkg.h
lib/libpkg.a
lib/libpkg.so
lib/libpkg.so.1
libdata/pkgconfig/pkg.pc
man/man3/pkg_printf.3.gz
man/man5/pkg-repository.5.gz
man/man5/pkg.conf.5.gz
man/man8/pkg-add.8.gz
man/man8/pkg-annotate.8.gz
man/man8/pkg-audit.8.gz
man/man8/pkg-autoremove.8.gz
man/man8/pkg-backup.8.gz
man/man8/pkg-check.8.gz
man/man8/pkg-clean.8.gz
man/man8/pkg-convert.8.gz
man/man8/pkg-create.8.gz
man/man8/pkg-delete.8.gz
man/man8/pkg-fetch.8.gz
man/man8/pkg-info.8.gz
man/man8/pkg-install.8.gz
man/man8/pkg-lock.8.gz
man/man8/pkg-query.8.gz
man/man8/pkg-register.8.gz
man/man8/pkg-remove.8.gz
man/man8/pkg-repo.8.gz
man/man8/pkg-rquery.8.gz
man/man8/pkg-search.8.gz
man/man8/pkg-set.8.gz
man/man8/pkg-shell.8.gz
man/man8/pkg-shlib.8.gz
man/man8/pkg-static.8.gz
man/man8/pkg-stats.8.gz
man/man8/pkg-unlock.8.gz
man/man8/pkg-update.8.gz
man/man8/pkg-updating.8.gz
man/man8/pkg-upgrade.8.gz
man/man8/pkg-version.8.gz
man/man8/pkg-which.8.gz
man/man8/pkg.8.gz
sbin/pkg
sbin/pkg-static
sbin/pkg2ng
share/zsh/site-functions/_pkg
etc/bash_completion.d/_pkg.bash
@dirrmtry etc/bash_completion.d
@dirrmtry etc/periodic/daily
@dirrmtry etc/periodic/security