Commit 9b9eef51 authored by Shawn Webb's avatar Shawn Webb
Browse files

Merge branch 'upstream-master'

parents b9f22d5d 156c1c06
freebsd_task:
install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y kyua pkgconf mini_httpd
script:
- ./configure
- ./configure $EXTRA_ARGS
- make -j4 || make V=1
check_script: make check || { kyua report --verbose ; exit 1 ; }
matrix:
......@@ -14,38 +14,63 @@ freebsd_task:
- name: freebsd13-amd64
freebsd_instance:
image_family: freebsd-13-0-snap
#ubuntu_task:
# container:
# image: ubuntu:latest
# setup_script:
# - apt-get update
# - apt-get install -y libsqlite3-dev libbsd-dev libarchive-dev libssl-dev liblzma-dev liblua5.2-dev nettle-dev liblzo2-dev libattr1-dev libacl1-dev wget build-essential zlib1g-dev libbz2-dev m4 libexpat1-dev liblz4-dev libxml2-dev
# install_script: scripts/install_deps.sh
# script:
# - ./configure --with-libarchive.pc
# - make -j4 || make V=1
# check_script: make check || { kyua report --verbose ; exit 1 ; }
#
#osx_task:
# osx_instance:
# image: catalina-xcode
# install_script: scripts/install_deps.sh
# env:
# LDFLAGS: -L/usr/local/opt/libarchive/lib -L/usr/local/opt/openssl/lib
# CPPFLAGS: -I/usr/local/opt/libarchive/include -I/usr/local/opt/openssl/include
# CFLAGS: -I/usr/local/opt/libarchive/include -I/usr/local/opt/openssl/include
# script:
# - ./configure
# - make -j4 || make V=1
# check_script: make check || { kyua report --verbose ; exit 1 ;}
#
#fedora_task:
# container:
# image: fedora:latest
# install_script:
# - dnf -y upgrade
# - dnf -y install kyua libatf-c-devel libatf-sh-devel libatf-sh libbsd-devel gcc make zlib-devel bzip2-devel libarchive-devel openssl-devel xz-devel m4 lz4-devel expat-devel libxml2-devel libacl-devel libzstd-devel xz
# script:
# - ./configure --with-libarchive.pc
# - make -j4 || make V=1
# check_script: make check || { kyua report --verbose ; exit 1 ; }
- name: freebsd14-amd64
freebsd_instance:
image_family: freebsd-14-0-snap
env:
EXTRA_ARGS: --with-asan --with-ubsan
# There are still a few occurrences of this error (adding offset to NULL pointer)
CPPFLAGS: -fno-sanitize=pointer-overflow -ftrivial-auto-var-init=pattern
ubuntu_task:
container:
image: ubuntu:latest
setup_script:
- DEBIAN_FRONTEND=noninteractive apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y libsqlite3-dev libbsd-dev libarchive-tools libarchive-dev libssl-dev liblzma-dev liblua5.2-dev nettle-dev liblzo2-dev libattr1-dev libacl1-dev wget build-essential zlib1g-dev libbz2-dev m4 libexpat1-dev liblz4-dev libxml2-dev libzstd-dev
env:
# False-positive leak detection in recent glibc:
# Direct leak of 12 byte(s) in 2 object(s) allocated from:
# #0 0x7fe222e5d3cf in __interceptor_malloc (/lib64/libasan.so.6+0xab3cf)
# #1 0x7fe22260f08f in __vasprintf_internal (/lib64/libc.so.6+0x7f08f)
ASAN_OPTIONS: detect_leaks=0
install_script: scripts/install_deps.sh
script:
- ./configure --with-libarchive.pc --with-asan --with-ubsan
- make -j4 || make V=1
check_script: make check || { kyua report --verbose ; exit 1 ; }
osx_task:
osx_instance:
image: catalina-xcode
install_script: scripts/install_deps.sh
env:
LDFLAGS: -L/usr/local/opt/libarchive/lib -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/libarchive/include -I/usr/local/opt/openssl/include -ftrivial-auto-var-init=pattern
CXXFLAGS: -I/usr/local/opt/libarchive/include -I/usr/local/opt/openssl/include -ftrivial-auto-var-init=pattern
CFLAGS: -I/usr/local/opt/libarchive/include -I/usr/local/opt/openssl/include -ftrivial-auto-var-init=pattern
script:
- ./configure --with-asan --with-ubsan
- make -j4 || make V=1
check_script: make check || { kyua report --verbose ; exit 1 ;}
fedora_task:
container:
image: fedora:latest
env:
# False-positive leak detection in recent glibc:
# Direct leak of 12 byte(s) in 2 object(s) allocated from:
# #0 0x7fe222e5d3cf in __interceptor_malloc (/lib64/libasan.so.6+0xab3cf)
# #1 0x7fe22260f08f in __vasprintf_internal (/lib64/libc.so.6+0x7f08f)
ASAN_OPTIONS: detect_leaks=0
install_script:
- dnf -y upgrade
- dnf -y install gcc g++ make kyua libatf-c-devel libatf-sh-devel libatf-sh libbsd-devel zlib-devel
bzip2-devel libarchive-devel openssl-devel xz-devel m4 lz4-devel expat-devel
libxml2-devel libacl-devel libzstd-devel
libasan-static libubsan-static libasan-static libubsan-static
bsdtar diffutils openssl which xz
script:
- ./configure --with-libarchive.pc --with-asan --with-ubsan
- make -j4 || make V=1
check_script: make check || { kyua report --verbose ; exit 1 ; }
......@@ -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
......
......@@ -15,7 +15,8 @@ clean-profiles:
check: all
@if TESTS
export LLVM_PROFILE_FILE=/tmp/pkg.%p.profraw
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1; \
export LLVM_PROFILE_FILE=/tmp/pkg.%p.profraw; \
if [ "$(HTML)" != "" ]; then \
args="-r $(top_builddir)/res.db" ; \
fi ; \
......
Changes from 1.16.99.5 to 1.17.99.1
- fix plenty of typos
- add --no-script to autoremove
- deprecated meta file v1
Changes from 1.16.99.4 to 1.16.99.5
- allow to execute programs from lua script and triggers
- fetch vuln.xml.xz by default
- triggers detected by pkg -r are now deferred for firstboot
- pkg triggers command can be executed at first boot to run the
deferred triggers
Changes from 1.16.99.3 to 1.16.99.4
- expose the name of the packages to its scripts lua and shell
- plist: remove internal support for @*exec
- plist: remove support for @ignore
- plist: remove suppot for @dirrm/@dirrmtry
- plist: remove support for @pkgdep
- plist: remove stub support for @stopdaemon
- plist: remove stub support for @display
- plist: remove stub support for @mtree
- plist: remove stub support for @conflict
- info: fix info processing of mutliple compares
- ci runs again on linux and osx
- portability fixes for linux and osx
- ubsan/asan related fixes
Changes from 1.16.99.2 to 1.16.99.3
- lua update to 5.4.2
- pkg repo accept now all supported formats mixed without config
- pkg now default on creating .bsd files with backward compatible symlinks
- backward compatible symlinks are now an option
- make the default comprpession format a config option
- set the default compression level for zstd to 19
- make the default compression level a config option
- Update libucl to latest version
- change the package extension to .pkg (with symlink on the old format)
Changes from 1.16.99.1 to 1.16.99.2
- libpkg: rsa: stop leaking an RSA object
- libpkg: rsa: start abstracting away rsa bits
- lua: filecmp: Fix for symlink
Changes from 1.16.99.8 to 1.16.99.1
- Avoid making making xstring.h public
- audit: fix quiet
- libpkg: add a snap(shot) version prefix
- libpkg: only upgrade installed packages with pattern matches
- libpkg: accept an "rsa:" prefixed file for pkg_finish_repo()
Changes from 1.15.99.7 to 1.15.99.8
- Update documentation about configuration options
- Fix variable expansion while parsing pkg.conf and repositories
......
......@@ -79,3 +79,49 @@ Add some new ucl files in the ports tree do define groups of files instead of me
* Tests for pkg audit
* Improve tests for triggers
# pkg reposync/repomerge
Currently there is a race easily obtain when you pkg install blah and the remote repository
is synced.
The idea of reposync/repomerge is to address this issue by having a command that takes two
repository directories, one being the directory served by the webserver (named www below) and
the other being the newly created repository (named new below) and does:
* Open www/packagesite and rm all packages in www/All/ that aren't in it (this clean pkgs-1)
* Copy all new/All/* to www/All/
* Copy atomically meta.conf/meta.XXX/packagesite.XXX from new/ to www/
This leaves the new/ directory with the new packagesite, the new pkgs and the
pkgs-1 from the previous run.
# Alternatives
Alternatives are install in /usr/local/share/alternatives
For a given alternative X we have a subdirectory alternatives/X
Then a files with the various alternatives names for each alternative
alternatives/php/7.2
alternatives/php/7.4
A special alternatives is provided by the repo based on DEFAULT\_VERSION when
the alternative is version based, or a specific KNOBS when not based on version
this add a new file (symlink) to the package alternatives/php/default -> 7.2
The alternative file is a ucl file, with a list of symlinks:
Description: "yeah baby"
symlinks {
file1: target1
file2: target2
file3: target3
}
exec: { type = lua; script: ... },
exec: { type = shell; script: ...}
The exec part is an optional script which could be use to regenerate caches if needed for example
In case pkg 2 pkg have the default symlink then the regular conflict mechanism would be used
By default pkg priorize user defined default before package defined repo
if user defined repo to not exists then it switches to the global defaut if in non interactive
or as the user if in interractives mode
......@@ -4,9 +4,9 @@
use cc cc-lib cc-shared pkg-config
set maj_ver 1
set med_ver 15
set med_ver 17
set min_ver 99
set dev_ver 8
set dev_ver 1
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" : ""}]
......@@ -18,6 +18,7 @@ options {
with-coverage => "build with llvm coverage support"
with-asan => "build with libasan support"
with-ubsan => "Build with libubsan support"
default-format:txz => "Default compression format: tzst, txz (default), tbz, tar"
}
if {[opt-str pkgconfigdir dir]} {
......@@ -30,6 +31,21 @@ if {[opt-str pkgconfigdir dir]} {
}
}
# default compression format
if {[opt-str default-format fmt]} {
switch $fmt \
"tzst" { set comp TZS } \
"txz" { set comp TXZ } \
"tbz" { set comp TBZ } \
"tgz" { set comp TGZ } \
"tar" { set comp TAR } \
"default" { user-error "Invalid format $fmt" }
define DEFAULT_COMPRESSION $comp
} else {
define DEFAULT_COMPRESSION TXZ
}
cc-check-tools ar ranlib strip
define EXTRA_LIBS ""
......@@ -254,16 +270,24 @@ cc-with { -libs { -ljail} } {
# libbsd
cc-check-includes bsd/err.h bsd/libutil.h bsd/readpassphrase.h \
bsd/stdio.h bsd/strlib.h bsd/string.h bsd/sys/cdefs.h \
bsd/unistd.h
bsd/stdio.h bsd/stdlib.h bsd/strlib.h bsd/string.h \
bsd/sys/cdefs.h bsd/unistd.h
if {[opt-bool with-asan]} {
define-append ASAN_CFLAGS -O0 -ggdb -fsanitize=address
define-append ASAN_LDFLAGS -fsanitize=address
if {[string match *-linux* [get-define host]]} {
# ASAN depends on libdl for dlsym when building with GCC
define-append ASAN_LDFLAGS -ldl
}
define asan 1
undefine HAVE_STATIC
}
if {[opt-bool with-ubsan]} {
# Avoid alignment error when building with UBSan inside _mum_hash_avx2
define-append UBSAN_CFLAGS -D_MUM_UNALIGNED_ACCESS=0
define-append UBSAN_CFLAGS -O0 -ggdb -fsanitize=undefined
define-append UBSAN_LDFLAGS -fsanitize=undefined
define ubsan 1
}
if {[opt-bool with-coverage]} {
......@@ -320,7 +344,7 @@ if {[get-define CCACHE] ne {none}} {
define CC "[get-define CCACHE] [get-define CC]"
}
make-config-header pkg_config.h
make-config-header pkg_config.h -bare { DEFAULT_* }
make-config-header external/sqlite/config.h
make-template mk/defs.mk.in
make-template libpkg/pkg.h.in
......
README.autosetup created by autosetup v0.6.9+
README.autosetup created by autosetup v0.7.0+
This is the autosetup directory for a local install of autosetup.
It contains autosetup, support files and loadable modules.
......
......@@ -6,7 +6,7 @@
dir=`dirname "$0"`; exec "`$dir/autosetup-find-tclsh`" "$0" "$@"
# Note that the version has a trailing + on unreleased versions
set autosetup(version) 0.6.9+
set autosetup(version) 0.7.0+
# Can be set to 1 to debug early-init problems
set autosetup(debug) [expr {"--debug" in $argv}]
......
#!/bin/sh
# Looks for a suitable tclsh or jimsh in the PATH
# If not found, builds a bootstrap jimsh from source
# Prefer $autosetup_tclsh if is set in the environment
d=`dirname "$0"`
{ "$d/jimsh0" "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
PATH="$PATH:$d"; export PATH
for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
# If not found, builds a bootstrap jimsh in current dir from source
# Prefer $autosetup_tclsh if is set in the environment (unless ./jimsh0 works)
d="`dirname "$0"`"
for tclsh in ./jimsh0 $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6 tclsh8.7; do
{ $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
done
echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
for cc in ${CC_FOR_BUILD:-cc} gcc; do
{ $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
"$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
{ $cc -o jimsh0 "$d/jimsh0.c"; } 2>/dev/null || continue
./jimsh0 "$d/autosetup-test-tclsh" && exit 0
done
echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
echo false
......@@ -53,11 +53,12 @@ proc pkg-config-init {{required 1}} {
define SYSROOT [file-normalize $o]
msg-result "Using specified sysroot [get-define SYSROOT]"
} elseif {[get-define build] ne [get-define host]} {
if {[catch {exec-with-stderr [get-define CC] -print-sysroot} result errinfo] == 0} {
if {[catch {exec-with-stderr {*}[get-define CC] -print-sysroot} result errinfo] == 0} {
# Use the compiler sysroot, if there is one
define SYSROOT $result
msg-result "Found compiler sysroot $result"
} else {
configlog "[get-define CC] -print-sysroot: $result"
set msg "pkg-config: Cross compiling, but no compiler sysroot and no --sysroot supplied"
if {$required} {
user-error $msg
......
......@@ -64,6 +64,10 @@
#include <bsd/stdio.h>
#endif
#ifdef HAVE_BSD_STLIB_H
#include <bsd/stdlib.h>
#endif
#ifdef HAVE_BSD_ERR_H
#include <bsd/err.h>
#endif
......@@ -163,10 +167,12 @@ char * strnstr(const char *s, const char *find, size_t slen);
#endif
#ifndef __unreachable
# if defined(__GNUC__) && ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
# define __unreachable() __builtin_unreachable()
# elif defined(__clang__) && __has_builtin(__builtin_unreachable)
# if defined(__GNUC__) && ((__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6))
# define __unreachable() __builtin_unreachable()
# elif defined(__clang__)
# if __has_builtin(__builtin_unreachable)
# define __unreachable() __builtin_unreachable()
# endif
# else
# define __unreachable() ((void)0)
# endif
......
......@@ -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 May 25, 2014
.Dd May 3, 2021
.Dt PKG-AUTOREMOVE 8
.Os
.Sh NAME
......@@ -22,10 +22,10 @@
.Nd removes orphan packages
.Sh SYNOPSIS
.Nm
.Op Fl nqy
.Op Fl Dnqy
.Pp
.Nm
.Op Cm --{dry-run,quiet,yes}
.Op Cm --{dry-run,no-scripts,quiet,yes}
.Sh DESCRIPTION
.Nm
is used for removing orphan packages, which were installed
......@@ -38,6 +38,8 @@ The following options are supported by
Dry-run mode.
The list of changes to packages is always printed, but
no changes are actually made.
.It Fl D , Cm --no-scripts
If a deinstallation script exists for a given package, do not execute it.
.It Fl q , Cm --quiet
Force quiet output.
.It Fl y , Cm --yes
......
......@@ -83,11 +83,15 @@ These options are supported by
.Bl -tag -width dependencies
.It Fl a , Fl -all
Process all packages.
.It Fl B , Fl -shlibs
Regenerates the library dependency metadata for a package
.It Fl C , Fl -case-sensitive
Use case sensitive standard or regular expression
.Fl ( x )
matching with
.Ar pattern .
.It Fl d , Fl -dependencies
Checks for and installs missing dependencies
.It Fl g , Fl -glob
Treat
.Ar pattern
......@@ -103,6 +107,10 @@ has been set to true in
.Pa pkg.conf .
.It Fl n , Fl -dry-run
Only check for missing dependencies, do not install them.
.It Fl r , Fl -recompute
Recalculates and sets the checksums of installed packages
.It Fl s , Fl -checksums
Detects installed packages with invalid checksums
.It Fl v , Fl -verbose
Be verbose.
.It Fl q , Fl -quiet
......
......@@ -403,74 +403,6 @@ Available keywords are the following:
Set the internal directory pointer to point to
.Ar directory .
All subsequent filenames will be assumed relative to this directory.
.It Cm @preexec Ar Command
Execute
.Ar command
as part of the pre-install scripts.
.It Cm @preunexec Ar command
Execute
.Ar command
as part of the pre-deinstall scripts.
.It Cm @postexec Ar command
Execute
.Ar command
as part of the post-install scripts.
.It Cm @postunexec Ar command
Execute
.Ar command
as part of the post-deinstall scripts.
.It Cm @exec Ar command Pq deprecated
Execute
.Ar command
as part of the unpacking process.
If
.Ar command
contains any of the following sequences somewhere in it, they will
be expanded inline.
For the following examples, assume that
.Cm @cwd
is set to
.Pa /usr/local
and the last extracted file was
.Pa bin/emacs .
.Bl -tag -width indent -compact
.It Cm "%F"
Expands to the last filename extracted (as specified), in the example case
.Pa bin/emacs .
.It Cm "\&%D"
Expand to the current directory prefix, as set with
.Cm @cwd ,
in the example case
.Pa /usr/local .
.It Cm "\&%B"
Expand to the
.Dq basename
of the fully qualified filename, that is the current directory prefix,
plus the last filespec, minus the trailing filename.
In the example case, that would be
.Pa /usr/local/bin .
.It Cm "%f"
Expand to the filename part of the fully qualified name, or
the converse of
.Cm \&%B ,
being in the example case,
.Pa emacs .
.El
.It Cm @unexec Ar command Pq deprecated
Execute
.Ar command
as part of the deinstallation process.
Expansion of special
.Cm %
sequences is the same as for
.Cm @exec .
This command is not executed during the package add, as
.Cm @exec
is, but rather when the package is deleted.
This is useful for deleting links and other ancillary files that were
created as a result of adding the package, but not directly known to
the package's table of contents (and hence not automatically
removable).
.It Cm @mode Ar mode
Set default permission for all subsequently extracted files to
.Ar mode .
......@@ -513,6 +445,7 @@ Note: only one level of
.Cm @include
is allowed
.El
.Sh ESCAPE SEQUENCES
.\" ---------------------------------------------------------------------------
.Sh ENVIRONMENT
The following environment variables affect the execution of
......
......@@ -14,7 +14,7 @@
.\"
.\" @(#)pkg.8
.\"
.Dd March 3, 2016
.Dd April 8, 2021
.Dt PKG-DELETE 8
.Os
.Sh NAME
......@@ -30,11 +30,11 @@
.Fl a
.Pp
.Nm
.Op Cm --{no-deinstall-script,force,dry-run,quiet,recursive,yes}
.Op Cm --{no-scripts,force,dry-run,quiet,recursive,yes}
.Op Cm --{case-sensitive,glob,case-insensitive,regex}
.Ar pkg-name ...
.Nm
.Op Cm --{no-deinstall-script,dry-run,quiet,yes}
.Op Cm --{no-scripts,dry-run,quiet,yes}
.Cm --all
.Sh DESCRIPTION
.Nm
......@@ -83,7 +83,7 @@ Make the standard or regular expression
matching against
.Ar pkg-name
case sensitive.
.It Fl D , Cm --no-deinstall-script
.It Fl D , Cm --no-scripts
If a deinstallation script exists for a given package, do not execute it.
.It Fl f , Cm --force
Forces packages to be removed despite leaving unresolved dependencies.
......
......@@ -14,7 +14,7 @@
.\"
.\" @(#)pkg.8
.\"
.Dd May 7, 2016
.Dd April 8, 2021
.Dt PKG-INSTALL 8
.Os
.Sh NAME
......@@ -28,7 +28,7 @@
.Ar <pkg-origin|pkg-name|pkg-name-version> ...
.Pp
.Nm
.Op Cm --{automatic,force,no-install-scripts,ignore-missing}
.Op Cm --{automatic,force,no-scripts,ignore-missing}