Commit bd298b04 authored by Shawn Webb's avatar Shawn Webb
Browse files

Merge tag '1.16.2' into hbsd/release/1.16

parents 1c64cd11 cae1057d
......@@ -74,55 +74,15 @@ scripts/sbin/pkg2ng
/scripts/Makefile
/src/Makefile
/tests/Makefile
/tests/frontend/test_environment.sh
/mk/defs.mk
/tests/Kyuafile
/tests/checksum
/tests/deps_formula
/tests/frontend/Kyuafile
/tests/frontend/add
/tests/frontend/alias
/tests/frontend/annotate
/tests/frontend/autoremove
/tests/frontend/autoupgrade
/tests/frontend/config
/tests/frontend/configmerge
/tests/frontend/conflicts
/tests/frontend/conflicts-multirepo
/tests/frontend/create
/tests/frontend/delete
/tests/frontend/extract
/tests/frontend/fingerprint
/tests/frontend/install
/tests/frontend/issue1374
/tests/frontend/issue1425
/tests/frontend/issue1440
/tests/frontend/issue1445
/tests/frontend/jpeg
/tests/frontend/lock
/tests/frontend/lua
/tests/frontend/messages
/tests/frontend/multipleprovider
/tests/frontend/packagemerge
/tests/frontend/packagesplit
/tests/frontend/php-pr
/tests/frontend/pkg
/tests/frontend/pubkey
/tests/frontend/query
/tests/frontend/register
/tests/frontend/repo
/tests/frontend/requires
/tests/frontend/rootdir
/tests/frontend/rubypuppet
/tests/frontend/search
/tests/frontend/set
/tests/frontend/update
/tests/frontend/updating
/tests/frontend/version
/tests/frontend/vital
/tests/frontend/clean
/tests/frontend/shellscript
/tests/frontend/backup_lib
# Almost everything in tests/frontend is generated aside from .sh and .in files.
/tests/frontend/*
!/tests/frontend/*.sh
!/tests/frontend/*.in
/tests/frontend/test_environment.sh
/tests/merge
/tests/pkg_add_dir_to_del
/tests/pkg_printf
......
Changes from 1.16.1 to 1.16.2
- libpkg: add a snap(shot) version prefix
- libpkg: only upgrade installed packages with pattern matches
- Document pkg-lock(8) accepts a list of packages
Changes from 1.16.1
- pkg audit: fix the quiet output
Changes from 1.15.99.8 to 1.16
- Release 1.16
- Fix a typo in pkg.conf(5)
......
......@@ -5,7 +5,7 @@ use cc cc-lib cc-shared pkg-config
set maj_ver 1
set med_ver 16
set min_ver 0
set min_ver 2
set dev_ver 0
define PKG_API [expr $maj_ver * 1000000 + $med_ver * 1000 + $min_ver]
define VERSION $maj_ver.$med_ver.$min_ver[expr {$dev_ver ? ".$dev_ver" : ""}]
......
......@@ -14,7 +14,7 @@
.\"
.\" @(#)pkg.8
.\"
.Dd May 13, 2018
.Dd January 6, 2021
.Dt PKG-ALIAS 8
.Os
.Sh NAME
......@@ -24,11 +24,12 @@
.Nm
.Op Fl q
.Op Fl l
.Op Ar alias
.Pp
.Nm "pkg alias"
.Op Fl -quiet
.Op Fl -list
.Ar [alias]
.Op Ar alias
.Sh DESCRIPTION
.Nm
displays configured aliases
......
......@@ -14,7 +14,7 @@
.\"
.\" @(#)pkg.8
.\"
.Dd April 14, 2015
.Dd January 14, 2021
.Dt PKG-LOCK 8
.Os
.Sh NAME
......@@ -28,14 +28,14 @@
.Nm
.Op Fl lqy
.Op Fl Cgix
.Ar pkg-name
.Ar pkg-name ...
.Nm "pkg unlock"
.Op Fl lqy
.Op Fl a
.Nm "pkg unlock"
.Op Fl lqy
.Op Fl Cgix
.Ar pkg-name
.Ar pkg-name ...
.Pp
.Nm
.Op Cm --{show-locked,quiet,yes}
......@@ -45,14 +45,14 @@
.Nm
.Op Cm --{show-locked,quiet,yes}
.Op Cm --{case-sensitive,glob,case-insensitive,regex}
.Ar pkg-name
.Ar pkg-name ...
.Nm "pkg unlock"
.Op Cm --{show-locked,quiet,yes}
.Op Cm --all
.Nm "pkg unlock"
.Op Cm --{show-locked,quiet,yes}
.Op Cm --{case-sensitive,glob,case-insensitive,regex}
.Ar pkg-name
.Ar pkg-name ...
.Sh DESCRIPTION
.Nm
is used to lock packages against reinstallation,
......
......@@ -95,7 +95,7 @@ pkg_create_from_dir(struct pkg *pkg, const char *root,
}
if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))) {
pkg_emit_error("file '%s' is not a regular file", fpath);
pkg_emit_error("file '%s' is not a regular file or symlink", fpath);
kh_destroy_hardlinks(hardlinks);
return (EPKG_FATAL);
}
......
......@@ -68,6 +68,7 @@
extern struct pkg_ctx ctx;
static int pkg_jobs_installed_local_pkg(struct pkg_jobs *j, struct pkg *pkg);
static int pkg_jobs_find_upgrade(struct pkg_jobs *j, const char *pattern, match_t m);
static int pkg_jobs_fetch(struct pkg_jobs *j);
static bool new_pkg_version(struct pkg_jobs *j);
......@@ -913,7 +914,7 @@ pkg_jobs_find_upgrade(struct pkg_jobs *j, const char *pattern, match_t m)
{
struct pkg *p = NULL;
struct pkgdb_it *it;
bool found = false;
bool checklocal, found = false;
int rc = EPKG_FATAL;
int with_version;
struct pkg_dep *rdep = NULL;
......@@ -926,7 +927,20 @@ pkg_jobs_find_upgrade(struct pkg_jobs *j, const char *pattern, match_t m)
if ((it = pkgdb_repo_query(j->db, pattern, m, j->reponame)) == NULL)
rc = EPKG_FATAL;
/*
* MATCH_EXACT is handled at a higher level, so that we can complain if a
* specific upgrade was requested without the package being locally installed.
*
* MATCH_ALL is a non-issue, because we will not get that from pkg-upgrade
* anyways.
* Pattern matches are the main target, as the above query may grab packages
* that are not installed that we can ignore.
*/
checklocal = j->type == PKG_JOBS_UPGRADE && m != MATCH_EXACT && m != MATCH_ALL;
while (it != NULL && pkgdb_it_next(it, &p, flags) == EPKG_OK) {
if (checklocal && pkg_jobs_installed_local_pkg(j, p) != EPKG_OK)
continue;
if (pattern != NULL) {
with_version = strcmp(p->name, pattern);
} else {
......@@ -996,6 +1010,16 @@ pkg_jobs_check_local_pkg(struct pkg_jobs *j, struct job_pattern *jp)
return (rc);
}
static int
pkg_jobs_installed_local_pkg(struct pkg_jobs *j, struct pkg *pkg)
{
struct job_pattern jfp;
jfp.match = MATCH_EXACT;
jfp.pattern = pkg->name;
return (pkg_jobs_check_local_pkg(j, &jfp));
}
static int
pkg_jobs_find_remote_pattern(struct pkg_jobs *j, struct job_pattern *jp)
{
......@@ -1003,13 +1027,14 @@ pkg_jobs_find_remote_pattern(struct pkg_jobs *j, struct job_pattern *jp)
struct pkg *pkg = NULL;
struct pkg_manifest_key *keys = NULL;
struct pkg_job_request *req;
struct job_pattern jfp;
if (!(jp->flags & PKG_PATTERN_FLAG_FILE)) {
if (j->type == PKG_JOBS_UPGRADE) {
if (j->type == PKG_JOBS_UPGRADE && jp->match == MATCH_EXACT) {
/*
* For upgrade patterns we must ensure that a local package is
* installed as well.
* installed as well. This only works if we're operating on an
* exact match, as we otherwise don't know exactly what packages
* are in store for us.
*/
if (pkg_jobs_check_local_pkg(j, jp) != EPKG_OK) {
pkg_emit_error("%s is not installed, therefore upgrade is impossible",
......@@ -1024,15 +1049,11 @@ pkg_jobs_find_remote_pattern(struct pkg_jobs *j, struct job_pattern *jp)
if (pkg_open(&pkg, jp->path, keys, PKG_OPEN_MANIFEST_ONLY) != EPKG_OK) {
rc = EPKG_FATAL;
} else if (pkg_validate(pkg, j->db) == EPKG_OK) {
if (j->type == PKG_JOBS_UPGRADE) {
jfp.match = MATCH_EXACT;
jfp.pattern = pkg->name;
if (pkg_jobs_check_local_pkg (j, &jfp) != EPKG_OK) {
pkg_emit_error("%s is not installed, therefore upgrade is impossible",
jfp.pattern);
pkg_manifest_keys_free(keys);
return (EPKG_NOTINSTALLED);
}
if (j->type == PKG_JOBS_UPGRADE && pkg_jobs_installed_local_pkg(j, pkg) != EPKG_OK) {
pkg_emit_error("%s is not installed, therefore upgrade is impossible",
pkg->name);
pkg_manifest_keys_free(keys);
return (EPKG_NOTINSTALLED);
}
pkg->type = PKG_FILE;
pkg_jobs_add_req(j, pkg);
......
......@@ -144,17 +144,18 @@ typedef struct {
* Oliver Eikemeier
*/
static const struct {
static const struct stage {
const char *name;
size_t namelen;
int value;
} stage[] = {
{ "pl", 2, 0 },
{ "alpha", 5, 'a'-'a'+1 },
{ "beta", 4, 'b'-'a'+1 },
{ "pre", 3, 'p'-'a'+1 },
{ "rc", 2, 'r'-'a'+1 },
{ NULL, 0, -1 }
} stages[] = {
{ "pl", 2, 0 },
{ "snap", 4, 1 },
#define ABASE 2 /* Last special early-sorted prefix + 1 */
{ "alpha", 5, 'a'-'a'+ABASE },
{ "beta", 4, 'b'-'a'+ABASE },
{ "pre", 3, 'p'-'a'+ABASE },
{ "rc", 2, 'r'-'a'+ABASE },
};
static const char *
......@@ -195,14 +196,15 @@ get_component(const char *position, version_component *component)
/* handle special suffixes */
if (isalpha(pos[1])) {
unsigned int i;
for (i = 0; stage[i].name; i++) {
size_t len = stage[i].namelen;
if (strncasecmp(pos, stage[i].name, len) == 0 &&
!isalpha(pos[stage[i].namelen])) {
for (i = 0; i < nitems(stages); i++) {
const struct stage *stage = &stages[i];
size_t len = stage->namelen;
if (strncasecmp(pos, stage->name, len) == 0 &&
!isalpha(pos[stage->namelen])) {
if (hasstage) {
/* stage to value */
component->a = stage[i].value;
pos += stage[i].namelen;
component->a = stage->value;
pos += stage->namelen;
} else {
/* insert dot */
component->a = 0;
......@@ -216,7 +218,7 @@ get_component(const char *position, version_component *component)
/* unhandled above */
if (c) {
/* use the first letter and skip following */
component->a = c - 'a' + 1;
component->a = c - 'a' + ABASE;
do {
++pos;
} while (isalpha(*pos));
......
......@@ -471,9 +471,10 @@ exec_audit(int argc, char **argv)
if (ret == EPKG_END && vuln == 0)
ret = EXIT_SUCCESS;
if (top == NULL && !quiet) {
printf("%u problem(s) in %u installed package(s) found.\n",
affected, vuln);
if (top == NULL) {
if (!quiet)
printf("%u problem(s) in %u installed package(s) found.\n",
affected, vuln);
} else {
ucl_object_insert_key(top, ucl_object_fromint(vuln), "pkg_count", 9, false );
......
......@@ -44,6 +44,7 @@ TESTS_SH= \
frontend/vital.sh \
frontend/update.sh \
frontend/updating.sh \
frontend/upgrade.sh \
frontend/issue1374.sh \
frontend/issue1425.sh \
frontend/issue1440.sh \
......
#! /usr/bin/env atf-sh
. $(atf_get_srcdir)/test_environment.sh
tests_init \
issue1881 \
issue1881_newdep
issue1881_body() {
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg1 pkg_a 1
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg2 pkg_a 1_1
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg3 pkg_b 1
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg4 pkg_b 1_1
atf_check \
-o match:".*Installing.*\.\.\.$" \
-e empty \
-s exit:0 \
pkg register -M pkg1.ucl
atf_check \
-o ignore \
-e empty \
-s exit:0 \
pkg create -M ./pkg3.ucl
atf_check \
-o ignore \
-e empty \
-s exit:0 \
pkg create -M ./pkg2.ucl
atf_check \
-o ignore \
-e empty \
-s exit:0 \
pkg create -M ./pkg4.ucl
atf_check \
-o inline:"Creating repository in .: done\nPacking files for repository: done\n" \
-e empty \
-s exit:0 \
pkg repo .
mkdir repoconf
cat << EOF > repoconf/repo.conf
local: {
url: file:///$TMPDIR,
enabled: true
}
EOF
atf_check \
-o not-match:"^[[:space:]]+pkg_b: 1$" \
-e ignore \
-s exit:0 \
pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" upgrade -yx '^pkg_'
}
issue1881_newdep_body() {
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg1 pkg_a 1
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg2 pkg_a 1_1
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg3 pkg_b 1
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg pkg4 pkg_b 1_1
cat <<EOF >> ./pkg2.ucl
deps: {
pkg_b: {
origin: "wedontcare",
version: "1"
}
}
EOF
atf_check \
-o match:".*Installing.*\.\.\.$" \
-e empty \
-s exit:0 \
pkg register -M pkg1.ucl
atf_check \
-o ignore \
-e empty \
-s exit:0 \
pkg create -M ./pkg3.ucl
atf_check \
-o ignore \
-e empty \
-s exit:0 \
pkg create -M ./pkg2.ucl
atf_check \
-o ignore \
-e empty \
-s exit:0 \
pkg create -M ./pkg4.ucl
atf_check \
-o inline:"Creating repository in .: done\nPacking files for repository: done\n" \
-e empty \
-s exit:0 \
pkg repo .
mkdir repoconf
cat << EOF > repoconf/repo.conf
local: {
url: file:///$TMPDIR,
enabled: true
}
EOF
atf_check \
-o match:"^[[:space:]]+pkg_b: 1_1$" \
-e ignore \
-s exit:0 \
pkg -o REPOS_DIR="$TMPDIR/repoconf" -o PKG_CACHEDIR="$TMPDIR" upgrade -yx '^pkg_'
}
......@@ -11,6 +11,15 @@ version_body() {
atf_check -o inline:">\n" -s exit:0 pkg version -t 2 1
atf_check -o inline:"=\n" -s exit:0 pkg version -t 2 2
atf_check -o inline:"<\n" -s exit:0 pkg version -t 2 1,1
# Special prefixes
atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pl1 1.alpha1
atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.alpha1 1.beta1
atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.beta1 1.pre1
atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pre1 1.rc1
atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.rc1 1
atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pl1 1.snap1
atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.snap1 1.alpha1
}
compare_body() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment