mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 04:05:40 +03:00
Merge staging-next 2024-09-01 (#338840)
This commit is contained in:
commit
28e9b6d60f
165 changed files with 3812 additions and 1238 deletions
5
.github/CODEOWNERS
vendored
5
.github/CODEOWNERS
vendored
|
@ -387,3 +387,8 @@ pkgs/by-name/lx/lxc* @adamcstephens
|
|||
/pkgs/os-specific/linux/checkpolicy @RossComputerGuy
|
||||
/pkgs/os-specific/linux/libselinux @RossComputerGuy
|
||||
/pkgs/os-specific/linux/libsepol @RossComputerGuy
|
||||
|
||||
# installShellFiles
|
||||
/pkgs/by-name/in/installShellFiles/* @Ericson2314
|
||||
/pkgs/test/install-shell-files/* @Ericson2314
|
||||
/doc/hooks/installShellFiles.section.md @Ericson2314
|
||||
|
|
|
@ -157,6 +157,12 @@ Here are security considerations for this scenario:
|
|||
|
||||
In more concrete terms, if you use any other hash, the [`--insecure` flag](https://curl.se/docs/manpage.html#-k) will be passed to the underlying call to `curl` when downloading content.
|
||||
|
||||
## Proxy usage {#sec-pkgs-fetchers-proxy}
|
||||
|
||||
Nixpkgs fetchers can make use of a http(s) proxy. Each fetcher will automatically inherit proxy-related environment variables (`http_proxy`, `https_proxy`, etc) via [impureEnvVars](https://nixos.org/manual/nix/stable/language/advanced-attributes#adv-attr-impureEnvVars).
|
||||
|
||||
The environment variable `NIX_SSL_CERT_FILE` is also inherited in fetchers, and can be used to provide a custom certificate bundle to fetchers. This is usually required for a https proxy to work without certificate validation errors.
|
||||
|
||||
[]{#fetchurl}
|
||||
## `fetchurl` {#sec-pkgs-fetchers-fetchurl}
|
||||
|
||||
|
|
|
@ -1,16 +1,79 @@
|
|||
# `installShellFiles` {#installshellfiles}
|
||||
|
||||
This hook helps with installing manpages and shell completion files. It exposes 2 shell functions `installManPage` and `installShellCompletion` that can be used from your `postInstall` hook.
|
||||
This hook adds helpers that install artifacts like executable files, manpages
|
||||
and shell completions.
|
||||
|
||||
The `installManPage` function takes one or more paths to manpages to install. The manpages must have a section suffix, and may optionally be compressed (with `.gz` suffix). This function will place them into the correct `share/man/man<section>/` directory, in [`outputMan`](#outputman).
|
||||
It exposes the following functions that can be used from your `postInstall`
|
||||
hook:
|
||||
|
||||
The `installShellCompletion` function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of `--bash`, `--fish`, or `--zsh`. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag `--name NAME` before the path. If this flag is not provided, zsh completions will be renamed automatically such that `foobar.zsh` becomes `_foobar`. A root name may be provided for all paths using the flag `--cmd NAME`; this synthesizes the appropriate name depending on the shell (e.g. `--cmd foo` will synthesize the name `foo.bash` for bash and `_foo` for zsh).
|
||||
## `installBin` {#installshellfiles-installbin}
|
||||
|
||||
The `installBin` function takes one or more paths to files to install as
|
||||
executable files.
|
||||
|
||||
This function will place them into [`outputBin`](#outputbin).
|
||||
|
||||
### Example Usage {#installshellfiles-installbin-exampleusage}
|
||||
|
||||
```nix
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
# Sometimes the file has an undersirable name. It should be renamed before
|
||||
# being installed via installBin
|
||||
postInstall = ''
|
||||
mv a.out delmar
|
||||
installBin foobar delmar
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
## `installManPage` {#installshellfiles-installmanpage}
|
||||
|
||||
The `installManPage` function takes one or more paths to manpages to install.
|
||||
|
||||
The manpages must have a section suffix, and may optionally be compressed (with
|
||||
`.gz` suffix). This function will place them into the correct
|
||||
`share/man/man<section>/` directory in [`outputMan`](#outputman).
|
||||
|
||||
### Example Usage {#installshellfiles-installmanpage-exampleusage}
|
||||
|
||||
```nix
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
# Sometimes the manpage file has an undersirable name; e.g. it conflicts with
|
||||
# another software with an equal name. It should be renamed before being
|
||||
# installed via installManPage
|
||||
postInstall = ''
|
||||
mv fromsea.3 delmar.3
|
||||
installManPage foobar.1 delmar.3
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
## `installShellCompletion` {#installshellfiles-installshellcompletion}
|
||||
|
||||
The `installShellCompletion` function takes one or more paths to shell
|
||||
completion files.
|
||||
|
||||
By default it will autodetect the shell type from the completion file extension,
|
||||
but you may also specify it by passing one of `--bash`, `--fish`, or
|
||||
`--zsh`. These flags apply to all paths listed after them (up until another
|
||||
shell flag is given). Each path may also have a custom installation name
|
||||
provided by providing a flag `--name NAME` before the path. If this flag is not
|
||||
provided, zsh completions will be renamed automatically such that `foobar.zsh`
|
||||
becomes `_foobar`. A root name may be provided for all paths using the flag
|
||||
`--cmd NAME`; this synthesizes the appropriate name depending on the shell
|
||||
(e.g. `--cmd foo` will synthesize the name `foo.bash` for bash and `_foo` for
|
||||
zsh).
|
||||
|
||||
### Example Usage {#installshellfiles-installshellcompletion-exampleusage}
|
||||
|
||||
```nix
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
postInstall = ''
|
||||
installManPage doc/foobar.1 doc/barfoo.3
|
||||
# explicit behavior
|
||||
installShellCompletion --bash --name foobar.bash share/completions.bash
|
||||
installShellCompletion --fish --name foobar.fish share/completions.fish
|
||||
|
@ -21,9 +84,17 @@ The `installShellCompletion` function takes one or more paths to shell completio
|
|||
}
|
||||
```
|
||||
|
||||
The path may also be a fifo or named fd (such as produced by `<(cmd)`), in which case the shell and name must be provided (see below).
|
||||
The path may also be a fifo or named fd (such as produced by `<(cmd)`), in which
|
||||
case the shell and name must be provided (see below).
|
||||
|
||||
If the destination shell completion file is not actually present or consists of zero bytes after calling `installShellCompletion` this is treated as a build failure. In particular, if completion files are not vendored but are generated by running an executable, this is likely to fail in cross compilation scenarios. The result will be a zero byte completion file and hence a build failure. To prevent this, guard the completion commands against this, e.g.
|
||||
If the destination shell completion file is not actually present or consists of
|
||||
zero bytes after calling `installShellCompletion` this is treated as a build
|
||||
failure. In particular, if completion files are not vendored but are generated
|
||||
by running an executable, this is likely to fail in cross compilation
|
||||
scenarios. The result will be a zero byte completion file and hence a build
|
||||
failure. To prevent this, guard the completion generation commands.
|
||||
|
||||
### Example Usage {#installshellfiles-installshellcompletion-exampleusage-guarded}
|
||||
|
||||
```nix
|
||||
{
|
||||
|
|
|
@ -154,7 +154,7 @@ let
|
|||
defaultGemConfig = pkgs.defaultGemConfig // {
|
||||
pg = attrs: {
|
||||
buildFlags =
|
||||
[ "--with-pg-config=${pkgs."postgresql_${pg_version}"}/bin/pg_config" ];
|
||||
[ "--with-pg-config=${lib.getDev pkgs."postgresql_${pg_version}"}/bin/pg_config" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -172,7 +172,7 @@ let
|
|||
gemConfig = pkgs.defaultGemConfig // {
|
||||
pg = attrs: {
|
||||
buildFlags =
|
||||
[ "--with-pg-config=${pkgs."postgresql_${pg_version}"}/bin/pg_config" ];
|
||||
[ "--with-pg-config=${lib.getDev pkgs."postgresql_${pg_version}"}/bin/pg_config" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -190,9 +190,7 @@ let
|
|||
defaultGemConfig = super.defaultGemConfig // {
|
||||
pg = attrs: {
|
||||
buildFlags = [
|
||||
"--with-pg-config=${
|
||||
pkgs."postgresql_${pg_version}"
|
||||
}/bin/pg_config"
|
||||
"--with-pg-config=${lib.getDev pkgs."postgresql_${pg_version}"}/bin/pg_config"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
# by definition pure.
|
||||
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
|
||||
"HTTP_PROXY" "HTTPS_PROXY" "FTP_PROXY" "ALL_PROXY" "NO_PROXY"
|
||||
|
||||
# https proxies typically need to inject custom root CAs too
|
||||
"NIX_SSL_CERT_FILE"
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -298,8 +298,11 @@ let
|
|||
};
|
||||
wine = (pkgs.winePackagesFor "wine${toString final.parsed.cpu.bits}").minimal;
|
||||
in
|
||||
# Note: we guarantee that the return value is either `null` or a path
|
||||
# to an emulator program. That is, if an emulator requires additional
|
||||
# arguments, a wrapper should be used.
|
||||
if pkgs.stdenv.hostPlatform.canExecute final
|
||||
then "${pkgs.runtimeShell} -c '\"$@\"' --"
|
||||
then "${pkgs.execline}/bin/exec"
|
||||
else if final.isWindows
|
||||
then "${wine}/bin/wine${optionalString (final.parsed.cpu.bits == 64) "64"}"
|
||||
else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux && final.qemuArch != null
|
||||
|
|
|
@ -319,6 +319,8 @@
|
|||
|
||||
- PPD files for Utax printers got renamed (spaces replaced by underscores) in newest `foomatic-db` package; users of Utax printers might need to adapt their `hardware.printers.ensurePrinters.*.model` value.
|
||||
|
||||
- The `kvdo` kernel module package was removed, because it was upstreamed in kernel version 6.9, where it is called `dm-vdo`.
|
||||
|
||||
- `libe57format` has been updated to `>= 3.0.0`, which contains some backward-incompatible API changes. See the [release note](https://github.com/asmaloney/libE57Format/releases/tag/v3.0.0) for more details.
|
||||
|
||||
- `gitlab` deprecated support for *runner registration tokens* in GitLab 16.0, disabled their support in GitLab 17.0 and will
|
||||
|
@ -362,6 +364,8 @@
|
|||
|
||||
- Docker now defaults to 27.x, because version 24.x stopped receiving security updates and bug fixes after [February 1, 2024](https://github.com/moby/moby/pull/46772#discussion_r1686464084).
|
||||
|
||||
- `postgresql` was split into default and -dev outputs. To make this work without circular dependencies, the output of the `pg_config` system view has been removed. The `pg_config` binary is provided in the -dev output and still works as expected.
|
||||
|
||||
- `keycloak` was updated to version 25, which introduces new hostname related options.
|
||||
See [Upgrading Guide](https://www.keycloak.org/docs/25.0.1/upgrading/#migrating-to-25-0-0) for instructions.
|
||||
|
||||
|
@ -490,6 +494,8 @@
|
|||
|
||||
- The `shadowstack` hardening flag has been added, though disabled by default.
|
||||
|
||||
- `xxd` is now provided by the `tinyxxd` package, rather than `vim.xxd`, to reduce closure size and vulnerability impact. Since it has the same options and semantics as Vim's `xxd` utility, there is no user impact. Vim's `xxd` remains available as the `vim.xxd` package.
|
||||
|
||||
- `prometheus-openldap-exporter` was removed since it was unmaintained upstream and had no nixpkgs maintainers.
|
||||
|
||||
- `restic` module now has an option for inhibiting system sleep while backups are running, defaulting to off (not inhibiting sleep), available as [`services.restic.backups.<name>.inhibitsSleep`](#opt-services.restic.backups._name_.inhibitsSleep).
|
||||
|
|
|
@ -177,14 +177,8 @@ let
|
|||
mkdir -p $dst
|
||||
|
||||
# fonts.conf
|
||||
cp ${pkg.out}/etc/fonts/fonts.conf \
|
||||
ln -s ${pkg.out}/etc/fonts/fonts.conf \
|
||||
$dst/../fonts.conf
|
||||
|
||||
# horrible sed hack to add the line that was accidentally removed
|
||||
# from the default config in #324516
|
||||
# FIXME: fix that, revert this
|
||||
sed '5i <include ignore_missing="yes">/etc/fonts/conf.d</include>' -i $dst/../fonts.conf
|
||||
|
||||
# TODO: remove this legacy symlink once people stop using packages built before #95358 was merged
|
||||
mkdir -p $out/etc/fonts/2.11
|
||||
ln -s /etc/fonts/fonts.conf \
|
||||
|
|
|
@ -362,3 +362,7 @@ postgresql.withJIT.pname
|
|||
```
|
||||
|
||||
evaluates to `"foobar"`.
|
||||
|
||||
## Notable differences to upstream {#module-services-postgres-upstream-deviation}
|
||||
|
||||
- To avoid circular dependencies between default and -dev outputs, the output of the `pg_config` system view has been removed.
|
||||
|
|
|
@ -87,9 +87,14 @@ in {
|
|||
environment.systemPackages = [ pkgs.thin-provisioning-tools ];
|
||||
})
|
||||
(mkIf cfg.boot.vdo.enable {
|
||||
assertions = [{
|
||||
assertion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.9";
|
||||
message = "boot.vdo.enable requires at least kernel version 6.9";
|
||||
}];
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
kernelModules = [ "kvdo" ];
|
||||
kernelModules = [ "dm-vdo" ];
|
||||
|
||||
systemd.initrdBin = lib.mkIf config.boot.initrd.services.lvm.enable [ pkgs.vdo ];
|
||||
|
||||
|
@ -98,16 +103,15 @@ in {
|
|||
copy_bin_and_libs ${pkgs.vdo}/bin/$BIN
|
||||
done
|
||||
substituteInPlace $out/bin/vdorecover --replace "${pkgs.bash}/bin/bash" "/bin/sh"
|
||||
substituteInPlace $out/bin/adaptLVMVDO.sh --replace "${pkgs.bash}/bin/bash" "/bin/sh"
|
||||
substituteInPlace $out/bin/adaptlvm --replace "${pkgs.bash}/bin/bash" "/bin/sh"
|
||||
'';
|
||||
|
||||
extraUtilsCommandsTest = mkIf (!config.boot.initrd.systemd.enable)''
|
||||
ls ${pkgs.vdo}/bin/ | grep -vE '(adaptLVMVDO|vdorecover)' | while read BIN; do
|
||||
ls ${pkgs.vdo}/bin/ | grep -vE '(adaptlvm|vdorecover)' | while read BIN; do
|
||||
$out/bin/$(basename $BIN) --help > /dev/null
|
||||
done
|
||||
'';
|
||||
};
|
||||
extraModulePackages = [ config.boot.kernelPackages.kvdo ];
|
||||
};
|
||||
|
||||
services.lvm.package = mkOverride 999 pkgs.lvm2_vdo; # this overrides mkDefault
|
||||
|
|
|
@ -10,7 +10,7 @@ let
|
|||
tests = let callTest = p: lib.flip (import p) { inherit system pkgs; }; in {
|
||||
thinpool = { test = callTest ./thinpool.nix; kernelFilter = lib.id; };
|
||||
# we would like to test all versions, but the kernel module currently does not compile against the other versions
|
||||
vdo = { test = callTest ./vdo.nix; kernelFilter = lib.filter (v: v == "6.1"); };
|
||||
vdo = { test = callTest ./vdo.nix; kernelFilter = lib.filter (v: v == "latest"); };
|
||||
|
||||
|
||||
# systemd in stage 1
|
||||
|
@ -26,7 +26,7 @@ let
|
|||
};
|
||||
vdo-sd-stage-1 = {
|
||||
test = callTest ./systemd-stage-1.nix;
|
||||
kernelFilter = lib.filter (v: v == "6.1");
|
||||
kernelFilter = lib.filter (v: v == "latest");
|
||||
flavour = "vdo";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -63,11 +63,10 @@ libBuildHelper.extendMkDerivation' genericBuild (finalAttrs:
|
|||
/*
|
||||
recipe: Optional MELPA recipe.
|
||||
Default: a minimally functional recipe
|
||||
This can be a path of a recipe file, a string of the recipe content or an empty string.
|
||||
The default value is used if it is an empty string.
|
||||
*/
|
||||
, recipe ? (writeText "${finalAttrs.pname}-recipe" ''
|
||||
(${finalAttrs.ename} :fetcher git :url ""
|
||||
${lib.optionalString (finalAttrs.files != null) ":files ${finalAttrs.files}"})
|
||||
'')
|
||||
, recipe ? ""
|
||||
, preUnpack ? ""
|
||||
, postUnpack ? ""
|
||||
, meta ? {}
|
||||
|
@ -98,9 +97,21 @@ libBuildHelper.extendMkDerivation' genericBuild (finalAttrs:
|
|||
|
||||
preUnpack = ''
|
||||
mkdir -p "$NIX_BUILD_TOP/recipes"
|
||||
if [ -n "$recipe" ]; then
|
||||
cp "$recipe" "$NIX_BUILD_TOP/recipes/$ename"
|
||||
recipeFile="$NIX_BUILD_TOP/recipes/$ename"
|
||||
if [ -r "$recipe" ]; then
|
||||
ln -s "$recipe" "$recipeFile"
|
||||
nixInfoLog "link recipe"
|
||||
elif [ -n "$recipe" ]; then
|
||||
printf "%s" "$recipe" > "$recipeFile"
|
||||
nixInfoLog "write recipe"
|
||||
else
|
||||
cat > "$recipeFile" <<'EOF'
|
||||
(${finalAttrs.ename} :fetcher git :url "" ${lib.optionalString (finalAttrs.files != null) ":files ${finalAttrs.files}"})
|
||||
EOF
|
||||
nixInfoLog "use default recipe"
|
||||
fi
|
||||
nixInfoLog "recipe content:" "$(< $recipeFile)"
|
||||
unset -v recipeFile
|
||||
|
||||
ln -s "$packageBuild" "$NIX_BUILD_TOP/package-build"
|
||||
|
||||
|
@ -115,6 +126,11 @@ libBuildHelper.extendMkDerivation' genericBuild (finalAttrs:
|
|||
buildPhase = args.buildPhase or ''
|
||||
runHook preBuild
|
||||
|
||||
# This is modified from stdenv buildPhase. foundMakefile is used in stdenv checkPhase.
|
||||
if [[ ! ( -z "''${makeFlags-}" && -z "''${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ) ]]; then
|
||||
foundMakefile=1
|
||||
fi
|
||||
|
||||
pushd "$NIX_BUILD_TOP"
|
||||
|
||||
emacs --batch -Q \
|
||||
|
|
|
@ -14,6 +14,11 @@ args:
|
|||
buildPhase = args.buildPhase or ''
|
||||
runHook preBuild
|
||||
|
||||
# This is modified from stdenv buildPhase. foundMakefile is used in stdenv checkPhase.
|
||||
if [[ ! ( -z "''${makeFlags-}" && -z "''${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ) ]]; then
|
||||
foundMakefile=1
|
||||
fi
|
||||
|
||||
emacs -L . --batch -f batch-byte-compile *.el
|
||||
|
||||
runHook postBuild
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, fetchFromGitHub }:
|
||||
rec {
|
||||
version = "9.1.0689";
|
||||
version = "9.1.0707";
|
||||
|
||||
outputs = [ "out" "xxd" ];
|
||||
|
||||
|
@ -8,7 +8,7 @@ rec {
|
|||
owner = "vim";
|
||||
repo = "vim";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-87y/STnGB2Yf64TMwCd6VCFF2kvy+DmNyaXVKPIc86E=";
|
||||
hash = "sha256-iHOLABPk5B7Sh7EBYnM7wdxnK2Wv7q4WS3FEp780SV4=";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
|
|
@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
nativeBuildInputs = [ pkg-config qmake wrapQtAppsHook ];
|
||||
qmakeFlags = [ "pgmodeler.pro" "CONFIG+=release" ] ++ lib.optionals stdenv.isDarwin [
|
||||
"PGSQL_INC=${postgresql}/include"
|
||||
"PGSQL_LIB=${postgresql.lib}/lib/libpq.dylib"
|
||||
"PGSQL_INC=${lib.getDev postgresql}/include"
|
||||
"PGSQL_LIB=${lib.getLib postgresql}/lib/libpq.dylib"
|
||||
"XML_INC=${libxml2.dev}/include/libxml2"
|
||||
"XML_LIB=${libxml2.out}/lib/libxml2.dylib"
|
||||
"PREFIX=${placeholder "out"}/Applications/pgModeler.app/Contents"
|
||||
|
|
|
@ -74,7 +74,7 @@ let
|
|||
];
|
||||
gemConfig = defaultGemConfig // {
|
||||
pg = attrs: {
|
||||
buildFlags = [ "--with-pg-config=${postgresql}/bin/pg_config" ];
|
||||
buildFlags = [ "--with-pg-config=${lib.getDev postgresql}/bin/pg_config" ];
|
||||
};
|
||||
rszr = attrs: {
|
||||
buildInputs = [ imlib2 imlib2.dev ];
|
||||
|
|
|
@ -67,7 +67,7 @@ stdenvNoCC.mkDerivation {
|
|||
builder = ./builder.sh;
|
||||
fetcher = ./nix-prefetch-git;
|
||||
|
||||
nativeBuildInputs = [ git ]
|
||||
nativeBuildInputs = [ git cacert ]
|
||||
++ lib.optionals fetchLFS [ git-lfs ];
|
||||
|
||||
outputHashAlgo = if hash != "" then null else "sha256";
|
||||
|
@ -94,8 +94,6 @@ stdenvNoCC.mkDerivation {
|
|||
export HOME=$PWD
|
||||
'';
|
||||
|
||||
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ netrcImpureEnvVars ++ [
|
||||
"GIT_PROXY_COMMAND" "NIX_GIT_SSL_CAINFO" "SOCKS_SERVER"
|
||||
];
|
||||
|
|
|
@ -17,9 +17,9 @@ branchName=$NIX_PREFETCH_GIT_BRANCH_NAME
|
|||
out=${out:-}
|
||||
http_proxy=${http_proxy:-}
|
||||
|
||||
# allow overwriting cacert's ca-bundle.crt with a custom one
|
||||
# this can be done by setting NIX_GIT_SSL_CAINFO and NIX_SSL_CERT_FILE environment variables for the nix-daemon
|
||||
GIT_SSL_CAINFO=${NIX_GIT_SSL_CAINFO:-$GIT_SSL_CAINFO}
|
||||
# NOTE: use of NIX_GIT_SSL_CAINFO is for backwards compatibility; NIX_SSL_CERT_FILE is preferred
|
||||
# as of PR#303307
|
||||
GIT_SSL_CAINFO=${NIX_GIT_SSL_CAINFO:-$NIX_SSL_CERT_FILE}
|
||||
|
||||
# populated by clone_user_rev()
|
||||
fullRev=
|
||||
|
|
|
@ -136,6 +136,7 @@ in
|
|||
exit 10
|
||||
fi
|
||||
|
||||
export GIT_SSL_CAINFO=$NIX_SSL_CERT_FILE
|
||||
${if finalAttrs.proxyVendor then ''
|
||||
mkdir -p "''${GOPATH}/pkg/mod/cache/download"
|
||||
go mod download
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{ makeSetupHook, tests }:
|
||||
|
||||
# See the header comment in ../setup-hooks/install-shell-files.sh for example usage.
|
||||
let
|
||||
setupHook = makeSetupHook { name = "install-shell-files"; } ../setup-hooks/install-shell-files.sh;
|
||||
in
|
||||
|
||||
setupHook.overrideAttrs (oldAttrs: {
|
||||
passthru = (oldAttrs.passthru or {}) // {
|
||||
tests = tests.install-shell-files;
|
||||
};
|
||||
})
|
|
@ -4,8 +4,11 @@ autoreconfPhase() {
|
|||
runHook preAutoreconf
|
||||
|
||||
local flagsArray=()
|
||||
: "${autoreconfFlags:=--install --force --verbose}"
|
||||
concatTo flagsArray autoreconfFlags
|
||||
if [[ -v autoreconfFlags ]]; then
|
||||
concatTo flagsArray autoreconfFlags
|
||||
else
|
||||
flagsArray+=(--install --force --verbose)
|
||||
fi
|
||||
|
||||
autoreconf "${flagsArray[@]}"
|
||||
runHook postAutoreconf
|
||||
|
|
|
@ -90,8 +90,8 @@ patchShebangs() {
|
|||
if [[ $arg0 == "-S" ]]; then
|
||||
arg0=${args%% *}
|
||||
args=${args#* }
|
||||
newPath="$(PATH="${!pathName}" command -v "env" || true)"
|
||||
args="-S $(PATH="${!pathName}" command -v "$arg0" || true) $args"
|
||||
newPath="$(PATH="${!pathName}" type -P "env" || true)"
|
||||
args="-S $(PATH="${!pathName}" type -P "$arg0" || true) $args"
|
||||
|
||||
# Check for unsupported 'env' functionality:
|
||||
# - options: something starting with a '-' besides '-S'
|
||||
|
@ -100,7 +100,7 @@ patchShebangs() {
|
|||
echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" >&2
|
||||
exit 1
|
||||
else
|
||||
newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"
|
||||
newPath="$(PATH="${!pathName}" type -P "$arg0" || true)"
|
||||
fi
|
||||
else
|
||||
if [[ -z $oldPath ]]; then
|
||||
|
@ -109,7 +109,7 @@ patchShebangs() {
|
|||
oldPath="/bin/sh"
|
||||
fi
|
||||
|
||||
newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"
|
||||
newPath="$(PATH="${!pathName}" type -P "$(basename "$oldPath")" || true)"
|
||||
|
||||
args="$arg0 $args"
|
||||
fi
|
||||
|
|
|
@ -14,9 +14,8 @@ bmakeBuildPhase() {
|
|||
local flagsArray=(
|
||||
${enableParallelBuilding:+-j${NIX_BUILD_CORES}}
|
||||
SHELL="$SHELL"
|
||||
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
|
||||
$buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"}
|
||||
)
|
||||
concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray
|
||||
|
||||
echoCmd 'build flags' "${flagsArray[@]}"
|
||||
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
||||
|
@ -42,11 +41,8 @@ bmakeCheckPhase() {
|
|||
local flagsArray=(
|
||||
${enableParallelChecking:+-j${NIX_BUILD_CORES}}
|
||||
SHELL="$SHELL"
|
||||
# Old bash empty array hack
|
||||
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
|
||||
${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"}
|
||||
${checkTarget}
|
||||
)
|
||||
concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget
|
||||
|
||||
echoCmd 'check flags' "${flagsArray[@]}"
|
||||
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
||||
|
@ -65,11 +61,8 @@ bmakeInstallPhase() {
|
|||
local flagsArray=(
|
||||
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
|
||||
SHELL="$SHELL"
|
||||
# Old bash empty array hack
|
||||
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
|
||||
$installFlags ${installFlagsArray+"${installFlagsArray[@]}"}
|
||||
${installTargets:-install}
|
||||
)
|
||||
concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install
|
||||
|
||||
echoCmd 'install flags' "${flagsArray[@]}"
|
||||
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
||||
|
@ -84,10 +77,8 @@ bmakeDistPhase() {
|
|||
mkdir -p "$prefix"
|
||||
fi
|
||||
|
||||
# Old bash empty array hack
|
||||
local flagsArray=(
|
||||
$distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist}
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray distFlags distFlagsArray distTarget=dist
|
||||
|
||||
echo 'dist flags: %q' "${flagsArray[@]}"
|
||||
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
||||
|
|
16
pkgs/by-name/in/installShellFiles/package.nix
Normal file
16
pkgs/by-name/in/installShellFiles/package.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
lib,
|
||||
callPackage,
|
||||
makeSetupHook,
|
||||
}:
|
||||
|
||||
# See the header comment in ./setup-hook.sh for example usage.
|
||||
makeSetupHook {
|
||||
name = "install-shell-files";
|
||||
passthru = {
|
||||
tests = lib.packagesFromDirectoryRecursive {
|
||||
inherit callPackage;
|
||||
directory = ./tests;
|
||||
};
|
||||
};
|
||||
} ./setup-hook.sh
|
|
@ -24,19 +24,17 @@
|
|||
installManPage() {
|
||||
local path
|
||||
for path in "$@"; do
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "installManPage: installing $path"
|
||||
fi
|
||||
if test -z "$path"; then
|
||||
echo "installManPage: error: path cannot be empty" >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: path cannot be empty"
|
||||
return 1
|
||||
fi
|
||||
nixInfoLog "${FUNCNAME[0]}: installing $path"
|
||||
local basename
|
||||
basename=$(stripHash "$path") # use stripHash in case it's a nix store path
|
||||
local trimmed=${basename%.gz} # don't get fooled by compressed manpages
|
||||
local suffix=${trimmed##*.}
|
||||
if test -z "$suffix" -o "$suffix" = "$trimmed"; then
|
||||
echo "installManPage: error: path missing manpage section suffix: $path" >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: path missing manpage section suffix: $path"
|
||||
return 1
|
||||
fi
|
||||
local outRoot
|
||||
|
@ -45,7 +43,8 @@ installManPage() {
|
|||
else
|
||||
outRoot=${!outputMan:?}
|
||||
fi
|
||||
install -Dm644 -T "$path" "${outRoot}/share/man/man$suffix/$basename" || return
|
||||
local outPath="${outRoot}/share/man/man$suffix/$basename"
|
||||
install -D --mode=644 --no-target-directory "$path" "$outPath"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -107,7 +106,7 @@ installShellCompletion() {
|
|||
--name)
|
||||
name=$1
|
||||
shift || {
|
||||
echo 'installShellCompletion: error: --name flag expected an argument' >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: --name flag expected an argument"
|
||||
return 1
|
||||
}
|
||||
continue;;
|
||||
|
@ -118,7 +117,7 @@ installShellCompletion() {
|
|||
--cmd)
|
||||
cmdname=$1
|
||||
shift || {
|
||||
echo 'installShellCompletion: error: --cmd flag expected an argument' >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: --cmd flag expected an argument"
|
||||
return 1
|
||||
}
|
||||
continue;;
|
||||
|
@ -127,7 +126,7 @@ installShellCompletion() {
|
|||
cmdname=${arg#--cmd=}
|
||||
continue;;
|
||||
--?*)
|
||||
echo "installShellCompletion: warning: unknown flag ${arg%%=*}" >&2
|
||||
nixWarnLog "${FUNCNAME[0]}: unknown flag ${arg%%=*}"
|
||||
retval=2
|
||||
continue;;
|
||||
--)
|
||||
|
@ -136,23 +135,21 @@ installShellCompletion() {
|
|||
continue;;
|
||||
esac
|
||||
fi
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "installShellCompletion: installing $arg${name:+ as $name}"
|
||||
fi
|
||||
nixInfoLog "${FUNCNAME[0]}: installing $arg${name:+ as $name}"
|
||||
# if we get here, this is a path or named pipe
|
||||
# Identify shell and output name
|
||||
local curShell=$shell
|
||||
local outName=''
|
||||
if [[ -z "$arg" ]]; then
|
||||
echo "installShellCompletion: error: empty path is not allowed" >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: empty path is not allowed"
|
||||
return 1
|
||||
elif [[ -p "$arg" ]]; then
|
||||
# this is a named fd or fifo
|
||||
if [[ -z "$curShell" ]]; then
|
||||
echo "installShellCompletion: error: named pipe requires one of --bash, --fish, or --zsh" >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --bash, --fish, or --zsh"
|
||||
return 1
|
||||
elif [[ -z "$name" && -z "$cmdname" ]]; then
|
||||
echo "installShellCompletion: error: named pipe requires one of --cmd or --name" >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --cmd or --name"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
|
@ -168,10 +165,10 @@ installShellCompletion() {
|
|||
*)
|
||||
if [[ "$argbase" = _* && "$argbase" != *.* ]]; then
|
||||
# probably zsh
|
||||
echo "installShellCompletion: warning: assuming path \`$arg' is zsh; please specify with --zsh" >&2
|
||||
nixWarnLog "${FUNCNAME[0]}: assuming path \`$arg' is zsh; please specify with --zsh"
|
||||
curShell=zsh
|
||||
else
|
||||
echo "installShellCompletion: warning: unknown shell for path: $arg" >&2
|
||||
nixWarnLog "${FUNCNAME[0]}: unknown shell for path: $arg" >&2
|
||||
retval=2
|
||||
continue
|
||||
fi;;
|
||||
|
@ -188,7 +185,7 @@ installShellCompletion() {
|
|||
zsh) outName=_$cmdname;;
|
||||
*)
|
||||
# Our list of shells is out of sync with the flags we accept or extensions we detect.
|
||||
echo 'installShellCompletion: internal error' >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: internal: shell $curShell not recognized"
|
||||
return 1;;
|
||||
esac
|
||||
fi
|
||||
|
@ -206,7 +203,7 @@ installShellCompletion() {
|
|||
fi;;
|
||||
*)
|
||||
# Our list of shells is out of sync with the flags we accept or extensions we detect.
|
||||
echo 'installShellCompletion: internal error' >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: internal: shell $curShell not recognized"
|
||||
return 1;;
|
||||
esac
|
||||
# Install file
|
||||
|
@ -217,19 +214,43 @@ installShellCompletion() {
|
|||
mkdir -p "$outDir" \
|
||||
&& cat "$arg" > "$outPath"
|
||||
else
|
||||
install -Dm644 -T "$arg" "$outPath"
|
||||
fi || return
|
||||
install -D --mode=644 --no-target-directory "$arg" "$outPath"
|
||||
fi
|
||||
|
||||
if [ ! -s "$outPath" ]; then
|
||||
echo "installShellCompletion: error: installed shell completion file \`$outPath' does not exist or has zero size" >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: installed shell completion file \`$outPath' does not exist or has zero size"
|
||||
return 1
|
||||
fi
|
||||
# Clear the per-path flags
|
||||
name=
|
||||
done
|
||||
if [[ -n "$name" ]]; then
|
||||
echo 'installShellCompletion: error: --name flag given with no path' >&2
|
||||
nixErrorLog "${FUNCNAME[0]}: --name flag given with no path" >&2
|
||||
return 1
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
|
||||
# installBin <path> [...<path>]
|
||||
#
|
||||
# Install each argument to $outputBin
|
||||
installBin() {
|
||||
local path
|
||||
for path in "$@"; do
|
||||
if test -z "$path"; then
|
||||
nixErrorLog "${FUNCNAME[0]}: path cannot be empty"
|
||||
return 1
|
||||
fi
|
||||
nixInfoLog "${FUNCNAME[0]}: installing $path"
|
||||
|
||||
local basename
|
||||
# use stripHash in case it's a nix store path
|
||||
basename=$(stripHash "$path")
|
||||
|
||||
local outRoot
|
||||
outRoot=${!outputBin:?}
|
||||
|
||||
local outPath="${outRoot}/bin/$basename"
|
||||
install -D --mode=755 --no-target-directory "$path" "${outRoot}/bin/$basename"
|
||||
done
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-bin-output"
|
||||
{
|
||||
outputs = [
|
||||
"out"
|
||||
"bin"
|
||||
];
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
mkdir -p bin
|
||||
echo "echo hello za warudo" > bin/hello
|
||||
echo "echo amigo me gusta mucho" > bin/amigo
|
||||
|
||||
installBin bin/*
|
||||
|
||||
# assert it didn't go into $out
|
||||
[[ ! -f $out/bin/amigo ]]
|
||||
[[ ! -f $out/bin/hello ]]
|
||||
|
||||
cmp bin/amigo ''${!outputBin}/bin/amigo
|
||||
cmp bin/hello ''${!outputBin}/bin/hello
|
||||
|
||||
touch $out
|
||||
''
|
21
pkgs/by-name/in/installShellFiles/tests/install-bin.nix
Normal file
21
pkgs/by-name/in/installShellFiles/tests/install-bin.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-bin"
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
mkdir -p bin
|
||||
echo "echo hello za warudo" > bin/hello
|
||||
echo "echo amigo me gusta mucho" > bin/amigo
|
||||
|
||||
installBin bin/*
|
||||
|
||||
cmp bin/amigo $out/bin/amigo
|
||||
cmp bin/hello $out/bin/hello
|
||||
''
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-completion-cmd"
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
echo foo > foo.bash
|
||||
echo bar > bar.zsh
|
||||
echo baz > baz.fish
|
||||
echo qux > qux.fish
|
||||
|
||||
installShellCompletion --cmd foobar --bash foo.bash --zsh bar.zsh --fish baz.fish --name qux qux.fish
|
||||
|
||||
cmp foo.bash $out/share/bash-completion/completions/foobar.bash
|
||||
cmp bar.zsh $out/share/zsh/site-functions/_foobar
|
||||
cmp baz.fish $out/share/fish/vendor_completions.d/foobar.fish
|
||||
cmp qux.fish $out/share/fish/vendor_completions.d/qux
|
||||
''
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-completion-fifo"
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
installShellCompletion \
|
||||
--bash --name foo.bash <(echo foo) \
|
||||
--zsh --name _foo <(echo bar) \
|
||||
--fish --name foo.fish <(echo baz)
|
||||
|
||||
[[ $(<$out/share/bash-completion/completions/foo.bash) == foo ]] || { echo "foo.bash comparison failed"; exit 1; }
|
||||
[[ $(<$out/share/zsh/site-functions/_foo) == bar ]] || { echo "_foo comparison failed"; exit 1; }
|
||||
[[ $(<$out/share/fish/vendor_completions.d/foo.fish) == baz ]] || { echo "foo.fish comparison failed"; exit 1; }
|
||||
''
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-completion-inference"
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
echo foo > foo.bash
|
||||
echo bar > bar.zsh
|
||||
echo baz > baz.fish
|
||||
|
||||
installShellCompletion foo.bash bar.zsh baz.fish
|
||||
|
||||
cmp foo.bash $out/share/bash-completion/completions/foo.bash
|
||||
cmp bar.zsh $out/share/zsh/site-functions/_bar
|
||||
cmp baz.fish $out/share/fish/vendor_completions.d/baz.fish
|
||||
''
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-completion-name"
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
echo foo > foo
|
||||
echo bar > bar
|
||||
echo baz > baz
|
||||
|
||||
installShellCompletion --bash --name foobar.bash foo --zsh --name _foobar bar --fish baz
|
||||
|
||||
cmp foo $out/share/bash-completion/completions/foobar.bash
|
||||
cmp bar $out/share/zsh/site-functions/_foobar
|
||||
cmp baz $out/share/fish/vendor_completions.d/baz
|
||||
''
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-completion-output"
|
||||
{
|
||||
outputs = [
|
||||
"out"
|
||||
"bin"
|
||||
];
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
echo foo > foo
|
||||
|
||||
installShellCompletion --bash foo
|
||||
|
||||
# assert it didn't go into $out
|
||||
[[ ! -f $out/share/bash-completion/completions/foo ]]
|
||||
|
||||
cmp foo ''${!outputBin:?}/share/bash-completion/completions/foo
|
||||
|
||||
touch $out
|
||||
''
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-completion"
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
echo foo > foo
|
||||
echo bar > bar
|
||||
echo baz > baz
|
||||
echo qux > qux.zsh
|
||||
echo quux > quux
|
||||
|
||||
installShellCompletion --bash foo bar --zsh baz qux.zsh --fish quux
|
||||
|
||||
cmp foo $out/share/bash-completion/completions/foo
|
||||
cmp bar $out/share/bash-completion/completions/bar
|
||||
cmp baz $out/share/zsh/site-functions/_baz
|
||||
cmp qux.zsh $out/share/zsh/site-functions/_qux
|
||||
cmp quux $out/share/fish/vendor_completions.d/quux
|
||||
''
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-manpage-outputs"
|
||||
{
|
||||
outputs = [
|
||||
"out"
|
||||
"man"
|
||||
"devman"
|
||||
];
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
mkdir -p doc
|
||||
echo foo > doc/foo.1
|
||||
echo bar > doc/bar.3
|
||||
|
||||
installManPage doc/*
|
||||
|
||||
# assert they didn't go into $out
|
||||
[[ ! -f $out/share/man/man1/foo.1 && ! -f $out/share/man/man3/bar.3 ]]
|
||||
|
||||
# foo.1 alone went into man
|
||||
cmp doc/foo.1 ''${!outputMan:?}/share/man/man1/foo.1
|
||||
[[ ! -f ''${!outputMan:?}/share/man/man3/bar.3 ]]
|
||||
|
||||
# bar.3 alone went into devman
|
||||
cmp doc/bar.3 ''${!outputDevman:?}/share/man/man3/bar.3
|
||||
[[ ! -f ''${!outputDevman:?}/share/man/man1/foo.1 ]]
|
||||
|
||||
touch $out
|
||||
''
|
23
pkgs/by-name/in/installShellFiles/tests/install-manpage.nix
Normal file
23
pkgs/by-name/in/installShellFiles/tests/install-manpage.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
runCommandLocal "install-shell-files--install-manpage"
|
||||
{
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
''
|
||||
mkdir -p doc
|
||||
echo foo > doc/foo.1
|
||||
echo bar > doc/bar.2.gz
|
||||
echo baz > doc/baz.3
|
||||
|
||||
installManPage doc/*
|
||||
|
||||
cmp doc/foo.1 $out/share/man/man1/foo.1
|
||||
cmp doc/bar.2.gz $out/share/man/man2/bar.2.gz
|
||||
cmp doc/baz.3 $out/share/man/man3/baz.3
|
||||
''
|
|
@ -1,7 +1,10 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
justBuildPhase() {
|
||||
runHook preBuild
|
||||
|
||||
local flagsArray=($justFlags "${justFlagsArray[@]}")
|
||||
local flagsArray=()
|
||||
concatTo flagsArray justFlags justFlagsArray
|
||||
|
||||
echoCmd 'build flags' "${flagsArray[@]}"
|
||||
just "${flagsArray[@]}"
|
||||
|
@ -14,17 +17,15 @@ justCheckPhase() {
|
|||
|
||||
if [ -z "${checkTarget:-}" ]; then
|
||||
if just -n test >/dev/null 2>&1; then
|
||||
checkTarget=test
|
||||
checkTarget="test"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${checkTarget:-}" ]; then
|
||||
echo "no test target found in just, doing nothing"
|
||||
else
|
||||
local flagsArray=(
|
||||
$justFlags "${justFlagsArray[@]}"
|
||||
$checkTarget
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray justFlags justFlagsArray checkTarget
|
||||
|
||||
echoCmd 'check flags' "${flagsArray[@]}"
|
||||
just "${flagsArray[@]}"
|
||||
|
@ -36,8 +37,8 @@ justCheckPhase() {
|
|||
justInstallPhase() {
|
||||
runHook preInstall
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
local flagsArray=($justFlags "${justFlagsArray[@]}" ${installTargets:-install})
|
||||
local flagsArray=()
|
||||
concatTo flagsArray justFlags justFlagsArray installTargets=install
|
||||
|
||||
echoCmd 'install flags' "${flagsArray[@]}"
|
||||
just "${flagsArray[@]}"
|
||||
|
@ -45,14 +46,14 @@ justInstallPhase() {
|
|||
runHook postInstall
|
||||
}
|
||||
|
||||
if [ -z "${dontUseJustBuild-}" -a -z "${buildPhase-}" ]; then
|
||||
if [ -z "${dontUseJustBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
buildPhase=justBuildPhase
|
||||
fi
|
||||
|
||||
if [ -z "${dontUseJustCheck-}" -a -z "${checkPhase-}" ]; then
|
||||
if [ -z "${dontUseJustCheck-}" ] && [ -z "${checkPhase-}" ]; then
|
||||
checkPhase=justCheckPhase
|
||||
fi
|
||||
|
||||
if [ -z "${dontUseJustInstall-}" -a -z "${installPhase-}" ]; then
|
||||
if [ -z "${dontUseJustInstall-}" ] && [ -z "${installPhase-}" ]; then
|
||||
installPhase=justInstallPhase
|
||||
fi
|
||||
|
|
|
@ -13,16 +13,16 @@
|
|||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "maturin";
|
||||
version = "1.7.0";
|
||||
version = "1.7.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "PyO3";
|
||||
repo = "maturin";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-SjINeNtCbyMp3U+Op7ey+8lV7FYxLVpmO5g1a01ouBs=";
|
||||
hash = "sha256-kFhY2ixZZrSA/YxLCQDLPjLqNWQI3zl5V1MLTPqQH60=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-xJafCgpCeihyORj3gIVUus74vu9h3N1xuyKvkxSqYK4=";
|
||||
cargoHash = "sha256-ik6kFS66umiHf0M1fE+6++zpZF4gJrN9LQ2l+vi9SSY=";
|
||||
|
||||
buildInputs = lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
|
|
|
@ -49,11 +49,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
dontStrip = true;
|
||||
|
||||
buildInputs = [
|
||||
# Remove this after https://github.com/NixOS/nixpkgs/pull/336712
|
||||
# has landed in `nixpkgs-unstable`
|
||||
(curl.overrideAttrs (old: {
|
||||
configureFlags = old.configureFlags ++ [ "--enable-versioned-symbols" ];
|
||||
})).dev
|
||||
curl.dev
|
||||
openssl.dev
|
||||
stdenv.cc.cc.lib
|
||||
];
|
||||
|
|
|
@ -34,7 +34,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 a.out "$out/bin/nawk"
|
||||
mv a.out nawk
|
||||
installBin nawk
|
||||
mv awk.1 nawk.1
|
||||
installManPage nawk.1
|
||||
runHook postInstall
|
||||
|
|
|
@ -65,8 +65,7 @@ ninjaInstallPhase() {
|
|||
local flagsArray=(
|
||||
"-j$buildCores"
|
||||
)
|
||||
: "${installTargets:=install}"
|
||||
concatTo flagsArray ninjaFlags ninjaFlagsArray installTargets
|
||||
concatTo flagsArray ninjaFlags ninjaFlagsArray installTargets=install
|
||||
|
||||
echoCmd 'install flags' "${flagsArray[@]}"
|
||||
TERM=dumb ninja "${flagsArray[@]}"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, fetchpatch2
|
||||
, gtest
|
||||
, meson
|
||||
, nasm
|
||||
|
@ -20,6 +21,16 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
hash = "sha256-ai7lcGcQQqpsLGSwHkSs7YAoEfGCIbxdClO6JpGA+MI=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# build: fix build with meson on riscv64
|
||||
# https://github.com/cisco/openh264/pull/3773
|
||||
(fetchpatch2 {
|
||||
name = "openh264-riscv64.patch";
|
||||
url = "https://github.com/cisco/openh264/commit/cea886eda8fae7ba42c4819e6388ce8fc633ebf6.patch";
|
||||
hash = "sha256-ncXuGgogXA7JcCOjGk+kBprmOErFohrYjYzZYzAbbDQ=";
|
||||
})
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
@ -45,7 +56,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
maintainers = with lib.maintainers; [ AndersonTorres ];
|
||||
# See meson.build
|
||||
platforms = lib.platforms.windows ++ lib.intersectLists
|
||||
(lib.platforms.x86 ++ lib.platforms.arm ++ lib.platforms.aarch64 ++ lib.platforms.loongarch64)
|
||||
(lib.platforms.x86 ++ lib.platforms.arm ++ lib.platforms.aarch64 ++
|
||||
lib.platforms.loongarch64 ++ lib.platforms.riscv64)
|
||||
(lib.platforms.linux ++ lib.platforms.darwin);
|
||||
};
|
||||
})
|
||||
|
|
|
@ -8,14 +8,13 @@ sconsBuildPhase() {
|
|||
fi
|
||||
|
||||
if [ -z "${dontAddPrefix:-}" ] && [ -n "$prefix" ]; then
|
||||
buildFlags="${prefixKey:-prefix=}$prefix $buildFlags"
|
||||
prependToVar buildFlags "${prefixKey:-prefix=}$prefix"
|
||||
fi
|
||||
|
||||
local flagsArray=(
|
||||
${enableParallelBuilding:+-j${NIX_BUILD_CORES}}
|
||||
$sconsFlags ${sconsFlagsArray[@]}
|
||||
$buildFlags ${buildFlagsArray[@]}
|
||||
)
|
||||
concatTo flagsArray sconsFlags sconsFlagsArray buildFlags buildFlagsArray
|
||||
|
||||
echoCmd 'scons build flags' "${flagsArray[@]}"
|
||||
scons "${flagsArray[@]}"
|
||||
|
@ -31,15 +30,13 @@ sconsInstallPhase() {
|
|||
fi
|
||||
|
||||
if [ -z "${dontAddPrefix:-}" ] && [ -n "$prefix" ]; then
|
||||
installFlags="${prefixKey:-prefix=}$prefix $installFlags"
|
||||
prependToVar installFlags "${prefixKey:-prefix=}$prefix"
|
||||
fi
|
||||
|
||||
local flagsArray=(
|
||||
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
|
||||
$sconsFlags ${sconsFlagsArray[@]}
|
||||
$installFlags ${installFlagsArray[@]}
|
||||
${installTargets:-install}
|
||||
)
|
||||
concatTo flagsArray sconsFlags sconsFlagsArray installFlags installFlagsArray installTargets=install
|
||||
|
||||
echoCmd 'scons install flags' "${flagsArray[@]}"
|
||||
scons "${flagsArray[@]}"
|
||||
|
@ -63,9 +60,8 @@ sconsCheckPhase() {
|
|||
else
|
||||
local flagsArray=(
|
||||
${enableParallelChecking:+-j${NIX_BUILD_CORES}}
|
||||
$sconsFlags ${sconsFlagsArray[@]}
|
||||
${checkFlagsArray[@]}
|
||||
)
|
||||
concatTo flagsArray sconsFlags sconsFlagsArray checkFlagsArray checkTarget
|
||||
|
||||
echoCmd 'scons check flags' "${flagsArray[@]}"
|
||||
scons "${flagsArray[@]}"
|
||||
|
|
50
pkgs/by-name/ti/tinyxxd/package.nix
Normal file
50
pkgs/by-name/ti/tinyxxd/package.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
vim,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "tinyxxd";
|
||||
version = "1.3.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
repo = "tinyxxd";
|
||||
owner = "xyproto";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-W7BrQga98ACrhTHF3UlGQMRmcdJaxgorDP6FpD5mr2A=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
|
||||
postInstall = ''
|
||||
installManPage tinyxxd.1
|
||||
|
||||
# Allow using `tinyxxd` as `xxd`. This is similar to the Arch packaging.
|
||||
# https://gitlab.archlinux.org/archlinux/packaging/packages/tinyxxd/-/blob/main/PKGBUILD
|
||||
ln -s $out/bin/{tiny,}xxd
|
||||
ln -s $out/share/man/man1/{tiny,}xxd.1.gz
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/xyproto/tinyxxd";
|
||||
description = "Drop-in replacement and standalone version of the hex dump utility that comes with ViM";
|
||||
license = [
|
||||
lib.licenses.mit # or
|
||||
lib.licenses.gpl2Only
|
||||
];
|
||||
mainProgram = "tinyxxd";
|
||||
maintainers = with lib.maintainers; [
|
||||
emily
|
||||
philiptaron
|
||||
];
|
||||
platforms = lib.platforms.unix;
|
||||
|
||||
# If the two `xxd` providers are present, choose this one.
|
||||
priority = (vim.xxd.meta.priority or lib.meta.defaultPriority) - 1;
|
||||
};
|
||||
})
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "volk";
|
||||
version = "1.3.283.0";
|
||||
version = "1.3.290.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "zeux";
|
||||
repo = "volk";
|
||||
rev = "vulkan-sdk-${finalAttrs.version}";
|
||||
hash = "sha256-AoUStYeSTu6YmdyKgx0n3O+p3asb39GU6HSHgOhhFhQ=";
|
||||
hash = "sha256-SbTBwS4mJETrXRT7QMJX9F8ukcZmzz8+1atVbB/fid4=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
|
|
@ -16,11 +16,8 @@ wafConfigurePhase() {
|
|||
export PKGCONFIG="${PKG_CONFIG}"
|
||||
fi
|
||||
|
||||
local flagsArray=(
|
||||
$prefixFlag
|
||||
$wafConfigureFlags "${wafConfigureFlagsArray[@]}"
|
||||
${wafConfigureTargets:-configure}
|
||||
)
|
||||
local flagsArray=( $prefixFlag )
|
||||
concatTo flagsArray wafConfigureFlags wafConfigureFlagsArray wafConfigureTargets=configure
|
||||
|
||||
echoCmd 'waf configure flags' "${flagsArray[@]}"
|
||||
python "$wafPath" "${flagsArray[@]}"
|
||||
|
@ -41,15 +38,8 @@ wafConfigurePhase() {
|
|||
wafBuildPhase () {
|
||||
runHook preBuild
|
||||
|
||||
# set to empty if unset
|
||||
: "${wafFlags=}"
|
||||
|
||||
local flagsArray=(
|
||||
${enableParallelBuilding:+-j ${NIX_BUILD_CORES}}
|
||||
$wafFlags ${wafFlagsArray[@]}
|
||||
$wafBuildFlags ${wafBuildFlagsArray[@]}
|
||||
${wafBuildTargets:-build}
|
||||
)
|
||||
local flagsArray=( ${enableParallelBuilding:+-j ${NIX_BUILD_CORES}} )
|
||||
concatTo flagsArray wafFlags wafFlagsArray wafBuildFlags wafBuildFlagsArray wafBuildTargets=build
|
||||
|
||||
echoCmd 'waf build flags' "${flagsArray[@]}"
|
||||
python "$wafPath" "${flagsArray[@]}"
|
||||
|
@ -64,12 +54,8 @@ wafInstallPhase() {
|
|||
mkdir -p "$prefix"
|
||||
fi
|
||||
|
||||
local flagsArray=(
|
||||
${enableParallelInstalling:+-j ${NIX_BUILD_CORES}}
|
||||
$wafFlags ${wafFlagsArray[@]}
|
||||
$wafInstallFlags ${wafInstallFlagsArray[@]}
|
||||
${wafInstallTargets:-install}
|
||||
)
|
||||
local flagsArray=( ${enableParallelInstalling:+-j ${NIX_BUILD_CORES}} )
|
||||
concatTo flagsArray wafFlags wafFlagsArray wafInstallFlags wafInstallFlagsArray wafInstallTargets=install
|
||||
|
||||
echoCmd 'waf install flags' "${flagsArray[@]}"
|
||||
python "$wafPath" "${flagsArray[@]}"
|
||||
|
|
178
pkgs/by-name/xa/xar/package.nix
Normal file
178
pkgs/by-name/xa/xar/package.nix
Normal file
|
@ -0,0 +1,178 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
applyPatches,
|
||||
autoreconfHook,
|
||||
nix-update-script,
|
||||
|
||||
# Required dependencies.
|
||||
openssl,
|
||||
zlib,
|
||||
libxml2,
|
||||
|
||||
# Optional dependencies.
|
||||
e2fsprogs,
|
||||
bzip2,
|
||||
xz, # lzma
|
||||
|
||||
# Platform-specific dependencies.
|
||||
acl,
|
||||
musl-fts,
|
||||
|
||||
# for tests
|
||||
testers,
|
||||
python3,
|
||||
libxslt, # xsltproc
|
||||
runCommand,
|
||||
runCommandCC,
|
||||
makeWrapper,
|
||||
xar,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "xar";
|
||||
version = "498";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "apple-oss-distributions";
|
||||
repo = "xar";
|
||||
rev = "xar-${finalAttrs.version}";
|
||||
hash = "sha256-RyWeR/ZnDBHIZhwzVxETdrTTPQA2VgsLZegRkxX1240=";
|
||||
};
|
||||
|
||||
# Update patch set with
|
||||
# git clone https://github.com/apple-oss-distributions/xar
|
||||
# cd xar
|
||||
# git switch -c nixpkgs
|
||||
# git am ../pkgs/by-name/xa/xar/patches/*
|
||||
# # …
|
||||
# rm -r ../pkgs/by-name/xa/xar/patches
|
||||
# git format-patch --zero-commit --output-directory ../pkgs/by-name/xa/xar/patches main
|
||||
patches = lib.filesystem.listFilesRecursive ./patches;
|
||||
|
||||
# We do not use or modify files outside of the xar subdirectory.
|
||||
patchFlags = [ "-p2" ];
|
||||
sourceRoot = "source/xar";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"lib"
|
||||
"dev"
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook ];
|
||||
|
||||
# For some reason libxml2 package headers are in subdirectory and thus aren’t
|
||||
# picked up by stdenv’s C compiler wrapper (see ccWrapper_addCVars). This
|
||||
# doesn’t really belong here and either should be part of libxml2 package or
|
||||
# libxml2 in Nixpkgs can just fix their header paths.
|
||||
env.NIX_CFLAGS_COMPILE = "-isystem ${libxml2.dev}/include/libxml2";
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
# NB we use OpenSSL instead of CommonCrypto on Darwin.
|
||||
openssl
|
||||
zlib
|
||||
libxml2
|
||||
bzip2
|
||||
xz
|
||||
e2fsprogs
|
||||
]
|
||||
++ lib.optional stdenv.hostPlatform.isLinux acl ++ lib.optional stdenv.hostPlatform.isMusl musl-fts;
|
||||
|
||||
passthru =
|
||||
let
|
||||
patchedSource = applyPatches { inherit (finalAttrs) src patches; };
|
||||
pythonForTests = python3.withPackages (p: [ p.xattr ]);
|
||||
in
|
||||
{
|
||||
# Tests xar outside of the Nix sandbox (extended attributes are not supported
|
||||
# in Nix sandbox, e.g. filtered with seccomp on Linux).
|
||||
#
|
||||
# Run with
|
||||
# $ nix run --file . xar.impureTests.integrationTest
|
||||
# Ensure that all tests are PASSED and none are FAILED or SKIPPED.
|
||||
impureTests.integrationTest =
|
||||
runCommand "xar-impure-tests-integration-test"
|
||||
{
|
||||
src = patchedSource;
|
||||
xar = finalAttrs.finalPackage;
|
||||
xsltproc = lib.getBin libxslt;
|
||||
pythonInterpreter = pythonForTests.interpreter;
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
}
|
||||
''
|
||||
makeWrapper "$pythonInterpreter" "$out/bin/$name" \
|
||||
--prefix PATH : "$xar/bin" \
|
||||
--suffix PATH : "$xsltproc/bin" \
|
||||
--add-flags -- \
|
||||
--add-flags "$src/xar/test/run-all.py"
|
||||
'';
|
||||
|
||||
tests = lib.optionalAttrs (stdenv.buildPlatform.canExecute stdenv.hostPlatform) {
|
||||
version = testers.testVersion {
|
||||
package = finalAttrs.finalPackage;
|
||||
version = "1.8dev";
|
||||
};
|
||||
|
||||
integrationTest =
|
||||
runCommand "xar-tests-integration-test"
|
||||
{
|
||||
src = patchedSource;
|
||||
strictDeps = true;
|
||||
pythonExecutable = pythonForTests.executable;
|
||||
nativeBuildInputs = [
|
||||
finalAttrs.finalPackage
|
||||
pythonForTests
|
||||
libxslt
|
||||
];
|
||||
}
|
||||
''
|
||||
"$pythonExecutable" "$src"/xar/test/run-all.py
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
smokeTest =
|
||||
runCommandCC "xar-tests-smoke-test"
|
||||
{
|
||||
src = patchedSource;
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ finalAttrs.finalPackage ];
|
||||
buildInputs = [
|
||||
finalAttrs.finalPackage
|
||||
openssl
|
||||
];
|
||||
}
|
||||
''
|
||||
cp "$src"/xar/test/{buffer.c,validate.c} .
|
||||
"$CC" -lxar -o buffer buffer.c
|
||||
"$CC" -lxar -lcrypto -o validate validate.c
|
||||
./buffer validate.c
|
||||
xar -x -f test.xar
|
||||
diff validate.c mydir/secondfile
|
||||
./validate test.xar
|
||||
touch "$out"
|
||||
'';
|
||||
};
|
||||
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [
|
||||
"--version-regex"
|
||||
"xar-(.*)"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/apple-oss-distributions/xar";
|
||||
description = "An easily extensible archive format";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers =
|
||||
lib.teams.darwin.members
|
||||
++ lib.attrValues { inherit (lib.maintainers) copumpkin tie; };
|
||||
platforms = lib.platforms.unix;
|
||||
mainProgram = "xar";
|
||||
};
|
||||
})
|
|
@ -0,0 +1,961 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 12:53:54 +0300
|
||||
Subject: [PATCH 01/19] Update tests for Python 3 and Nix sandbox
|
||||
|
||||
This change updates integration tests for Python 3 and fixes some
|
||||
assumptions to work under Nix sandbox (in particular, extended
|
||||
attributes are not allowed).
|
||||
|
||||
Also updates xar/test/validate.c for modern OpenSSL versions.
|
||||
---
|
||||
xar/test/attr.py | 54 +++++++++++++++++++-------
|
||||
xar/test/buffer.c | 3 +-
|
||||
xar/test/checksums.py | 75 +++++++++++++++++++-----------------
|
||||
xar/test/compression.py | 27 ++++++++-----
|
||||
xar/test/data.py | 19 +++++----
|
||||
xar/test/hardlink.py | 12 ++++--
|
||||
xar/test/heap.py | 27 +++++++------
|
||||
xar/test/integrity.py | 45 ++++++++++++----------
|
||||
xar/test/run-all.py | 25 ++++++++++++
|
||||
xar/test/util.py | 85 ++++++++++++++++++++++++++++++++++++-----
|
||||
xar/test/validate.c | 32 +++++++++-------
|
||||
11 files changed, 282 insertions(+), 122 deletions(-)
|
||||
create mode 100755 xar/test/run-all.py
|
||||
|
||||
diff --git a/xar/test/attr.py b/xar/test/attr.py
|
||||
index adc2c56..c28a4e6 100755
|
||||
--- a/xar/test/attr.py
|
||||
+++ b/xar/test/attr.py
|
||||
@@ -6,6 +6,7 @@ import os
|
||||
import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
+import sys
|
||||
import xattr
|
||||
|
||||
import util
|
||||
@@ -26,20 +27,27 @@ import util
|
||||
class MissingExtendedAttributeError(AssertionError):
|
||||
pass
|
||||
|
||||
-def _random_big_data(bytes=65536, path="/dev/random"):
|
||||
+def _random_big_data(bytes=65536):
|
||||
"""
|
||||
Returns a random string with the number of bytes requested. Due to xar
|
||||
implementation details, this should be greater than 4096 (32768 for
|
||||
compressed heap testing).
|
||||
|
||||
"""
|
||||
- with open(path, "r") as f:
|
||||
- return f.read(bytes)
|
||||
+ return os.urandom(bytes)
|
||||
+
|
||||
+def _to_bytes(s):
|
||||
+ if isinstance(s, str):
|
||||
+ return s.encode("utf-8")
|
||||
+ return s
|
||||
|
||||
def _test_xattr_on_file_with_contents(filename, file_contents, xattrs=[], xar_create_flags=[], xar_extract_flags=[]):
|
||||
+ file_contents = _to_bytes(file_contents)
|
||||
+ xattr_prefix = "user." if sys.platform != "darwin" else ""
|
||||
+ xattrs = [(xattr_prefix + k, _to_bytes(v)) for k, v in xattrs]
|
||||
try:
|
||||
# Write file out
|
||||
- with open(filename, "w") as f:
|
||||
+ with open(filename, "wb") as f:
|
||||
f.write(file_contents)
|
||||
for (key, value) in xattrs:
|
||||
xattr.setxattr(f, key, value)
|
||||
@@ -51,14 +59,16 @@ def _test_xattr_on_file_with_contents(filename, file_contents, xattrs=[], xar_cr
|
||||
with util.directory_created("extracted") as directory:
|
||||
# Validate resulting xattrs
|
||||
subprocess.check_call(["xar", "-x", "-C", directory, "-f", path] + xar_extract_flags)
|
||||
+ extracted_filename = os.path.join(directory, filename)
|
||||
+ expected_set = {key for key, _ in xattrs}
|
||||
+ actual_set = set(xattr.listxattr(os.path.join(directory, filename)))
|
||||
+ for key in expected_set - actual_set:
|
||||
+ raise MissingExtendedAttributeError("extended attribute \"{n}\" missing after extraction".format(n=key))
|
||||
for (key, value) in xattrs:
|
||||
- try:
|
||||
- assert xattr.getxattr(os.path.join(directory, filename), key) == value, "extended attribute \"{n}\" has incorrect contents after extraction".format(n=key)
|
||||
- except KeyError:
|
||||
- raise MissingExtendedAttributeError("extended attribute \"{n}\" missing after extraction".format(n=key))
|
||||
+ assert xattr.getxattr(extracted_filename, key) == value, "extended attribute \"{n}\" has incorrect contents after extraction".format(n=key)
|
||||
|
||||
# Validate file contents
|
||||
- with open(os.path.join(directory, filename), "r") as f:
|
||||
+ with open(os.path.join(directory, filename), "rb") as f:
|
||||
if f.read() != file_contents:
|
||||
raise MissingExtendedAttributeError("archived file \"{f}\" has has incorrect contents after extraction".format(f=filename))
|
||||
finally:
|
||||
@@ -73,36 +83,47 @@ def _test_xattr_on_file_with_contents(filename, file_contents, xattrs=[], xar_cr
|
||||
# tests are commented out awaiting a day when this might be different.
|
||||
|
||||
# def empty_xattr_empty_file(filename):
|
||||
+# util.skip_if_no_xattrs_support()
|
||||
# _test_xattr_on_file_with_contents(filename, "", xattrs=[("foo", "")])
|
||||
|
||||
def small_xattr_empty_file(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
_test_xattr_on_file_with_contents(filename, "", xattrs=[("foo", "1234")])
|
||||
|
||||
def large_xattr_empty_file(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
_test_xattr_on_file_with_contents(filename, "", xattrs=[("foo", _random_big_data(5000))])
|
||||
|
||||
# def empty_xattr_small_file(filename):
|
||||
+# util.skip_if_no_xattrs_support()
|
||||
# _test_xattr_on_file_with_contents(filename, "small.file.contents", xattrs=[("foo", "")])
|
||||
|
||||
def small_xattr_small_file(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
_test_xattr_on_file_with_contents(filename, "small.file.contents", xattrs=[("foo", "1234")])
|
||||
|
||||
def large_xattr_small_file(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
_test_xattr_on_file_with_contents(filename, "small.file.contents", xattrs=[("foo", _random_big_data(4567))])
|
||||
|
||||
# def empty_xattr_large_file(filename):
|
||||
+# util.skip_if_no_xattrs_support()
|
||||
# _test_xattr_on_file_with_contents(filename, _random_big_data(10000000), xattrs=[("foo", "")])
|
||||
|
||||
def small_xattr_large_file(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
_test_xattr_on_file_with_contents(filename, _random_big_data(5000000), xattrs=[("foo", "1234")])
|
||||
|
||||
def large_xattr_large_file(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
_test_xattr_on_file_with_contents(filename, _random_big_data(9876543), xattrs=[("foo", _random_big_data(6543))])
|
||||
|
||||
def multiple_xattrs(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
_test_xattr_on_file_with_contents(filename, "", xattrs=[("foo", "bar"), ("baz", "1234"), ("quux", "more")]) # ("empty", "")
|
||||
|
||||
def distribution_create(filename):
|
||||
+ util.skip_if_no_xattrs_support()
|
||||
try:
|
||||
_test_xattr_on_file_with_contents(filename, "dummy", xattrs=[("foo", "bar")], xar_create_flags=["--distribution"])
|
||||
except MissingExtendedAttributeError:
|
||||
@@ -114,6 +135,7 @@ def distribution_create(filename):
|
||||
# when it can.
|
||||
|
||||
# def distribution_extract(filename):
|
||||
+# util.skip_if_no_xattrs_support()
|
||||
# try:
|
||||
# _test_xattr_on_file_with_contents(filename, "dummy", xattrs=[("foo", "bar")], xar_extract_flags=["--distribution"])
|
||||
# except MissingExtendedAttributeError:
|
||||
@@ -128,12 +150,18 @@ TEST_CASES = (small_xattr_empty_file, large_xattr_empty_file,
|
||||
multiple_xattrs, distribution_create)
|
||||
|
||||
if __name__ == "__main__":
|
||||
+ failed = False
|
||||
for case in TEST_CASES:
|
||||
+ func_name = case.__name__
|
||||
try:
|
||||
- case(case.func_name)
|
||||
- print("PASSED: {f}".format(f=case.func_name))
|
||||
+ case(func_name)
|
||||
+ print("PASSED: {f}".format(f=func_name))
|
||||
except (AssertionError, IOError, subprocess.CalledProcessError):
|
||||
- import sys, os
|
||||
- print("FAILED: {f}".format(f=case.func_name))
|
||||
+ failed = True
|
||||
+ print("FAILED: {f}".format(f=func_name))
|
||||
sys.excepthook(*sys.exc_info())
|
||||
print("")
|
||||
+ except util.TestCaseSkipError as e:
|
||||
+ print("SKIPPED: {f}: {m}".format(f=func_name, m=e))
|
||||
+ if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/buffer.c b/xar/test/buffer.c
|
||||
index a353cef..e4c5639 100644
|
||||
--- a/xar/test/buffer.c
|
||||
+++ b/xar/test/buffer.c
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <string.h>
|
||||
@@ -50,7 +51,7 @@ int main(int argc, char *argv[])
|
||||
if( red < sb.st_size )
|
||||
fprintf(stderr, "Incomplete read\n");
|
||||
|
||||
- x = xar_open("/tmp/test.xar", WRITE);
|
||||
+ x = xar_open("test.xar", WRITE);
|
||||
if( x == NULL ) {
|
||||
fprintf(stderr, "Error creating xarchive\n");
|
||||
exit(6);
|
||||
diff --git a/xar/test/checksums.py b/xar/test/checksums.py
|
||||
index 7080d7c..0f39e63 100755
|
||||
--- a/xar/test/checksums.py
|
||||
+++ b/xar/test/checksums.py
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
+import contextlib
|
||||
import hashlib
|
||||
import os
|
||||
import os.path
|
||||
@@ -9,6 +10,7 @@ import re
|
||||
import shutil
|
||||
import struct
|
||||
import subprocess
|
||||
+import sys
|
||||
|
||||
import util
|
||||
|
||||
@@ -17,15 +19,21 @@ import util
|
||||
# Utility Functions
|
||||
#
|
||||
|
||||
+@contextlib.contextmanager
|
||||
+def _test_archive_created(filename, directory, *args, **kwargs):
|
||||
+ with util.test_directory_created(directory) as test_directory:
|
||||
+ with util.archive_created(filename, test_directory, *args, **kwargs) as path:
|
||||
+ yield path
|
||||
+
|
||||
def _get_numeric_value_from_header(archive_name, key):
|
||||
"""
|
||||
Dumps the header of the specified xar archive and extracts the header
|
||||
size from the output, in bytes.
|
||||
|
||||
"""
|
||||
- header = subprocess.check_output(["xar", "--dump-header", "-f", archive_name])
|
||||
+ header = subprocess.check_output(["xar", "--dump-header", "-f", archive_name], text=True)
|
||||
for line in header.splitlines():
|
||||
- matchdata = re.match("^(.+):\s+(.+)$", line) # magic: 0x78617221 (OK)
|
||||
+ matchdata = re.match(r"^(.+):\s+(.+)$", line) # magic: 0x78617221 (OK)
|
||||
assert matchdata, "unexpected output from `xar --dump-header`:\n{h}".format(h=header)
|
||||
if matchdata.groups()[0] == key:
|
||||
return int(matchdata.groups()[1])
|
||||
@@ -38,17 +46,14 @@ def _get_toc_size(archive_name):
|
||||
return _get_numeric_value_from_header(archive_name, "Compressed TOC length")
|
||||
|
||||
def _clobber_bytes_at(clobber_range, path):
|
||||
- with open(path, "r+") as f:
|
||||
+ with open(path, "rb+") as f:
|
||||
f.seek(clobber_range[0])
|
||||
- with open("/dev/random", "r") as r:
|
||||
- random_bytes = r.read(len(clobber_range))
|
||||
- f.write(random_bytes)
|
||||
+ f.write(os.urandom(len(clobber_range)))
|
||||
|
||||
def _verify_extraction_failed(filename):
|
||||
with util.directory_created("extracted") as directory:
|
||||
try:
|
||||
- with open("/dev/null", "w") as n:
|
||||
- returncode = subprocess.call(["xar", "-x", "-C", directory, "-f", filename], stdout=n, stderr=n)
|
||||
+ returncode = subprocess.call(["xar", "-x", "-C", directory, "-f", filename], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
assert returncode != 0, "xar reported success extracting an archive with a broken TOC"
|
||||
finally:
|
||||
if os.path.exists(directory):
|
||||
@@ -63,7 +68,7 @@ def _verify_header_checksum(filename, algorithm):
|
||||
header_size = _get_header_size(filename)
|
||||
toc_length = _get_toc_size(filename)
|
||||
|
||||
- with open(filename, "r") as f:
|
||||
+ with open(filename, "rb") as f:
|
||||
f.seek(header_size)
|
||||
h = hashlib.new(algorithm, f.read(toc_length))
|
||||
computed_digest = h.digest()
|
||||
@@ -76,23 +81,23 @@ def _verify_header_checksum(filename, algorithm):
|
||||
#
|
||||
|
||||
def default_toc_checksum_validity(filename):
|
||||
- with util.archive_created(filename, "/bin") as path:
|
||||
+ with _test_archive_created(filename, "testdir") as path:
|
||||
_verify_header_checksum(path, "sha1")
|
||||
|
||||
def sha1_toc_checksum_validity(filename):
|
||||
- with util.archive_created(filename, "/bin", "--toc-cksum", "sha1") as path:
|
||||
+ with _test_archive_created(filename, "testdir", "--toc-cksum", "sha1") as path:
|
||||
_verify_header_checksum(path, "sha1")
|
||||
|
||||
def sha256_toc_checksum_validity(filename):
|
||||
- with util.archive_created(filename, "/bin", "--toc-cksum", "sha256") as path:
|
||||
+ with _test_archive_created(filename, "testdir", "--toc-cksum", "sha256") as path:
|
||||
_verify_header_checksum(path, "sha256")
|
||||
|
||||
def sha512_toc_checksum_validity(filename):
|
||||
- with util.archive_created(filename, "/bin", "--toc-cksum", "sha512") as path:
|
||||
+ with _test_archive_created(filename, "testdir", "--toc-cksum", "sha512") as path:
|
||||
_verify_header_checksum(path, "sha512")
|
||||
|
||||
def broken_toc_default_checksum(filename):
|
||||
- with util.archive_created(filename, "/bin") as path:
|
||||
+ with _test_archive_created(filename, "testdir") as path:
|
||||
# Mess up the archive
|
||||
toc_start = _get_header_size(path)
|
||||
_clobber_bytes_at(range(toc_start + 4, toc_start + 4 + 100), path) # Why did the original test specify 4? No idea.
|
||||
@@ -101,7 +106,7 @@ def broken_toc_default_checksum(filename):
|
||||
_verify_extraction_failed(filename)
|
||||
|
||||
def broken_toc_sha1_checksum(filename):
|
||||
- with util.archive_created(filename, "/bin", "--toc-cksum", "sha1") as path:
|
||||
+ with _test_archive_created(filename, "testdir", "--toc-cksum", "sha1") as path:
|
||||
# Mess up the archive
|
||||
toc_start = _get_header_size(path)
|
||||
_clobber_bytes_at(range(toc_start + 4, toc_start + 4 + 100), path) # Why did the original test specify 4? No idea.
|
||||
@@ -110,7 +115,7 @@ def broken_toc_sha1_checksum(filename):
|
||||
_verify_extraction_failed(filename)
|
||||
|
||||
def broken_toc_sha256_checksum(filename):
|
||||
- with util.archive_created(filename, "/bin", "--toc-cksum", "sha256") as path:
|
||||
+ with _test_archive_created(filename, "testdir", "--toc-cksum", "sha256") as path:
|
||||
# Mess up the archive
|
||||
toc_start = _get_header_size(path)
|
||||
_clobber_bytes_at(range(toc_start + 4, toc_start + 4 + 100), path) # Why did the original test specify 4? No idea.
|
||||
@@ -119,7 +124,7 @@ def broken_toc_sha256_checksum(filename):
|
||||
_verify_extraction_failed(filename)
|
||||
|
||||
def broken_toc_sha512_checksum(filename):
|
||||
- with util.archive_created(filename, "/bin", "--toc-cksum", "sha512") as path:
|
||||
+ with _test_archive_created(filename, "testdir", "--toc-cksum", "sha512") as path:
|
||||
# Mess up the archive
|
||||
toc_start = _get_header_size(path)
|
||||
_clobber_bytes_at(range(toc_start + 4, toc_start + 4 + 100), path) # Why did the original test specify 4? No idea.
|
||||
@@ -128,7 +133,7 @@ def broken_toc_sha512_checksum(filename):
|
||||
_verify_extraction_failed(filename)
|
||||
|
||||
def broken_heap_default_checksum(filename):
|
||||
- with util.archive_created(filename, "/bin") as path:
|
||||
+ with _test_archive_created(filename, "testdir") as path:
|
||||
# Mess up the archive
|
||||
toc_start = _get_header_size(path)
|
||||
toc_size = _get_toc_size(path)
|
||||
@@ -139,11 +144,11 @@ def broken_heap_default_checksum(filename):
|
||||
_verify_extraction_failed(filename)
|
||||
|
||||
def default_checksum_algorithm(filename):
|
||||
- with util.archive_created(filename, "/bin") as path:
|
||||
- header = subprocess.check_output(["xar", "--dump-header", "-f", path])
|
||||
+ with _test_archive_created(filename, "testdir") as path:
|
||||
+ header = subprocess.check_output(["xar", "--dump-header", "-f", path], text=True)
|
||||
found = False
|
||||
for line in header.splitlines():
|
||||
- matchdata = re.match("^Checksum algorithm:\s+(\d+)\s+\\((\w+)\\)$", line)
|
||||
+ matchdata = re.match(r"^Checksum algorithm:\s+(\d+)\s+\((\w+)\)$", line)
|
||||
if not matchdata:
|
||||
continue
|
||||
found = True
|
||||
@@ -156,7 +161,7 @@ def default_checksum_algorithm(filename):
|
||||
#
|
||||
# def invalid_checksum_algorithm(filename):
|
||||
# try:
|
||||
-# with util.archive_created(filename, "/bin", "--toc-cksum", "invalid-algorithm") as path:
|
||||
+# with _test_archive_created(filename, "testdir", "--toc-cksum", "invalid-algorithm") as path:
|
||||
# raise AssertionError("xar succeeded when it should have failed")
|
||||
# except subprocess.CalledProcessError:
|
||||
# pass
|
||||
@@ -164,17 +169,15 @@ def default_checksum_algorithm(filename):
|
||||
# It does fail for md5 explicitly, however
|
||||
def md5_toc_checksum_failure(filename):
|
||||
try:
|
||||
- with open("/dev/null", "a") as devnull:
|
||||
- with util.archive_created(filename, "/bin", "--toc-cksum", "md5", stderr=devnull) as path:
|
||||
- raise AssertionError("xar succeeded when it should have failed")
|
||||
+ with _test_archive_created(filename, "testdir", "--toc-cksum", "md5", stderr=subprocess.DEVNULL) as path:
|
||||
+ raise AssertionError("xar succeeded when it should have failed")
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
def md5_file_checksum_failure(filename):
|
||||
try:
|
||||
- with open("/dev/null", "a") as devnull:
|
||||
- with util.archive_created(filename, "/bin", "--file-cksum", "md5", stderr=devnull) as path:
|
||||
- raise AssertionError("xar succeeded when it should have failed")
|
||||
+ with _test_archive_created(filename, "testdir", "--file-cksum", "md5", stderr=subprocess.DEVNULL) as path:
|
||||
+ raise AssertionError("xar succeeded when it should have failed")
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
@@ -185,8 +188,8 @@ def _verify_checksum_algorithm(filename, algorithm):
|
||||
else:
|
||||
algorithm = "sha1"
|
||||
|
||||
- with util.archive_created(filename, "/bin", *additional_args) as path:
|
||||
- toc = subprocess.check_output(["xar", "--dump-toc=-", "-f", path])
|
||||
+ with _test_archive_created(filename, "testdir", *additional_args) as path:
|
||||
+ toc = subprocess.check_output(["xar", "--dump-toc=-", "-f", path], text=True)
|
||||
found = False
|
||||
for line in toc.splitlines():
|
||||
if '<unarchived-checksum style="{a}">'.format(a=algorithm) in line or '<archived-checksum style="{a}">'.format(a=algorithm) in line:
|
||||
@@ -214,12 +217,16 @@ TEST_CASES = (default_toc_checksum_validity, sha1_toc_checksum_validity, sha256_
|
||||
md5_toc_checksum_failure, md5_file_checksum_failure,)
|
||||
|
||||
if __name__ == "__main__":
|
||||
+ failed = False
|
||||
for case in TEST_CASES:
|
||||
+ func_name = case.__name__
|
||||
try:
|
||||
- case("{f}.xar".format(f=case.func_name))
|
||||
- print("PASSED: {f}".format(f=case.func_name))
|
||||
+ case("{f}.xar".format(f=func_name))
|
||||
+ print("PASSED: {f}".format(f=func_name))
|
||||
except (AssertionError, IOError, subprocess.CalledProcessError):
|
||||
- import sys, os
|
||||
- print("FAILED: {f}".format(f=case.func_name))
|
||||
+ failed = True
|
||||
+ print("FAILED: {f}".format(f=func_name))
|
||||
sys.excepthook(*sys.exc_info())
|
||||
print("")
|
||||
+ if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/compression.py b/xar/test/compression.py
|
||||
index 2b3b2ec..7ed30ca 100755
|
||||
--- a/xar/test/compression.py
|
||||
+++ b/xar/test/compression.py
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
-import cStringIO
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
+import sys
|
||||
import tempfile
|
||||
|
||||
import util
|
||||
@@ -16,10 +16,15 @@ import util
|
||||
#
|
||||
|
||||
def _check_compression(filename, *args, **kwargs):
|
||||
- with util.archive_created(filename, "/bin", *args, **kwargs) as path:
|
||||
+ with (
|
||||
+ util.directory_created("temp") as temp_directory,
|
||||
+ util.chdir(temp_directory),
|
||||
+ util.test_directory_created("testdir") as test_directory,
|
||||
+ util.archive_created(filename, "testdir", *args, **kwargs) as path,
|
||||
+ ):
|
||||
with util.directory_created("extracted") as directory:
|
||||
subprocess.check_call(["xar", "-x", "-f", path, "-C", directory])
|
||||
- util.assert_identical_directories("/bin", os.path.join(directory, "bin"))
|
||||
+ util.assert_identical_directories(test_directory, os.path.join(directory, "testdir"))
|
||||
|
||||
|
||||
#
|
||||
@@ -61,14 +66,18 @@ TEST_CASES = (no_compression, default_compression,
|
||||
gzip_compression_short, bzip2_compression_short, lzma_compression_short)
|
||||
|
||||
if __name__ == "__main__":
|
||||
+ failed = False
|
||||
for case in TEST_CASES:
|
||||
+ func_name = case.__name__
|
||||
try:
|
||||
- case("{f}.xar".format(f=case.func_name))
|
||||
- print("PASSED: {f}".format(f=case.func_name))
|
||||
+ case("{f}.xar".format(f=func_name))
|
||||
+ print("PASSED: {f}".format(f=func_name))
|
||||
except (AssertionError, IOError, subprocess.CalledProcessError):
|
||||
- import sys, os
|
||||
- print("FAILED: {f}".format(f=case.func_name))
|
||||
+ failed = True
|
||||
+ print("FAILED: {f}".format(f=func_name))
|
||||
sys.excepthook(*sys.exc_info())
|
||||
print("")
|
||||
- except util.TestCaseSkipError, e:
|
||||
- print("SKIPPED: {f}: {m}".format(f=case.func_name, m=e.message))
|
||||
+ except util.TestCaseSkipError as e:
|
||||
+ print("SKIPPED: {f}: {m}".format(f=func_name, m=e))
|
||||
+ if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/data.py b/xar/test/data.py
|
||||
index a9793f0..f902b78 100755
|
||||
--- a/xar/test/data.py
|
||||
+++ b/xar/test/data.py
|
||||
@@ -6,6 +6,7 @@ import contextlib
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
+import sys
|
||||
import util
|
||||
|
||||
|
||||
@@ -28,7 +29,7 @@ def _process_toc(archive_path):
|
||||
subprocess.check_call(["xar", "-f", archive_path, "--dump-toc=data_toc.xml"])
|
||||
try:
|
||||
result = subprocess.check_output(["xsltproc", "-o", "-", os.path.realpath(os.path.join(__file__, "..", "data.xsl")), "data_toc.xml"])
|
||||
- assert result == "", "expected no data offset, but instead found:{o}".format(o=result)
|
||||
+ assert result == b"", "expected no data offset, but instead found:{o}".format(o=result)
|
||||
finally:
|
||||
os.unlink("data_toc.xml")
|
||||
|
||||
@@ -90,14 +91,18 @@ TEST_CASES = (zero_length_default_compression, zero_length_no_compression,
|
||||
mixed_length_gzip_compression, mixed_length_bzip2_compression, mixed_length_lzma_compression)
|
||||
|
||||
if __name__ == "__main__":
|
||||
+ failed = False
|
||||
for case in TEST_CASES:
|
||||
+ func_name = case.__name__
|
||||
try:
|
||||
- case("{f}.xar".format(f=case.func_name))
|
||||
- print("PASSED: {f}".format(f=case.func_name))
|
||||
+ case("{f}.xar".format(f=func_name))
|
||||
+ print("PASSED: {f}".format(f=func_name))
|
||||
except (AssertionError, IOError, subprocess.CalledProcessError):
|
||||
- import sys, os
|
||||
- print("FAILED: {f}".format(f=case.func_name))
|
||||
+ failed = True
|
||||
+ print("FAILED: {f}".format(f=func_name))
|
||||
sys.excepthook(*sys.exc_info())
|
||||
print("")
|
||||
- except util.TestCaseSkipError, e:
|
||||
- print("SKIPPED: {f}: {m}".format(f=case.func_name, m=e.message))
|
||||
+ except util.TestCaseSkipError as e:
|
||||
+ print("SKIPPED: {f}: {m}".format(f=func_name, m=e))
|
||||
+ if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/hardlink.py b/xar/test/hardlink.py
|
||||
index 5145216..da409d6 100755
|
||||
--- a/xar/test/hardlink.py
|
||||
+++ b/xar/test/hardlink.py
|
||||
@@ -5,6 +5,7 @@ from __future__ import print_function
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
+import sys
|
||||
|
||||
import util
|
||||
|
||||
@@ -58,12 +59,17 @@ def hard_link_identical_files(filename):
|
||||
TEST_CASES = (hard_link_in_directory, hard_link_in_cwd, hard_link_identical_files)
|
||||
|
||||
if __name__ == "__main__":
|
||||
+ failed = False
|
||||
for case in TEST_CASES:
|
||||
+ func_name = case.__name__
|
||||
try:
|
||||
- case("{f}.xar".format(f=case.func_name))
|
||||
- print("PASSED: {f}".format(f=case.func_name))
|
||||
+ case("{f}.xar".format(f=func_name))
|
||||
+ print("PASSED: {f}".format(f=func_name))
|
||||
except (AssertionError, IOError, subprocess.CalledProcessError):
|
||||
+ failed = True
|
||||
import sys, os
|
||||
- print("FAILED: {f}".format(f=case.func_name))
|
||||
+ print("FAILED: {f}".format(f=func_name))
|
||||
sys.excepthook(*sys.exc_info())
|
||||
print("")
|
||||
+ if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/heap.py b/xar/test/heap.py
|
||||
index f431c77..727412a 100755
|
||||
--- a/xar/test/heap.py
|
||||
+++ b/xar/test/heap.py
|
||||
@@ -8,6 +8,7 @@ import os.path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
+import sys
|
||||
|
||||
import util
|
||||
|
||||
@@ -19,8 +20,8 @@ import util
|
||||
def _file_offsets_for_archive(path, xsl_path):
|
||||
subprocess.check_call(["xar", "--dump-toc=heap_toc.xml", "-f", path])
|
||||
try:
|
||||
- offsets = subprocess.check_output(["xsltproc", xsl_path, "heap_toc.xml"])
|
||||
- matches = [re.match("^(.+)\s([^\s]+)$", offset) for offset in offsets.splitlines()]
|
||||
+ offsets = subprocess.check_output(["xsltproc", xsl_path, "heap_toc.xml"], text=True)
|
||||
+ matches = [re.match(r"^(.+)\s([^\s]+)$", offset) for offset in offsets.splitlines()]
|
||||
offsets = [(match.groups()[0], int(match.groups()[1])) for match in matches]
|
||||
return offsets
|
||||
finally:
|
||||
@@ -33,9 +34,8 @@ def _file_offsets_for_archive(path, xsl_path):
|
||||
XSL_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "heap1.xsl")
|
||||
|
||||
def normal_heap(filename):
|
||||
- with util.directory_created("scratch") as directory:
|
||||
- shutil.copy("/bin/ls", os.path.join(directory, "ls"))
|
||||
- shutil.copy(os.path.join(directory, "ls"), os.path.join(directory, "foo"))
|
||||
+ with util.test_directory_created("scratch") as directory:
|
||||
+ shutil.copy(os.path.join(directory, "script"), os.path.join(directory, "foo"))
|
||||
with util.chdir(directory):
|
||||
with util.archive_created(os.path.join("..", "heap.xar"), ".") as path:
|
||||
# Verify file offsets are as we expect
|
||||
@@ -50,9 +50,8 @@ def normal_heap(filename):
|
||||
subprocess.check_call(["xar", "-x", "-f", path, "-C", extracted])
|
||||
|
||||
def coalesce_heap(filename):
|
||||
- with util.directory_created("scratch") as directory:
|
||||
- shutil.copy("/bin/ls", os.path.join(directory, "ls"))
|
||||
- shutil.copy(os.path.join(directory, "ls"), os.path.join(directory, "foo"))
|
||||
+ with util.test_directory_created("scratch") as directory:
|
||||
+ shutil.copy(os.path.join(directory, "script"), os.path.join(directory, "foo"))
|
||||
with util.chdir(directory):
|
||||
with util.archive_created(os.path.join("..", "heap.xar"), ".", "--coalesce-heap") as path:
|
||||
# Verify file offsets are as we expect
|
||||
@@ -67,12 +66,16 @@ def coalesce_heap(filename):
|
||||
TEST_CASES = (normal_heap, coalesce_heap)
|
||||
|
||||
if __name__ == "__main__":
|
||||
+ failed = False
|
||||
for case in TEST_CASES:
|
||||
+ func_name = case.__name__
|
||||
try:
|
||||
- case("{f}.xar".format(f=case.func_name))
|
||||
- print("PASSED: {f}".format(f=case.func_name))
|
||||
+ case("{f}.xar".format(f=func_name))
|
||||
+ print("PASSED: {f}".format(f=func_name))
|
||||
except (AssertionError, IOError, subprocess.CalledProcessError):
|
||||
- import sys, os
|
||||
- print("FAILED: {f}".format(f=case.func_name))
|
||||
+ failed = True
|
||||
+ print("FAILED: {f}".format(f=func_name))
|
||||
sys.excepthook(*sys.exc_info())
|
||||
print("")
|
||||
+ if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/integrity.py b/xar/test/integrity.py
|
||||
index c47ac6a..f4d2af7 100755
|
||||
--- a/xar/test/integrity.py
|
||||
+++ b/xar/test/integrity.py
|
||||
@@ -5,6 +5,7 @@ from __future__ import print_function
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
+import sys
|
||||
|
||||
import util
|
||||
|
||||
@@ -12,9 +13,9 @@ import util
|
||||
# Utility Functions
|
||||
#
|
||||
|
||||
-def _test_truncation(filename, path_to_be_archived, bytes_to_chop, *args):
|
||||
- with util.archive_created(filename, path_to_be_archived) as path:
|
||||
- with open("/dev/null", "w") as bitbucket:
|
||||
+def _test_truncation(filename, bytes_to_chop, *args):
|
||||
+ with util.test_directory_created("testdir") as test_directory:
|
||||
+ with util.archive_created(filename, test_directory) as path:
|
||||
size = os.stat(path).st_size
|
||||
while size > 0:
|
||||
last_size = size
|
||||
@@ -23,7 +24,7 @@ def _test_truncation(filename, path_to_be_archived, bytes_to_chop, *args):
|
||||
f.truncate(size)
|
||||
|
||||
with util.directory_created("scratch") as directory:
|
||||
- returncode = subprocess.call(["xar", "-x", "-f", path, "-C", directory], stderr=bitbucket)
|
||||
+ returncode = subprocess.call(["xar", "-x", "-f", path, "-C", directory], stderr=subprocess.DEVNULL)
|
||||
assert returncode != 0, "xar claimed to succeed when extracting a truncated archive"
|
||||
|
||||
#
|
||||
@@ -31,42 +32,42 @@ def _test_truncation(filename, path_to_be_archived, bytes_to_chop, *args):
|
||||
#
|
||||
|
||||
def large_uncompressed(filename):
|
||||
- _test_truncation(filename, "/usr/share/man/man1", 1024 * 1024, "--compression=none")
|
||||
+ _test_truncation(filename, 1024 * 1024, "--compression=none")
|
||||
|
||||
def large_default_compression(filename):
|
||||
- _test_truncation(filename, "/usr/share/man/man1", 1024 * 1024)
|
||||
+ _test_truncation(filename, 1024 * 1024)
|
||||
|
||||
def large_gzip_compressed(filename):
|
||||
util.skip_if_no_compression_support("gzip")
|
||||
- _test_truncation(filename, "/usr/share/man/man1", 1024 * 1024, "--compression=gzip")
|
||||
+ _test_truncation(filename, 1024 * 1024, "--compression=gzip")
|
||||
|
||||
def large_bzip2_compressed(filename):
|
||||
util.skip_if_no_compression_support("bzip2")
|
||||
- _test_truncation(filename, "/usr/share/man/man1", 1024 * 1024, "--compression=bzip2")
|
||||
+ _test_truncation(filename, 1024 * 1024, "--compression=bzip2")
|
||||
|
||||
def large_lzma_compressed(filename):
|
||||
util.skip_if_no_compression_support("lzma")
|
||||
- _test_truncation(filename, "/usr/share/man/man1", 1024 * 1024, "--compression=lzma")
|
||||
+ _test_truncation(filename, 1024 * 1024, "--compression=lzma")
|
||||
|
||||
# "small" variants use a non-base-2 size to try to catch issues that occur on uneven boundaries
|
||||
|
||||
def small_uncompressed(filename):
|
||||
- _test_truncation(filename, "/bin", 43651, "--compression=none")
|
||||
+ _test_truncation(filename, 43651, "--compression=none")
|
||||
|
||||
def small_default_compression(filename):
|
||||
- _test_truncation(filename, "/bin", 43651)
|
||||
+ _test_truncation(filename, 43651)
|
||||
|
||||
def small_gzip_compressed(filename):
|
||||
util.skip_if_no_compression_support("gzip")
|
||||
- _test_truncation(filename, "/bin", 43651, "--compression=gzip")
|
||||
+ _test_truncation(filename, 43651, "--compression=gzip")
|
||||
|
||||
def small_bzip2_compressed(filename):
|
||||
util.skip_if_no_compression_support("bzip2")
|
||||
- _test_truncation(filename, "/bin", 43651, "--compression=bzip2")
|
||||
+ _test_truncation(filename, 43651, "--compression=bzip2")
|
||||
|
||||
def small_lzma_compressed(filename):
|
||||
util.skip_if_no_compression_support("lzma")
|
||||
- _test_truncation(filename, "/bin", 43651, "--compression=lzma")
|
||||
+ _test_truncation(filename, 43651, "--compression=lzma")
|
||||
|
||||
|
||||
TEST_CASES = (large_uncompressed, large_default_compression,
|
||||
@@ -75,14 +76,18 @@ TEST_CASES = (large_uncompressed, large_default_compression,
|
||||
small_gzip_compressed, small_bzip2_compressed, small_lzma_compressed)
|
||||
|
||||
if __name__ == "__main__":
|
||||
+ failed = False
|
||||
for case in TEST_CASES:
|
||||
+ func_name = case.__name__
|
||||
try:
|
||||
- case("{f}.xar".format(f=case.func_name))
|
||||
- print("PASSED: {f}".format(f=case.func_name))
|
||||
+ case("{f}.xar".format(f=func_name))
|
||||
+ print("PASSED: {f}".format(f=func_name))
|
||||
except (AssertionError, IOError, subprocess.CalledProcessError):
|
||||
- import sys, os
|
||||
- print("FAILED: {f}".format(f=case.func_name))
|
||||
+ failed = True
|
||||
+ print("FAILED: {f}".format(f=func_name))
|
||||
sys.excepthook(*sys.exc_info())
|
||||
print("")
|
||||
- except util.TestCaseSkipError, e:
|
||||
- print("SKIPPED: {f}: {m}".format(f=case.func_name, m=e.message))
|
||||
+ except util.TestCaseSkipError as e:
|
||||
+ print("SKIPPED: {f}: {m}".format(f=func_name, m=e))
|
||||
+ if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/run-all.py b/xar/test/run-all.py
|
||||
new file mode 100755
|
||||
index 0000000..05e3054
|
||||
--- /dev/null
|
||||
+++ b/xar/test/run-all.py
|
||||
@@ -0,0 +1,25 @@
|
||||
+#!/usr/bin/env python3
|
||||
+
|
||||
+import os.path
|
||||
+import subprocess
|
||||
+import sys
|
||||
+
|
||||
+test_suites = [
|
||||
+ "attr.py",
|
||||
+ "checksums.py",
|
||||
+ "compression.py",
|
||||
+ "data.py",
|
||||
+ "hardlink.py",
|
||||
+ "heap.py",
|
||||
+ "integrity.py",
|
||||
+]
|
||||
+
|
||||
+test_path = os.path.dirname(__file__)
|
||||
+
|
||||
+failed = False
|
||||
+for suite in test_suites:
|
||||
+ p = subprocess.run([sys.executable, "--", os.path.join(test_path, suite)])
|
||||
+ if p.returncode:
|
||||
+ failed = True
|
||||
+if failed:
|
||||
+ sys.exit(1)
|
||||
diff --git a/xar/test/util.py b/xar/test/util.py
|
||||
index da79925..423dd3c 100644
|
||||
--- a/xar/test/util.py
|
||||
+++ b/xar/test/util.py
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import contextlib
|
||||
+import errno
|
||||
+import functools
|
||||
import hashlib
|
||||
import os
|
||||
import os.path
|
||||
@@ -13,16 +15,65 @@ import xattr
|
||||
class TestCaseSkipError(Exception):
|
||||
pass
|
||||
|
||||
+@functools.cache
|
||||
+def _check_xattrs_supported():
|
||||
+ """
|
||||
+ Returns True if the filesystem supports extended attributes.
|
||||
+ """
|
||||
+ with directory_created("empty") as directory:
|
||||
+ try:
|
||||
+ xattr.setxattr(directory, "user.xattrcheck", b"supported")
|
||||
+ return True
|
||||
+ except OSError as e:
|
||||
+ if e.errno != errno.ENOTSUP:
|
||||
+ raise
|
||||
+ return False
|
||||
+
|
||||
+def skip_if_no_xattrs_support():
|
||||
+ """
|
||||
+ Raises TestCaseSkipError if the the filesystem does not support extended
|
||||
+ attributes.
|
||||
+ """
|
||||
+ if not _check_xattrs_supported():
|
||||
+ raise TestCaseSkipError("filesystem does not support extended attributes")
|
||||
+
|
||||
+@functools.cache
|
||||
+def _check_compression_supported(type):
|
||||
+ """
|
||||
+ Returns True if xar has support for the given compression type compiled
|
||||
+ in. This function performs a runtime check that tries to compress data
|
||||
+ with the given compression type and looks for a known error string. It
|
||||
+ ignores all other errors.
|
||||
+ """
|
||||
+ supported = True
|
||||
+ with directory_created("empty") as directory:
|
||||
+ archive_path = f"{type}_compression_check.xar"
|
||||
+ try:
|
||||
+ return f"{type} support not compiled in." not in subprocess.run(
|
||||
+ [
|
||||
+ "xar",
|
||||
+ "-c",
|
||||
+ "-f",
|
||||
+ archive_path,
|
||||
+ "--compression=" + type,
|
||||
+ directory,
|
||||
+ ],
|
||||
+ stdout=subprocess.PIPE,
|
||||
+ text=True,
|
||||
+ ).stdout
|
||||
+ except:
|
||||
+ # Assume that this compression type is supported.
|
||||
+ pass
|
||||
+ finally:
|
||||
+ if os.path.exists(archive_path):
|
||||
+ os.unlink(archive_path)
|
||||
+ return supported
|
||||
+
|
||||
def skip_if_no_compression_support(type):
|
||||
"""
|
||||
- Raises TestCaseSkipError if the type is "lzma" and the test is running on
|
||||
- darwin (OS X). In the future, we should add a hidden debugging flag to xar
|
||||
- to determine valid compression types. This will skip incorrectly if a
|
||||
- custom xar is used on OS X, or if a custom xar on another platform is
|
||||
- built without bzip2 or lzma.
|
||||
-
|
||||
+ Raises TestCaseSkipError if the compression type is not compiled in.
|
||||
"""
|
||||
- if sys.platform == "darwin" and type == "lzma":
|
||||
+ if not _check_compression_supported(type):
|
||||
raise TestCaseSkipError("{t} support not compiled in".format(t=type))
|
||||
|
||||
@contextlib.contextmanager
|
||||
@@ -43,6 +94,22 @@ def directory_created(directory_path):
|
||||
if os.path.exists(directory_path):
|
||||
shutil.rmtree(directory_path)
|
||||
|
||||
+@contextlib.contextmanager
|
||||
+def test_directory_created(directory_path):
|
||||
+ """
|
||||
+ Like directory_created, but populates the directory with test files.
|
||||
+ """
|
||||
+ with directory_created(directory_path) as directory:
|
||||
+ with open(os.path.join(directory, "script"), "w+", opener=lambda path, flags: os.open(path, flags, 0o750)) as f:
|
||||
+ f.write("#!/bin/sh\necho hello world")
|
||||
+ with open(os.path.join(directory, "random_1kb"), "wb+") as f:
|
||||
+ f.write(os.urandom(1000))
|
||||
+ with open(os.path.join(directory, "random_4kib"), "wb+") as f:
|
||||
+ f.write(os.urandom(4096))
|
||||
+ with open(os.path.join(directory, "random_1mb"), "wb+") as f:
|
||||
+ f.write(os.urandom(9999999))
|
||||
+ yield directory
|
||||
+
|
||||
@contextlib.contextmanager
|
||||
def archive_created(archive_path, content_path, *extra_args, **extra_kwargs):
|
||||
"""
|
||||
@@ -68,7 +135,7 @@ def archive_created(archive_path, content_path, *extra_args, **extra_kwargs):
|
||||
HASH_CHUNK_SIZE = 32768
|
||||
|
||||
def _md5_path(path):
|
||||
- with open(path, "r") as f:
|
||||
+ with open(path, "rb") as f:
|
||||
h = hashlib.md5()
|
||||
while True:
|
||||
last = f.read(HASH_CHUNK_SIZE)
|
||||
@@ -122,7 +189,7 @@ def assert_identical_directories(path1, path2):
|
||||
|
||||
# Sizes and the like
|
||||
assert stat1.st_size == stat2.st_size, "size mismatch for \"{e1}\" ({s1}) and \"{e2}\" ({s2})".format(e1=entry1, s1=stat1.st_size, e2=entry2, s2=stat2.st_size)
|
||||
- assert stat1.st_mtime == stat2.st_mtime, "mtime mismatch for \"{e1}\" and \"{e2}\"".format(e1=entry1, e2=entry2)
|
||||
+ assert int(stat1.st_mtime) == int(stat2.st_mtime), "mtime mismatch for \"{e1}\" and \"{e2}\"".format(e1=entry1, e2=entry2)
|
||||
assert _md5_path(entry1) == _md5_path(entry2), "md5 hash mismatch for \"{e1}\" and \"{e2}\"".format(e1=entry1, e2=entry2)
|
||||
if os.path.isdir(entry1):
|
||||
assert_identical_directories(entry1, entry2)
|
||||
diff --git a/xar/test/validate.c b/xar/test/validate.c
|
||||
index dfe69eb..a5fbe37 100644
|
||||
--- a/xar/test/validate.c
|
||||
+++ b/xar/test/validate.c
|
||||
@@ -16,37 +16,40 @@
|
||||
|
||||
off_t HeapOff = 0;
|
||||
|
||||
-static char* xar_format_md5(const unsigned char* m) {
|
||||
+static char* xar_format_sha1(const unsigned char* m) {
|
||||
char* result = NULL;
|
||||
asprintf(&result,
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x"
|
||||
+ "%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x",
|
||||
m[0], m[1], m[2], m[3],
|
||||
m[4], m[5], m[6], m[7],
|
||||
m[8], m[9], m[10], m[11],
|
||||
- m[12], m[13], m[14], m[15]);
|
||||
+ m[12], m[13], m[14], m[15],
|
||||
+ m[16], m[17], m[18], m[19]);
|
||||
return result;
|
||||
}
|
||||
|
||||
void heap_check(int fd, const char *name, const char *prop, off_t offset, off_t length, const char *csum) {
|
||||
char *buf;
|
||||
- EVP_MD_CTX ctx;
|
||||
+ EVP_MD_CTX *ctx;
|
||||
const EVP_MD *md;
|
||||
- unsigned char md5str[EVP_MAX_MD_SIZE];
|
||||
+ unsigned char sha1str[EVP_MAX_MD_SIZE];
|
||||
unsigned int len;
|
||||
ssize_t r;
|
||||
- char *formattedmd5;
|
||||
+ char *formattedsha1;
|
||||
|
||||
fprintf(stderr, "Heap checking %s %s at offset: %" PRIu64 "\n", name, prop, HeapOff+offset);
|
||||
OpenSSL_add_all_digests();
|
||||
- md = EVP_get_digestbyname("md5");
|
||||
+ md = EVP_get_digestbyname("sha1");
|
||||
if( md == NULL ) {
|
||||
- fprintf(stderr, "No md5 digest in openssl\n");
|
||||
+ fprintf(stderr, "No sha1 digest in openssl\n");
|
||||
exit(1);
|
||||
}
|
||||
- EVP_DigestInit(&ctx, md);
|
||||
+ ctx = EVP_MD_CTX_create();
|
||||
+ EVP_DigestInit(ctx, md);
|
||||
|
||||
buf = malloc(length);
|
||||
if( !buf ) {
|
||||
@@ -65,14 +68,15 @@ void heap_check(int fd, const char *name, const char *prop, off_t offset, off_t
|
||||
fprintf(stderr, "Error reading from the heap\n");
|
||||
exit(1);
|
||||
}
|
||||
- EVP_DigestUpdate(&ctx, buf, length);
|
||||
- EVP_DigestFinal(&ctx, md5str, &len);
|
||||
+ EVP_DigestUpdate(ctx, buf, length);
|
||||
+ EVP_DigestFinal(ctx, sha1str, &len);
|
||||
+ EVP_MD_CTX_destroy(ctx);
|
||||
|
||||
- formattedmd5 = xar_format_md5(md5str);
|
||||
- if( strcmp(formattedmd5, csum) != 0 ) {
|
||||
- fprintf(stderr, "%s %s checksum does not match\n", name, prop);
|
||||
+ formattedsha1 = xar_format_sha1(sha1str);
|
||||
+ if( strcmp(formattedsha1, csum) != 0 ) {
|
||||
+ fprintf(stderr, "%s %s checksum does not match (got %s but expected %s)\n", name, prop, formattedsha1, csum);
|
||||
}
|
||||
- free(formattedmd5);
|
||||
+ free(formattedsha1);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 16:34:17 +0300
|
||||
Subject: [PATCH 02/19] Update for modern liblzma5 versions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This change updates liblzma usage for modern xz versions (≥ 5, that is,
|
||||
released less than a decade ago).
|
||||
|
||||
It also fixes missing realloc buffer calls that were supposed to be
|
||||
there but were lost in xar-420 (and Apple does not ship xar with LZMA
|
||||
support so nobody noticed). See also the offending commit:
|
||||
https://github.com/apple-oss-distributions/xar/commit/2426082efec74e9ed545cc4f5812ad16322bdf2c
|
||||
---
|
||||
xar/lib/lzmaxar.c | 65 ++++++++---------------------------------------
|
||||
1 file changed, 10 insertions(+), 55 deletions(-)
|
||||
|
||||
diff --git a/xar/lib/lzmaxar.c b/xar/lib/lzmaxar.c
|
||||
index ba9c868..8dcb484 100644
|
||||
--- a/xar/lib/lzmaxar.c
|
||||
+++ b/xar/lib/lzmaxar.c
|
||||
@@ -54,27 +54,12 @@
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
|
||||
-#ifndef UINT32_C
|
||||
-#define UINT32_C(v) (v ## U) /* from <stdint.h> normally */
|
||||
-#endif
|
||||
-#ifndef LZMA_VERSION
|
||||
-#define LZMA_VERSION UINT32_C(40420000) /* = 4.42.0alpha6 */
|
||||
-#endif
|
||||
-
|
||||
struct _lzma_context{
|
||||
uint8_t lzmacompressed;
|
||||
lzma_stream lzma;
|
||||
- lzma_options_stream options;
|
||||
- lzma_allocator allocator;
|
||||
-#if LZMA_VERSION < 40420010U
|
||||
- lzma_memory_limitter *limit;
|
||||
-#else
|
||||
- lzma_memlimit *limit;
|
||||
-#endif
|
||||
};
|
||||
|
||||
#define preset_level 7
|
||||
-#define memory_limit 93*1024*1024 /* 1=1M, 5=24M, 6=39M, 7=93M, 8=185M, 9=369M */
|
||||
|
||||
#define LZMA_CONTEXT(x) ((struct _lzma_context *)(*x))
|
||||
#endif
|
||||
@@ -116,9 +101,7 @@ int xar_lzma_fromheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in, size_t
|
||||
if( !opt ) return 0;
|
||||
if( strcmp(opt, "application/x-lzma") != 0 ) return 0;
|
||||
|
||||
- lzma_init_decoder();
|
||||
- LZMA_CONTEXT(context)->lzma = LZMA_STREAM_INIT_VAR;
|
||||
- r = lzma_stream_decoder(&LZMA_CONTEXT(context)->lzma, NULL, NULL);
|
||||
+ r = lzma_stream_decoder(&LZMA_CONTEXT(context)->lzma, UINT64_MAX, LZMA_CONCATENATED);
|
||||
if( (r != LZMA_OK) ) {
|
||||
xar_err_new(x);
|
||||
xar_err_set_file(x, f);
|
||||
@@ -194,11 +177,6 @@ int xar_lzma_toheap_done(xar_t x, xar_file_t f, xar_prop_t p, void **context) {
|
||||
|
||||
if( LZMA_CONTEXT(context)->lzmacompressed){
|
||||
lzma_end(&LZMA_CONTEXT(context)->lzma);
|
||||
-#if LZMA_VERSION < 40420010U
|
||||
- lzma_memory_limitter_end(LZMA_CONTEXT(context)->limit, 1);
|
||||
-#else
|
||||
- lzma_memlimit_end(LZMA_CONTEXT(context)->limit, 1);
|
||||
-#endif
|
||||
|
||||
tmpp = xar_prop_pset(f, p, "encoding", NULL);
|
||||
if( tmpp )
|
||||
@@ -222,7 +200,7 @@ int32_t xar_lzma_toheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in, size_
|
||||
|
||||
/* on first run, we init the context and check the compression type */
|
||||
if( !LZMA_CONTEXT(context) ) {
|
||||
- int level = preset_level;
|
||||
+ uint32_t level = preset_level;
|
||||
*context = calloc(1,sizeof(struct _lzma_context));
|
||||
|
||||
opt = xar_opt_get(x, XAR_OPT_COMPRESSION);
|
||||
@@ -243,35 +221,7 @@ int32_t xar_lzma_toheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in, size_
|
||||
}
|
||||
}
|
||||
|
||||
- lzma_init_encoder();
|
||||
- LZMA_CONTEXT(context)->options.check = LZMA_CHECK_CRC64;
|
||||
- LZMA_CONTEXT(context)->options.has_crc32 = 1; /* true */
|
||||
- LZMA_CONTEXT(context)->options.alignment = 0;
|
||||
-#if defined (__ppc__) || defined (powerpc) || defined (__ppc64__)
|
||||
- LZMA_CONTEXT(context)->options.filters[0].id = LZMA_FILTER_POWERPC;
|
||||
-#elif defined (__i386__) || defined (__amd64__) || defined(__x86_64__)
|
||||
- LZMA_CONTEXT(context)->options.filters[0].id = LZMA_FILTER_X86;
|
||||
-#else
|
||||
- LZMA_CONTEXT(context)->options.filters[0].id = LZMA_FILTER_COPY;
|
||||
-#endif
|
||||
- LZMA_CONTEXT(context)->options.filters[0].options = NULL;
|
||||
- LZMA_CONTEXT(context)->options.filters[1].id = LZMA_FILTER_LZMA;
|
||||
- LZMA_CONTEXT(context)->options.filters[1].options = (lzma_options_lzma *)(lzma_preset_lzma + level - 1);
|
||||
- /* Terminate the filter options array. */
|
||||
- LZMA_CONTEXT(context)->options.filters[2].id = UINT64_MAX;
|
||||
- LZMA_CONTEXT(context)->lzma = LZMA_STREAM_INIT_VAR;
|
||||
-#if LZMA_VERSION < 40420010U
|
||||
- LZMA_CONTEXT(context)->limit = lzma_memory_limitter_create(memory_limit);
|
||||
- LZMA_CONTEXT(context)->allocator.alloc = (void*) lzma_memory_alloc;
|
||||
- LZMA_CONTEXT(context)->allocator.free = (void*) lzma_memory_free;
|
||||
-#else
|
||||
- LZMA_CONTEXT(context)->limit = lzma_memlimit_create(memory_limit);
|
||||
- LZMA_CONTEXT(context)->allocator.alloc = (void*) lzma_memlimit_alloc;
|
||||
- LZMA_CONTEXT(context)->allocator.free = (void*) lzma_memlimit_free;
|
||||
-#endif
|
||||
- LZMA_CONTEXT(context)->allocator.opaque = LZMA_CONTEXT(context)->limit;
|
||||
- LZMA_CONTEXT(context)->lzma.allocator = &LZMA_CONTEXT(context)->allocator;
|
||||
- r = lzma_stream_encoder_single(&LZMA_CONTEXT(context)->lzma, &(LZMA_CONTEXT(context)->options));
|
||||
+ r = lzma_easy_encoder(&LZMA_CONTEXT(context)->lzma, level, LZMA_CHECK_CRC64);
|
||||
if( (r != LZMA_OK) ) {
|
||||
xar_err_new(x);
|
||||
xar_err_set_file(x, f);
|
||||
@@ -279,6 +229,7 @@ int32_t xar_lzma_toheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in, size_
|
||||
xar_err_callback(x, XAR_SEVERITY_FATAL, XAR_ERR_ARCHIVE_CREATION);
|
||||
return -1;
|
||||
}
|
||||
+
|
||||
LZMA_CONTEXT(context)->lzmacompressed = 1;
|
||||
if( *inlen == 0 )
|
||||
return 0;
|
||||
@@ -303,7 +254,8 @@ int32_t xar_lzma_toheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in, size_
|
||||
outlen = newlen;
|
||||
else
|
||||
abort(); /* Someone has somehow malloced over 2^64 bits of ram. */
|
||||
-
|
||||
+
|
||||
+ out = realloc(out, outlen);
|
||||
if( out == NULL ) abort();
|
||||
|
||||
LZMA_CONTEXT(context)->lzma.next_out = ((unsigned char *)out) + offset;
|
||||
@@ -318,7 +270,10 @@ int32_t xar_lzma_toheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in, size_
|
||||
if (newlen > outlen)
|
||||
outlen = newlen;
|
||||
else
|
||||
- abort(); /* Someone has somehow malloced over 2^64 bits of ram. */ if( out == NULL ) abort();
|
||||
+ abort(); /* Someone has somehow malloced over 2^64 bits of ram. */
|
||||
+
|
||||
+ out = realloc(out, outlen);
|
||||
+ if( out == NULL ) abort();
|
||||
|
||||
LZMA_CONTEXT(context)->lzma.next_out = ((unsigned char *)out) + offset;
|
||||
LZMA_CONTEXT(context)->lzma.avail_out = outlen - offset;
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 18:25:48 +0300
|
||||
Subject: [PATCH 03/19] Fix undefined EXT2_ECOMPR_FL for e2fsprogs
|
||||
|
||||
See https://github.com/mackyle/xar/issues/10
|
||||
---
|
||||
xar/lib/ext2.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/xar/lib/ext2.c b/xar/lib/ext2.c
|
||||
index 767891a..2380846 100644
|
||||
--- a/xar/lib/ext2.c
|
||||
+++ b/xar/lib/ext2.c
|
||||
@@ -139,8 +139,10 @@ int xar_ext2attr_archive(xar_t x, xar_file_t f, const char* file, const char *bu
|
||||
if(! (flags & ~EXT2_NOCOMPR_FL) )
|
||||
x_addprop(f, "NoCompBlock");
|
||||
#endif
|
||||
+#ifdef EXT2_ECOMPR_FL
|
||||
if(! (flags & ~EXT2_ECOMPR_FL) )
|
||||
x_addprop(f, "CompError");
|
||||
+#endif
|
||||
if(! (flags & ~EXT2_BTREE_FL) )
|
||||
x_addprop(f, "BTree");
|
||||
if(! (flags & ~EXT2_INDEX_FL) )
|
||||
@@ -225,8 +227,10 @@ int xar_ext2attr_extract(xar_t x, xar_file_t f, const char* file, char *buffer,
|
||||
if( e2prop_get(f, "NoCompBlock", (char **)&tmp) == 0 )
|
||||
flags |= EXT2_NOCOMPR_FL ;
|
||||
#endif
|
||||
+#ifdef EXT2_ECOMPR_FL
|
||||
if( e2prop_get(f, "CompError", (char **)&tmp) == 0 )
|
||||
flags |= EXT2_ECOMPR_FL ;
|
||||
+#endif
|
||||
if( e2prop_get(f, "BTree", (char **)&tmp) == 0 )
|
||||
flags |= EXT2_BTREE_FL ;
|
||||
if( e2prop_get(f, "HashIndexed", (char **)&tmp) == 0 )
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Groffen <grobian@gentoo.org>
|
||||
Date: Tue, 1 Jan 2019 18:00:08 +0100
|
||||
Subject: [PATCH 04/19] Fix compatibility with openssl-1.0
|
||||
|
||||
Patch-Source: https://github.com/gentoo/gentoo/blob/dce914f2bbf52360f45c90d877857df3c4c2a353/app-arch/xar/files/xar-1.8-openssl-1.1.patch
|
||||
--
|
||||
lib/hash.c: fix compilation with OpenSSL-1.1+
|
||||
|
||||
EVP_MD_CTX has become an anonymous struct now, so can't allocate size
|
||||
for it anymore.
|
||||
---
|
||||
xar/lib/hash.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/xar/lib/hash.c b/xar/lib/hash.c
|
||||
index 66876ad..cb4f6cf 100644
|
||||
--- a/xar/lib/hash.c
|
||||
+++ b/xar/lib/hash.c
|
||||
@@ -97,7 +97,7 @@ struct __xar_hash_t {
|
||||
#ifdef __APPLE__
|
||||
CCDigestRef digest;
|
||||
#else
|
||||
- EVP_MD_CTX digest;
|
||||
+ EVP_MD_CTX *digest;
|
||||
const EVP_MD *type;
|
||||
#endif
|
||||
unsigned int length;
|
||||
@@ -118,7 +118,8 @@ xar_hash_t xar_hash_new(const char *digest_name, void *context) {
|
||||
#else
|
||||
OpenSSL_add_all_digests();
|
||||
HASH_CTX(hash)->type = EVP_get_digestbyname(digest_name);
|
||||
- EVP_DigestInit(&HASH_CTX(hash)->digest, HASH_CTX(hash)->type);
|
||||
+ HASH_CTX(hash)->digest = EVP_MD_CTX_create();
|
||||
+ EVP_DigestInit(HASH_CTX(hash)->digest, HASH_CTX(hash)->type);
|
||||
#endif
|
||||
|
||||
HASH_CTX(hash)->digest_name = strdup(digest_name);
|
||||
@@ -138,7 +139,7 @@ void xar_hash_update(xar_hash_t hash, void *buffer, size_t nbyte) {
|
||||
#ifdef __APPLE__
|
||||
CCDigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
|
||||
#else
|
||||
- EVP_DigestUpdate(&HASH_CTX(hash)->digest, buffer, nbyte);
|
||||
+ EVP_DigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -155,7 +156,8 @@ void *xar_hash_finish(xar_hash_t hash, size_t *nbyte) {
|
||||
CCDigestFinal(HASH_CTX(hash)->digest, buffer);
|
||||
CCDigestDestroy(HASH_CTX(hash)->digest);
|
||||
#else
|
||||
- EVP_DigestFinal(&HASH_CTX(hash)->digest, buffer, &HASH_CTX(hash)->length);
|
||||
+ EVP_DigestFinal(HASH_CTX(hash)->digest, buffer, &HASH_CTX(hash)->length);
|
||||
+ EVP_MD_CTX_destroy(HASH_CTX(hash)->digest);
|
||||
#endif
|
||||
|
||||
*nbyte = HASH_CTX(hash)->length;
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
||||
Date: Sat, 2 Mar 2024 01:25:52 +0100
|
||||
Subject: [PATCH 05/19] Fix configure.ac for Linux headers
|
||||
|
||||
Patch-Source: https://github.com/gentoo/gentoo/blob/dce914f2bbf52360f45c90d877857df3c4c2a353/app-arch/xar/files/xar-1.8.0.0.452-linux.patch
|
||||
---
|
||||
xar/configure.ac | 19 +++++++++++++++++--
|
||||
xar/include/config.h.in | 3 +++
|
||||
xar/lib/util.c | 15 +++++++++++++++
|
||||
3 files changed, 35 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/xar/configure.ac b/xar/configure.ac
|
||||
index 3a36f42..26d41a5 100644
|
||||
--- a/xar/configure.ac
|
||||
+++ b/xar/configure.ac
|
||||
@@ -183,7 +183,7 @@ AC_SUBST([enable_autogen])
|
||||
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/acl.h>], [acl_t a], [AC_DEFINE([HAVE_SYS_ACL_H],[1], [define if you have sys/acl.h and it has a working acl_t type])])
|
||||
-AC_CHECK_HEADERS(ext2fs/ext2_fs.h sys/statfs.h sys/xattr.h sys/param.h sys/extattr.h libutil.h)
|
||||
+AC_CHECK_HEADERS(ext2fs/ext2_fs.h sys/statfs.h sys/vfs.h sys/xattr.h sys/param.h sys/extattr.h libutil.h)
|
||||
AC_CHECK_FUNCS(lgetxattr)
|
||||
AC_CHECK_FUNCS(lsetxattr)
|
||||
AC_CHECK_FUNCS(getxattr)
|
||||
@@ -199,7 +199,22 @@ AC_CHECK_FUNCS(strmode)
|
||||
|
||||
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
-#include <sys/mount.h>])
|
||||
+#include <sys/mount.h>
|
||||
+#ifdef HAVE_SYS_VFS_H
|
||||
+#include <sys/vfs.h>
|
||||
+#endif])
|
||||
+AC_CHECK_MEMBERS([struct statfs.f_iosize],,,[#include <sys/types.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/mount.h>
|
||||
+#ifdef HAVE_SYS_VFS_H
|
||||
+#include <sys/vfs.h>
|
||||
+#endif])
|
||||
+AC_CHECK_MEMBERS([struct statfs.f_bsize],,,[#include <sys/types.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/mount.h>
|
||||
+#ifdef HAVE_SYS_VFS_H
|
||||
+#include <sys/vfs.h>
|
||||
+#endif])
|
||||
AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,,[#include <sys/statvfs.h>])
|
||||
AC_CHECK_MEMBERS([struct stat.st_flags])
|
||||
|
||||
diff --git a/xar/include/config.h.in b/xar/include/config.h.in
|
||||
index 2bb997b..16c72d3 100644
|
||||
--- a/xar/include/config.h.in
|
||||
+++ b/xar/include/config.h.in
|
||||
@@ -1,4 +1,5 @@
|
||||
#undef HAVE_SYS_STATFS_H
|
||||
+#undef HAVE_SYS_VFS_H
|
||||
#undef HAVE_SYS_XATTR_H
|
||||
#undef HAVE_SYS_EXTATTR_H
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
@@ -15,6 +16,8 @@
|
||||
#undef HAVE_STRUCT_STAT_ST_FLAGS
|
||||
#undef HAVE_STRUCT_STATVFS_F_FSTYPENAME
|
||||
#undef HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||
+#undef HAVE_STRUCT_STATFS_F_IOSIZE
|
||||
+#undef HAVE_STRUCT_STATFS_F_BSIZE
|
||||
#undef HAVE_SYS_ACL_H
|
||||
#undef HAVE_LIBUTIL_H
|
||||
#undef HAVE_LIBPTHREAD
|
||||
diff --git a/xar/lib/util.c b/xar/lib/util.c
|
||||
index 0ea661a..1db2daa 100644
|
||||
--- a/xar/lib/util.c
|
||||
+++ b/xar/lib/util.c
|
||||
@@ -35,11 +35,16 @@
|
||||
* Christopher Ryan <ryanc@apple.com>
|
||||
*/
|
||||
|
||||
+#include "config.h"
|
||||
+
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/param.h>
|
||||
+#ifdef HAVE_SYS_VFS_H
|
||||
+# include <sys/vfs.h>
|
||||
+#endif
|
||||
#include <arpa/inet.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -583,6 +588,14 @@ char *xar_get_mtime(xar_t x, xar_file_t f) {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
+#ifndef HAVE_STRUCT_STATFS_F_IOSIZE
|
||||
+# ifdef HAVE_STRUCT_STATFS_F_BSIZE
|
||||
+# define f_iosize f_bsize
|
||||
+# else
|
||||
+# error need a field to get optimal transfer block size
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
size_t xar_optimal_io_size_at_path(const char *path)
|
||||
{
|
||||
// Start at 1MiB
|
||||
@@ -599,6 +612,7 @@ size_t xar_optimal_io_size_at_path(const char *path)
|
||||
fs_iosize = optimal_rsize;
|
||||
}
|
||||
|
||||
+#ifdef MNT_LOCAL
|
||||
// If we're a remote filesystem, never let us go below the optimal size above of 1MiB
|
||||
// NFS is horrible and lies that the optimal size is 512 bytes.
|
||||
// Whereas SMB in my testing returns 7MiBs (far more practicle)
|
||||
@@ -611,6 +625,7 @@ size_t xar_optimal_io_size_at_path(const char *path)
|
||||
}
|
||||
}
|
||||
else
|
||||
+#endif
|
||||
{
|
||||
optimal_rsize = fs_iosize;
|
||||
}
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 18:38:10 +0300
|
||||
Subject: [PATCH 06/19] Fix more non-Darwin stuff
|
||||
|
||||
---
|
||||
xar/include/xar.h.in | 1 +
|
||||
xar/lib/linuxattr.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xar/include/xar.h.in b/xar/include/xar.h.in
|
||||
index 9c93798..3d24b4f 100644
|
||||
--- a/xar/include/xar.h.in
|
||||
+++ b/xar/include/xar.h.in
|
||||
@@ -52,6 +52,7 @@ extern "C" {
|
||||
#import <os/availability.h>
|
||||
#else
|
||||
#define API_DEPRECATED(...)
|
||||
+#define API_AVAILABLE(...)
|
||||
#endif
|
||||
|
||||
#pragma pack(4)
|
||||
diff --git a/xar/lib/linuxattr.c b/xar/lib/linuxattr.c
|
||||
index 0fec2bb..58ee6a8 100644
|
||||
--- a/xar/lib/linuxattr.c
|
||||
+++ b/xar/lib/linuxattr.c
|
||||
@@ -226,7 +226,7 @@ int32_t xar_linuxattr_extract(xar_t x, xar_file_t f, const char* file, char *buf
|
||||
if( statfs(file, &sfs) != 0 ) {
|
||||
char *tmp, *bname;
|
||||
tmp = strdup(file);
|
||||
- bname = safe_dirname(tmp);
|
||||
+ bname = xar_safe_dirname(tmp);
|
||||
statfs(bname, &sfs);
|
||||
free(tmp);
|
||||
free(bname);
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Fabian Groffen <grobian@gentoo.org>
|
||||
Date: Sat, 16 Jul 2022 21:34:13 +0200
|
||||
Subject: [PATCH 07/19] replace initialized constant with #define statement
|
||||
|
||||
GCC doesn't like this:
|
||||
|
||||
filetree.c:744:9: error: variable-sized object may not be initialized
|
||||
|
||||
Since there's nothing changing at runtime at all, just make the compiler
|
||||
see it's always going to be 1.
|
||||
|
||||
Patch-Source: https://github.com/gentoo/gentoo/blob/dce914f2bbf52360f45c90d877857df3c4c2a353/app-arch/xar/files/xar-1.8.0.0.487-variable-sized-object.patch
|
||||
---
|
||||
xar/lib/filetree.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xar/lib/filetree.c b/xar/lib/filetree.c
|
||||
index f31682a..9c30c03 100644
|
||||
--- a/xar/lib/filetree.c
|
||||
+++ b/xar/lib/filetree.c
|
||||
@@ -752,7 +752,7 @@ int xar_file_equals_file(xar_file_t f1, xar_file_t f2)
|
||||
size_t fspath1_size = 0, fspath2_size = 0;
|
||||
size_t ns1_size = 0, ns2_size = 0;
|
||||
const struct __xar_file_t * child1 = NULL, * child2 = NULL;
|
||||
- const uint keys_to_ignore_count = 1;
|
||||
+#define keys_to_ignore_count 1
|
||||
char * keys_to_ignore[keys_to_ignore_count] = { "id" }; // ID is allowed ot mismatch
|
||||
|
||||
// If the two pointers match, call it the same.
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 18:43:38 +0300
|
||||
Subject: [PATCH 08/19] Fix configure.ac not finding $AR with target prefix
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes AR and RANLIB with target prefix (if not set to absolute paths).
|
||||
Looks like AC_PATH_PROG doesn’t perform PATH lookups when user overrides
|
||||
the program via environment variable but sets the value to program name
|
||||
instead of absolute path.
|
||||
|
||||
Note that LD seems to be unused so we remove it.
|
||||
---
|
||||
xar/configure.ac | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/xar/configure.ac b/xar/configure.ac
|
||||
index 26d41a5..3d8e5de 100644
|
||||
--- a/xar/configure.ac
|
||||
+++ b/xar/configure.ac
|
||||
@@ -86,9 +86,8 @@ fi
|
||||
AC_PROG_CPP
|
||||
|
||||
AC_PROG_INSTALL
|
||||
-AC_PATH_PROG([LD], [ld], , [$PATH])
|
||||
-AC_PATH_PROG([AR], [ar], , [$PATH])
|
||||
-AC_PATH_PROG([RANLIB], [ranlib], , [$PATH])
|
||||
+AC_PROG_AR
|
||||
+AC_PROG_RANLIB
|
||||
AC_PATH_PROG([AUTOCONF], [autoconf], , [$PATH])
|
||||
|
||||
dnl Some libtool envy
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
From a14be07c0aae3bf6f732d1ca5f625ba375702121 Mon Sep 17 00:00:00 2001
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||
Date: Sun, 15 Nov 2020 19:12:33 +0900
|
||||
Subject: [PATCH 1/2] Add useless descriptions to AC_DEFINE
|
||||
Subject: [PATCH 09/19] Add useless descriptions to AC_DEFINE
|
||||
|
||||
Removes autoheader warnings.
|
||||
Removes autoheader warnings from autoreconfHook.
|
||||
---
|
||||
configure.ac | 42 +++++++++++++++++++++---------------------
|
||||
1 file changed, 21 insertions(+), 21 deletions(-)
|
||||
xar/configure.ac | 46 +++++++++++++++++++++++-----------------------
|
||||
1 file changed, 23 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 812b5ff..358ab89 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -210,48 +210,48 @@ AC_CHECK_MEMBERS([struct stat.st_flags])
|
||||
diff --git a/xar/configure.ac b/xar/configure.ac
|
||||
index 3d8e5de..0cc04dd 100644
|
||||
--- a/xar/configure.ac
|
||||
+++ b/xar/configure.ac
|
||||
@@ -219,48 +219,48 @@ AC_CHECK_MEMBERS([struct stat.st_flags])
|
||||
|
||||
AC_CHECK_SIZEOF(uid_t)
|
||||
if test $ac_cv_sizeof_uid_t = "4"; then
|
||||
|
@ -81,7 +81,7 @@ index 812b5ff..358ab89 100644
|
|||
else
|
||||
AC_ERROR(can not detect the size of your system's dev_t type)
|
||||
fi
|
||||
@@ -261,7 +261,7 @@ AC_CHECK_LIB(acl, acl_get_file)
|
||||
@@ -270,7 +270,7 @@ AC_CHECK_LIB(acl, acl_get_file)
|
||||
dnl Check for paths
|
||||
AC_PREFIX_DEFAULT(/usr/local)
|
||||
|
||||
|
@ -90,6 +90,24 @@ index 812b5ff..358ab89 100644
|
|||
|
||||
dnl
|
||||
dnl Configure libxml2.
|
||||
@@ -350,7 +350,7 @@ have_libbz2="1"
|
||||
AC_CHECK_HEADERS([bzlib.h], , [have_libbz2="0"])
|
||||
AC_CHECK_LIB([bz2], [BZ2_bzCompress], , [have_libbz2="0"])
|
||||
if test "x${have_libbz2}" = "x1" ; then
|
||||
- AC_DEFINE([HAVE_LIBBZ2])
|
||||
+ AC_DEFINE([HAVE_LIBBZ2], [], [HAVE_LIBBZ2])
|
||||
fi
|
||||
|
||||
dnl
|
||||
@@ -360,7 +360,7 @@ have_libpthread="1"
|
||||
AC_CHECK_HEADERS([pthread.h], , [have_pthread="0"])
|
||||
AC_CHECK_LIB([pthread], [pthread_mutex_lock], , [have_pthread="0"])
|
||||
if test "x${have_pthread}" = "x1" ; then
|
||||
- AC_DEFINE([HAVE_PTHREAD])
|
||||
+ AC_DEFINE([HAVE_PTHREAD], [], [HAVE_PTHREAD])
|
||||
fi
|
||||
|
||||
dnl
|
||||
--
|
||||
2.28.0
|
||||
2.44.1
|
||||
|
|
@ -1,21 +1,31 @@
|
|||
From 276833851657c85651c053ee16b8e1a8dc768a50 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||
Date: Sun, 15 Nov 2020 19:12:56 +0900
|
||||
Subject: [PATCH 2/2] Use pkg-config for libxml2
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 18:58:14 +0300
|
||||
Subject: [PATCH 10/19] Update configure.ac for openssl, libxml2, liblzma and
|
||||
musl-fts
|
||||
|
||||
Simplifies libxml2 detection, adds detection for liblzma (from xz),
|
||||
openssl and fts (for musl libc).
|
||||
---
|
||||
configure.ac | 66 +++++++++-------------------------------------------
|
||||
1 file changed, 11 insertions(+), 55 deletions(-)
|
||||
xar/configure.ac | 83 +++++++++++++++++-------------------------------
|
||||
1 file changed, 30 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 358ab89..984a694 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -268,61 +268,17 @@ dnl Configure libxml2.
|
||||
dnl
|
||||
LIBXML2_VERSION_MIN=2.6.11
|
||||
diff --git a/xar/configure.ac b/xar/configure.ac
|
||||
index 0cc04dd..e466ee0 100644
|
||||
--- a/xar/configure.ac
|
||||
+++ b/xar/configure.ac
|
||||
@@ -272,63 +272,14 @@ AC_PREFIX_DEFAULT(/usr/local)
|
||||
|
||||
-have_libxml2="1"
|
||||
AC_CHECK_FUNC([asprintf], AC_DEFINE([HAVE_ASPRINTF], [], [HAVE_ASPRINTF]))
|
||||
|
||||
+AC_SEARCH_LIBS([fts_close], [fts])
|
||||
+
|
||||
dnl
|
||||
dnl Configure libxml2.
|
||||
dnl
|
||||
-LIBXML2_VERSION_MIN=2.6.11
|
||||
-
|
||||
have_libxml2="1"
|
||||
-
|
||||
-AC_ARG_WITH([xml2-config], [ --with-xml2-config libxml2 config program],
|
||||
-if test "x${with_xml2_config}" = "xno" ; then
|
||||
|
@ -67,23 +77,51 @@ index 358ab89..984a694 100644
|
|||
- dnl Final sanity check, to make sure that xmlwriter is present.
|
||||
- AC_CHECK_HEADER([libxml/xmlwriter.h], , [have_libxml2="0"])
|
||||
-fi
|
||||
-if test "x${have_libxml2}" = "x0" ; then
|
||||
- AC_MSG_ERROR([Cannot build without libxml2])
|
||||
-fi
|
||||
+PKG_PROG_PKG_CONFIG
|
||||
+
|
||||
+PKG_CHECK_MODULES(LIBXML2_PKGCONFIG, [libxml-2.0 >= ${LIBXML2_VERSION_MIN}],
|
||||
+ [
|
||||
+ have_libxml2=1
|
||||
+ CPPFLAGS="${CPPFLAGS} ${LIBXML2_PKGCONFIG_CFLAGS}"
|
||||
+ LIBS="${LIBS} ${LIBXML2_PKGCONFIG_LIBS}"
|
||||
+ ],
|
||||
+ [
|
||||
+ have_libxml2=0
|
||||
+ ])
|
||||
+AC_CHECK_HEADERS([libxml/xmlwriter.h], , [have_libxml2="0"])
|
||||
+AC_CHECK_LIB([xml2], [xmlInitParser], , [have_libxml2="0"])
|
||||
if test "x${have_libxml2}" = "x0" ; then
|
||||
AC_MSG_ERROR([Cannot build without libxml2])
|
||||
fi
|
||||
@@ -343,6 +294,22 @@ if test "x${have_libz}" = "x0" ; then
|
||||
AC_MSG_ERROR([Cannot build without libz])
|
||||
fi
|
||||
|
||||
+dnl
|
||||
+dnl Configure openssl.
|
||||
+dnl
|
||||
+have_openssl="1"
|
||||
+AC_CHECK_HEADERS([openssl/evp.h], , [have_openssl="0"])
|
||||
+AC_CHECK_LIB([crypto], [OPENSSL_config], , [have_openssl="0"])
|
||||
+if test "x${have_openssl}" = "x0" ; then
|
||||
+ case "${host}" in
|
||||
+ *-*-darwin*)
|
||||
+ ;;
|
||||
+ *)
|
||||
+ AC_MSG_ERROR([Cannot build without OpenSSL for non-Darwin host])
|
||||
+ ;;
|
||||
+ esac
|
||||
+fi
|
||||
+
|
||||
dnl
|
||||
dnl Configure libbz2.
|
||||
dnl
|
||||
@@ -353,6 +320,16 @@ if test "x${have_libbz2}" = "x1" ; then
|
||||
AC_DEFINE([HAVE_LIBBZ2], [], [HAVE_LIBBZ2])
|
||||
fi
|
||||
|
||||
+dnl
|
||||
+dnl Configure liblzma.
|
||||
+dnl
|
||||
+have_liblzma="1"
|
||||
+AC_CHECK_HEADERS([lzma.h], , [have_liblzma="0"])
|
||||
+AC_CHECK_LIB([lzma], [lzma_stream_decoder], , [have_liblzma="0"])
|
||||
+if test "x${have_liblzma}" = "x1" ; then
|
||||
+ AC_DEFINE([HAVE_LIBLZMA], [], [HAVE_LIBLZMA])
|
||||
+fi
|
||||
+
|
||||
dnl
|
||||
dnl Configure libpthread.
|
||||
dnl
|
||||
dnl Configure libcrypto (part of OpenSSL).
|
||||
--
|
||||
2.28.0
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 19:10:46 +0300
|
||||
Subject: [PATCH 11/19] Fix missing includes and silence string format warnings
|
||||
|
||||
Based on patch from Gentoo; see
|
||||
https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/xar/files/xar-1.8.0.0.498-impl-decls.patch?id=cc91eb0f86043ae92c10cce55b326244bed3f061
|
||||
---
|
||||
xar/lib/Makefile.inc.in | 1 +
|
||||
xar/lib/darwinattr.c | 1 +
|
||||
xar/lib/ea.c | 3 ++-
|
||||
xar/lib/ext2.c | 1 +
|
||||
xar/lib/util.c | 1 +
|
||||
xar/src/xar_internal.h | 4 ----
|
||||
6 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/xar/lib/Makefile.inc.in b/xar/lib/Makefile.inc.in
|
||||
index c046b25..d5e9003 100644
|
||||
--- a/xar/lib/Makefile.inc.in
|
||||
+++ b/xar/lib/Makefile.inc.in
|
||||
@@ -127,6 +127,7 @@ lib_distclean :
|
||||
|
||||
CPPFLAGS := -I@objroot@include $(CPPFLAGS)
|
||||
CPPFLAGS := -I@srcroot@include $(CPPFLAGS)
|
||||
+CPPFLAGS := -I@srcroot@lib $(CPPFLAGS)
|
||||
|
||||
#
|
||||
# Build rules.
|
||||
diff --git a/xar/lib/darwinattr.c b/xar/lib/darwinattr.c
|
||||
index 4938965..18302b0 100644
|
||||
--- a/xar/lib/darwinattr.c
|
||||
+++ b/xar/lib/darwinattr.c
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
diff --git a/xar/lib/ea.c b/xar/lib/ea.c
|
||||
index 1bb8e27..fa1d06a 100644
|
||||
--- a/xar/lib/ea.c
|
||||
+++ b/xar/lib/ea.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
+#include <inttypes.h> /* for PRId64 */
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <libgen.h>
|
||||
@@ -67,7 +68,7 @@ xar_ea_t xar_ea_new(xar_file_t f, const char *name)
|
||||
xar_prop_setvalue(XAR_EA(ret)->prop, NULL);
|
||||
XAR_PROP(XAR_EA(ret)->prop)->attrs = xar_attr_new();
|
||||
XAR_ATTR(XAR_PROP(XAR_EA(ret)->prop)->attrs)->key = strdup("id");
|
||||
- asprintf((char **)&XAR_ATTR(XAR_PROP(XAR_EA(ret)->prop)->attrs)->value, "%lld", XAR_FILE(f)->nexteaid++);
|
||||
+ asprintf((char **)&XAR_ATTR(XAR_PROP(XAR_EA(ret)->prop)->attrs)->value, "%"PRId64, XAR_FILE(f)->nexteaid++);
|
||||
|
||||
xar_prop_pset(f, XAR_EA(ret)->prop, "name", name);
|
||||
|
||||
diff --git a/xar/lib/ext2.c b/xar/lib/ext2.c
|
||||
index 2380846..b4ca1b0 100644
|
||||
--- a/xar/lib/ext2.c
|
||||
+++ b/xar/lib/ext2.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "asprintf.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "xar.h"
|
||||
#include "arcmod.h"
|
||||
diff --git a/xar/lib/util.c b/xar/lib/util.c
|
||||
index 1db2daa..ac0b822 100644
|
||||
--- a/xar/lib/util.c
|
||||
+++ b/xar/lib/util.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
diff --git a/xar/src/xar_internal.h b/xar/src/xar_internal.h
|
||||
index b78745c..2e6199e 100644
|
||||
--- a/xar/src/xar_internal.h
|
||||
+++ b/xar/src/xar_internal.h
|
||||
@@ -8,11 +8,7 @@
|
||||
#ifndef _XAR_INTERNAL_H_
|
||||
#define _XAR_INTERNAL_H_
|
||||
|
||||
-#ifdef XARSIG_BUILDING_WITH_XAR
|
||||
#include "xar.h"
|
||||
-#else
|
||||
-#include <xar/xar.h>
|
||||
-#endif // XARSIG_BUILDING_WITH_XAR
|
||||
|
||||
// Undeprecate these for internal usage
|
||||
xar_t xar_open(const char *file, int32_t flags) API_AVAILABLE(macos(10.4));
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 19:26:14 +0300
|
||||
Subject: [PATCH 12/19] Fix char signedness for ARM and PowerPC
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Use signed char explicitly for ARM and PowerPC (defaults to unsigned).
|
||||
Otherwise -1 integer literal is helpfully converted to char 255…
|
||||
|
||||
Derives from https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/xar/files/xar-1.8-arm-ppc.patch?id=cc91eb0f86043ae92c10cce55b326244bed3f061
|
||||
---
|
||||
xar/lib/b64.c | 2 +-
|
||||
xar/src/xar.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/xar/lib/b64.c b/xar/lib/b64.c
|
||||
index 6361acd..4ffc34c 100644
|
||||
--- a/xar/lib/b64.c
|
||||
+++ b/xar/lib/b64.c
|
||||
@@ -59,7 +59,7 @@ typedef enum _B64CommandCodes {
|
||||
B64_IgnorableCharacter = -1
|
||||
} B64CommandCodes;
|
||||
|
||||
-static char b64revtb[256] = {
|
||||
+static signed char b64revtb[256] = {
|
||||
-3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*0-15*/
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*16-31*/
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, /*32-47*/
|
||||
diff --git a/xar/src/xar.c b/xar/src/xar.c
|
||||
index 9977e8a..1bceb63 100644
|
||||
--- a/xar/src/xar.c
|
||||
+++ b/xar/src/xar.c
|
||||
@@ -910,7 +910,7 @@ static void print_version() {
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret;
|
||||
char *filename = NULL;
|
||||
- char command = 0, c;
|
||||
+ signed char command = 0, c;
|
||||
char **args;
|
||||
const char *tocfile = NULL;
|
||||
int arglen, i, err;
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 19:28:09 +0300
|
||||
Subject: [PATCH 13/19] Enable extended attributes for btrfs
|
||||
|
||||
---
|
||||
xar/lib/linuxattr.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/xar/lib/linuxattr.c b/xar/lib/linuxattr.c
|
||||
index 58ee6a8..496dd82 100644
|
||||
--- a/xar/lib/linuxattr.c
|
||||
+++ b/xar/lib/linuxattr.c
|
||||
@@ -80,6 +80,10 @@
|
||||
#define XFS_SUPER_MAGIC 0x58465342
|
||||
#endif
|
||||
|
||||
+#ifndef BTRFS_SUPER_MAGIC
|
||||
+#define BTRFS_SUPER_MAGIC 0x9123683E
|
||||
+#endif
|
||||
+
|
||||
#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LGETXATTR) && !defined(__APPLE__)
|
||||
|
||||
struct _linuxattr_context{
|
||||
@@ -175,6 +179,7 @@ TRYAGAIN:
|
||||
case JFS_SUPER_MAGIC: fsname = "jfs" ; break;
|
||||
case REISERFS_SUPER_MAGIC:fsname = "reiser" ; break;
|
||||
case XFS_SUPER_MAGIC: fsname = "xfs" ; break;
|
||||
+ case BTRFS_SUPER_MAGIC: fsname = "btrfs" ; break;
|
||||
default: retval=0; goto BAIL;
|
||||
};
|
||||
|
||||
@@ -236,6 +241,7 @@ int32_t xar_linuxattr_extract(xar_t x, xar_file_t f, const char* file, char *buf
|
||||
case JFS_SUPER_MAGIC: fsname = "jfs" ; break;
|
||||
case REISERFS_SUPER_MAGIC:fsname = "reiser" ; break;
|
||||
case XFS_SUPER_MAGIC: fsname = "xfs" ; break;
|
||||
+ case BTRFS_SUPER_MAGIC:fsname = "btrfs" ; break;
|
||||
};
|
||||
|
||||
for(p = xar_prop_pfirst(f); p; p = xar_prop_pnext(p)) {
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 20:46:31 +0300
|
||||
Subject: [PATCH 14/19] Fix segfault when copying xattr buffers
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
xar_linuxattr_read allocates an internal buffer and incrementally copies
|
||||
the data to xar_attrcopy_to_heap’s inbuf. This change fixes the offset
|
||||
handling by rewriting xar_linuxattr_read function from scratch (with an
|
||||
arguably cleaner implementation).
|
||||
---
|
||||
xar/lib/linuxattr.c | 68 +++++++++++++++++++++++++++------------------
|
||||
1 file changed, 41 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/xar/lib/linuxattr.c b/xar/lib/linuxattr.c
|
||||
index 496dd82..30c85c2 100644
|
||||
--- a/xar/lib/linuxattr.c
|
||||
+++ b/xar/lib/linuxattr.c
|
||||
@@ -97,39 +97,50 @@ struct _linuxattr_context{
|
||||
|
||||
#define LINUXATTR_CONTEXT(x) ((struct _linuxattr_context *)(x))
|
||||
|
||||
-int32_t xar_linuxattr_read(xar_t x, xar_file_t f, void * buf, size_t len, void *context) {
|
||||
-
|
||||
- if( !LINUXATTR_CONTEXT(context)->buf ) {
|
||||
- int r;
|
||||
- LINUXATTR_CONTEXT(context)->bufsz = 1024;
|
||||
+int32_t xar_linuxattr_read(xar_t x, xar_file_t f, void *inbuf, size_t len, void *context) {
|
||||
+ void *buf;
|
||||
+ int bufsz, off, ret;
|
||||
+ int r;
|
||||
+
|
||||
+ buf = LINUXATTR_CONTEXT(context)->buf;
|
||||
+ bufsz = LINUXATTR_CONTEXT(context)->bufsz;
|
||||
+ off = LINUXATTR_CONTEXT(context)->off;
|
||||
+
|
||||
+ if (buf == NULL) {
|
||||
+ bufsz = 1024;
|
||||
AGAIN2:
|
||||
- LINUXATTR_CONTEXT(context)->buf = malloc(LINUXATTR_CONTEXT(context)->bufsz);
|
||||
- if(!LINUXATTR_CONTEXT(context)->buf)
|
||||
- goto AGAIN2;
|
||||
- memset(LINUXATTR_CONTEXT(context)->buf, 0, LINUXATTR_CONTEXT(context)->bufsz);
|
||||
- r = lgetxattr(LINUXATTR_CONTEXT(context)->file, LINUXATTR_CONTEXT(context)->attrname, LINUXATTR_CONTEXT(context)->buf, LINUXATTR_CONTEXT(context)->bufsz);
|
||||
- if( r < 0 ) {
|
||||
- switch(errno) {
|
||||
- case ERANGE: LINUXATTR_CONTEXT(context)->bufsz *= 2; free(LINUXATTR_CONTEXT(context)->buf); goto AGAIN2;
|
||||
- case ENOTSUP: free(LINUXATTR_CONTEXT(context)->buf); return 0;
|
||||
- default: break;
|
||||
+ buf = malloc(bufsz);
|
||||
+ if (!buf) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+ memset(buf, 0, bufsz);
|
||||
+ r = lgetxattr(LINUXATTR_CONTEXT(context)->file, LINUXATTR_CONTEXT(context)->attrname, buf, bufsz);
|
||||
+ if (r < 0) {
|
||||
+ free(buf);
|
||||
+ switch (errno) {
|
||||
+ case ERANGE:
|
||||
+ bufsz *= 2;
|
||||
+ goto AGAIN2;
|
||||
+ case ENOTSUP:
|
||||
+ return 0;
|
||||
};
|
||||
return -1;
|
||||
}
|
||||
+ LINUXATTR_CONTEXT(context)->buf = buf;
|
||||
LINUXATTR_CONTEXT(context)->bufsz = r;
|
||||
+ bufsz = r;
|
||||
}
|
||||
|
||||
- if( (LINUXATTR_CONTEXT(context)->bufsz-LINUXATTR_CONTEXT(context)->off) <= len ) {
|
||||
- int32_t ret;
|
||||
- ret = LINUXATTR_CONTEXT(context)->bufsz - LINUXATTR_CONTEXT(context)->off;
|
||||
- memcpy(buf, ((char *)LINUXATTR_CONTEXT(context)->buf)+LINUXATTR_CONTEXT(context)->off, ret);
|
||||
- LINUXATTR_CONTEXT(context)->off += ret;
|
||||
- return(ret);
|
||||
- } else {
|
||||
- memcpy(buf, ((char *)LINUXATTR_CONTEXT(context)->buf)+LINUXATTR_CONTEXT(context)->off, len);
|
||||
- LINUXATTR_CONTEXT(context)->buf = ((char *)LINUXATTR_CONTEXT(context)->buf) + len;
|
||||
- return len;
|
||||
+ ret = bufsz - off;
|
||||
+ if (ret <= len) {
|
||||
+ memcpy(inbuf, ((char *)buf) + off, ret);
|
||||
+ LINUXATTR_CONTEXT(context)->off = bufsz;
|
||||
+ return ret;
|
||||
}
|
||||
+
|
||||
+ memcpy(inbuf, ((char *)buf) + off, len);
|
||||
+ LINUXATTR_CONTEXT(context)->off += len;
|
||||
+ return len;
|
||||
}
|
||||
|
||||
int32_t xar_linuxattr_write(xar_t x, xar_file_t f, void *buf, size_t len, void *context) {
|
||||
@@ -185,6 +196,7 @@ TRYAGAIN:
|
||||
|
||||
for( i=buf; (i-buf) < ret; i += strlen(i)+1 ) {
|
||||
xar_ea_t e;
|
||||
+ int rc;
|
||||
|
||||
context.bufsz = 0;
|
||||
context.off = 0;
|
||||
@@ -194,11 +206,13 @@ TRYAGAIN:
|
||||
xar_ea_pset(f, e, "fstype", fsname);
|
||||
context.attrname = i;
|
||||
context.ea = e;
|
||||
- if (XAR(x)->attrcopy_to_heap(x, f, xar_ea_root(e), xar_linuxattr_read,&context) < 0) {
|
||||
+ rc = XAR(x)->attrcopy_to_heap(x, f, xar_ea_root(e), xar_linuxattr_read, &context);
|
||||
+ if (context.buf != NULL)
|
||||
+ free(context.buf);
|
||||
+ if (rc < 0) {
|
||||
retval = -1;
|
||||
goto BAIL;
|
||||
}
|
||||
- free(context.buf);
|
||||
context.attrname = NULL;
|
||||
}
|
||||
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 27 Jul 2024 21:04:20 +0300
|
||||
Subject: [PATCH 15/19] Fix segfault in xar_attrcopy_from_heap
|
||||
|
||||
Fixes a nasty segfault crash when extracting files with extended
|
||||
attributes (and perhaps in other cases).
|
||||
|
||||
xar_attrcopy_from_heap (in lib/io.c) must not assume that context is
|
||||
convertible to DATA_CONTEXT. Without this change, it calls the callback
|
||||
from the provided context as if it was DATA_CONTEXT, but the context can
|
||||
actually be other types, e.g. LINUXATTR_CONTEXT.
|
||||
---
|
||||
xar/lib/data.c | 9 ++++++++-
|
||||
xar/lib/io.c | 3 ---
|
||||
2 files changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/xar/lib/data.c b/xar/lib/data.c
|
||||
index dcb5783..cfb3d58 100644
|
||||
--- a/xar/lib/data.c
|
||||
+++ b/xar/lib/data.c
|
||||
@@ -245,6 +245,13 @@ int32_t xar_data_extract(xar_t x, xar_file_t f, const char *file, char *buffer,
|
||||
return retval;
|
||||
}
|
||||
|
||||
+static int xar_data_verify_callback(xar_t x, xar_file_t f, void *inbuf, size_t bsize, void *context) {
|
||||
+ DATA_CONTEXT(context)->total += bsize;
|
||||
+ if (DATA_CONTEXT(context)->progress)
|
||||
+ DATA_CONTEXT(context)->progress(x, f, DATA_CONTEXT(context)->total);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int32_t xar_data_verify(xar_t x, xar_file_t f, xar_progress_callback p)
|
||||
{
|
||||
const char *opt;
|
||||
@@ -269,5 +276,5 @@ int32_t xar_data_verify(xar_t x, xar_file_t f, xar_progress_callback p)
|
||||
if (!tmpp) // It appears that xar can have truely empty files, aka, no data. We should just fail to verify these files.
|
||||
return 0; // After all, the checksum of blank is meaningless. So, failing to do so will cause a crash.
|
||||
|
||||
- return XAR(x)->attrcopy_from_heap(x, f, tmpp, NULL , (void *)(&context));
|
||||
+ return XAR(x)->attrcopy_from_heap(x, f, tmpp, xar_data_verify_callback, (void *)(&context));
|
||||
}
|
||||
diff --git a/xar/lib/io.c b/xar/lib/io.c
|
||||
index fb9a72e..64c69af 100644
|
||||
--- a/xar/lib/io.c
|
||||
+++ b/xar/lib/io.c
|
||||
@@ -529,9 +529,6 @@ int32_t xar_attrcopy_from_heap(xar_t x, xar_file_t f, xar_prop_t p, write_callba
|
||||
|
||||
readsofar += bsize;
|
||||
|
||||
- if (DATA_CONTEXT(context)->progress)
|
||||
- DATA_CONTEXT(context)->progress(x, f, readsofar);
|
||||
-
|
||||
bsize = def_bsize;
|
||||
}
|
||||
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sun, 28 Jul 2024 12:00:01 +0300
|
||||
Subject: [PATCH 16/19] Do not set property for empty ACL
|
||||
|
||||
On Linux, acl_get_file helpfully converts file mode bits to ACL if no
|
||||
extended attribute is set. See
|
||||
https://git.savannah.nongnu.org/cgit/acl.git/tree/libacl/acl_get_file.c?id=d9bb1759d4dad2f28a6dcc8c1742ff75d16dd10d#n83
|
||||
|
||||
At the same time, Nix sandbox does not filter getxattr syscalls to
|
||||
return ENOTSUP, but does filter setxattr. So we are in a intricate
|
||||
situation where acl library thinks that EAs/ACLs are supported and
|
||||
returns meaningful values for reads, so xar archives files with acl
|
||||
property, but extraction fails because of the syscall filter.
|
||||
|
||||
As a workaround, we add acl_extended_file check that actually returns
|
||||
whether the file is associated with ACLs (internally represented as
|
||||
extended attributes).
|
||||
---
|
||||
xar/configure.ac | 5 ++---
|
||||
xar/include/config.h.in | 2 ++
|
||||
xar/lib/stat.c | 9 +++++++++
|
||||
3 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/xar/configure.ac b/xar/configure.ac
|
||||
index e466ee0..c3d9ff7 100644
|
||||
--- a/xar/configure.ac
|
||||
+++ b/xar/configure.ac
|
||||
@@ -180,9 +180,8 @@ fi
|
||||
)
|
||||
AC_SUBST([enable_autogen])
|
||||
|
||||
-AC_TRY_COMPILE([#include <sys/types.h>
|
||||
-#include <sys/acl.h>], [acl_t a], [AC_DEFINE([HAVE_SYS_ACL_H],[1], [define if you have sys/acl.h and it has a working acl_t type])])
|
||||
-AC_CHECK_HEADERS(ext2fs/ext2_fs.h sys/statfs.h sys/vfs.h sys/xattr.h sys/param.h sys/extattr.h libutil.h)
|
||||
+AC_CHECK_HEADERS(sys/acl.h acl/libacl.h ext2fs/ext2_fs.h sys/statfs.h sys/vfs.h sys/xattr.h sys/param.h sys/extattr.h libutil.h)
|
||||
+AC_CHECK_DECLS([acl_extended_file], [], [], [[#include <acl/libacl.h>]])
|
||||
AC_CHECK_FUNCS(lgetxattr)
|
||||
AC_CHECK_FUNCS(lsetxattr)
|
||||
AC_CHECK_FUNCS(getxattr)
|
||||
diff --git a/xar/include/config.h.in b/xar/include/config.h.in
|
||||
index 16c72d3..779f5aa 100644
|
||||
--- a/xar/include/config.h.in
|
||||
+++ b/xar/include/config.h.in
|
||||
@@ -3,6 +3,7 @@
|
||||
#undef HAVE_SYS_XATTR_H
|
||||
#undef HAVE_SYS_EXTATTR_H
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
+#undef HAVE_DECL_ACL_EXTENDED_FILE
|
||||
#undef HAVE_LGETXATTR
|
||||
#undef HAVE_LSETXATTR
|
||||
#undef HAVE_GETXATTR
|
||||
@@ -12,6 +13,7 @@
|
||||
#undef HAVE_CHFLAGS
|
||||
#undef HAVE_STATVFS
|
||||
#undef HAVE_STATFS
|
||||
+#undef HAVE_ACL_LIBACL_H
|
||||
#undef HAVE_EXT2FS_EXT2_FS_H
|
||||
#undef HAVE_STRUCT_STAT_ST_FLAGS
|
||||
#undef HAVE_STRUCT_STATVFS_F_FSTYPENAME
|
||||
diff --git a/xar/lib/stat.c b/xar/lib/stat.c
|
||||
index b0cce7c..81771dc 100644
|
||||
--- a/xar/lib/stat.c
|
||||
+++ b/xar/lib/stat.c
|
||||
@@ -66,6 +66,9 @@
|
||||
#ifdef HAVE_SYS_ACL_H
|
||||
#include <sys/acl.h>
|
||||
#endif
|
||||
+#ifdef HAVE_ACL_LIBACL_H
|
||||
+#include <acl/libacl.h>
|
||||
+#endif
|
||||
#include "xar.h"
|
||||
#include "arcmod.h"
|
||||
#include "archive.h"
|
||||
@@ -131,6 +134,12 @@ static int32_t aacls(xar_t x, xar_file_t f, const char *file) {
|
||||
if( !xar_check_prop(x, "acl") )
|
||||
return 0;
|
||||
|
||||
+#ifdef HAVE_DECL_ACL_EXTENDED_FILE
|
||||
+ /* Do nothing if the file is not associated with ACL. */
|
||||
+ if( !acl_extended_file(file) )
|
||||
+ return 0;
|
||||
+#endif
|
||||
+
|
||||
a = acl_get_file(file, ACL_TYPE_DEFAULT);
|
||||
if( a ) {
|
||||
char *t;
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Tue, 30 Jul 2024 16:06:57 +0300
|
||||
Subject: [PATCH 17/19] Fix time format for musl
|
||||
|
||||
Directive %F is not supported in musl (until recent versions).
|
||||
https://git.musl-libc.org/cgit/musl/commit/src/time/strptime.c?id=fced99e93daeefb0192fd16304f978d4401d1d77
|
||||
|
||||
Avoid using it for str[fp]time.
|
||||
---
|
||||
xar/lib/stat.c | 15 +++++++--------
|
||||
1 file changed, 7 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/xar/lib/stat.c b/xar/lib/stat.c
|
||||
index 81771dc..d71a613 100644
|
||||
--- a/xar/lib/stat.c
|
||||
+++ b/xar/lib/stat.c
|
||||
@@ -82,6 +82,8 @@
|
||||
#define LLONG_MAX LONG_LONG_MAX
|
||||
#endif
|
||||
|
||||
+static const char time_format[] = "%Y-%m-%dT%H:%M:%SZ";
|
||||
+
|
||||
static struct {
|
||||
const char *name;
|
||||
mode_t type;
|
||||
@@ -513,24 +515,21 @@ int32_t xar_stat_archive(xar_t x, xar_file_t f, const char *file, const char *bu
|
||||
if( xar_check_prop(x, "atime") ) {
|
||||
gmtime_r(&XAR(x)->sbcache.st_atime, &t);
|
||||
memset(time, 0, sizeof(time));
|
||||
- strftime(time, sizeof(time), "%FT%T", &t);
|
||||
- strcat(time, "Z");
|
||||
+ strftime(time, sizeof(time), time_format, &t);
|
||||
xar_prop_set(f, "atime", time);
|
||||
}
|
||||
|
||||
if( xar_check_prop(x, "mtime") ) {
|
||||
gmtime_r(&XAR(x)->sbcache.st_mtime, &t);
|
||||
memset(time, 0, sizeof(time));
|
||||
- strftime(time, sizeof(time), "%FT%T", &t);
|
||||
- strcat(time, "Z");
|
||||
+ strftime(time, sizeof(time), time_format, &t);
|
||||
xar_prop_set(f, "mtime", time);
|
||||
}
|
||||
|
||||
if( xar_check_prop(x, "ctime") ) {
|
||||
gmtime_r(&XAR(x)->sbcache.st_ctime, &t);
|
||||
memset(time, 0, sizeof(time));
|
||||
- strftime(time, sizeof(time), "%FT%T", &t);
|
||||
- strcat(time, "Z");
|
||||
+ strftime(time, sizeof(time), time_format, &t);
|
||||
xar_prop_set(f, "ctime", time);
|
||||
}
|
||||
|
||||
@@ -680,7 +679,7 @@ int32_t xar_set_perm(xar_t x, xar_file_t f, const char *file, char *buffer, size
|
||||
xar_prop_get(f, "atime", ×tr);
|
||||
if( timestr ) {
|
||||
memset(&t, 0, sizeof(t));
|
||||
- strptime(timestr, "%FT%T", &t);
|
||||
+ strptime(timestr, time_format, &t);
|
||||
tv[ATIME].tv_sec = timegm(&t);
|
||||
} else {
|
||||
tv[ATIME].tv_sec = time(NULL);
|
||||
@@ -689,7 +688,7 @@ int32_t xar_set_perm(xar_t x, xar_file_t f, const char *file, char *buffer, size
|
||||
xar_prop_get(f, "mtime", ×tr);
|
||||
if( timestr ) {
|
||||
memset(&t, 0, sizeof(t));
|
||||
- strptime(timestr, "%FT%T", &t);
|
||||
+ strptime(timestr, time_format, &t);
|
||||
tv[MTIME].tv_sec = timegm(&t);
|
||||
} else {
|
||||
tv[MTIME].tv_sec = time(NULL);
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Tue, 30 Jul 2024 17:29:06 +0300
|
||||
Subject: [PATCH 18/19] Replace memcpy with memmove for musl
|
||||
|
||||
---
|
||||
xar/lib/io.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xar/lib/io.c b/xar/lib/io.c
|
||||
index 64c69af..c962c4b 100644
|
||||
--- a/xar/lib/io.c
|
||||
+++ b/xar/lib/io.c
|
||||
@@ -650,7 +650,7 @@ static int32_t flush_stream(xar_stream *stream) {
|
||||
state->pending_buf = NULL;
|
||||
} else if( state->pending_buf_size > len ) {
|
||||
state->pending_buf_size -= len;
|
||||
- memcpy(state->pending_buf, state->pending_buf + len, state->pending_buf_size);
|
||||
+ memmove(state->pending_buf, state->pending_buf + len, state->pending_buf_size);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Trubach <mr.trubach@icloud.com>
|
||||
Date: Sat, 24 Aug 2024 10:44:09 +0300
|
||||
Subject: [PATCH 19/19] Prefer OpenSSL over CommonCrypto if available
|
||||
|
||||
In Nixpkgs, we always have OpenSSL input available, so it makes sense to
|
||||
prefer it over the CommonCrypto library.
|
||||
See https://github.com/NixOS/nixpkgs/pull/329721#discussion_r1713492113
|
||||
---
|
||||
xar/configure.ac | 5 ++++-
|
||||
xar/include/config.h.in | 1 +
|
||||
xar/lib/archive.h | 6 ------
|
||||
xar/lib/hash.c | 20 +++++++++++---------
|
||||
4 files changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/xar/configure.ac b/xar/configure.ac
|
||||
index c3d9ff7..f7626bf 100644
|
||||
--- a/xar/configure.ac
|
||||
+++ b/xar/configure.ac
|
||||
@@ -299,9 +299,12 @@ dnl
|
||||
have_openssl="1"
|
||||
AC_CHECK_HEADERS([openssl/evp.h], , [have_openssl="0"])
|
||||
AC_CHECK_LIB([crypto], [OPENSSL_config], , [have_openssl="0"])
|
||||
-if test "x${have_openssl}" = "x0" ; then
|
||||
+if test "x${have_openssl}" = "x1" ; then
|
||||
+ AC_DEFINE([HAVE_OPENSSL], [], [HAVE_OPENSSL])
|
||||
+else
|
||||
case "${host}" in
|
||||
*-*-darwin*)
|
||||
+ # Darwin uses CommonCrypto if OpenSSL is not available.
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Cannot build without OpenSSL for non-Darwin host])
|
||||
diff --git a/xar/include/config.h.in b/xar/include/config.h.in
|
||||
index 779f5aa..dd44002 100644
|
||||
--- a/xar/include/config.h.in
|
||||
+++ b/xar/include/config.h.in
|
||||
@@ -24,6 +24,7 @@
|
||||
#undef HAVE_LIBUTIL_H
|
||||
#undef HAVE_LIBPTHREAD
|
||||
#undef HAVE_ASPRINTF
|
||||
+#undef HAVE_OPENSSL
|
||||
#undef HAVE_LIBBZ2
|
||||
#undef HAVE_LIBLZMA
|
||||
#undef HAVE_LCHOWN
|
||||
diff --git a/xar/lib/archive.h b/xar/lib/archive.h
|
||||
index f926245..8743120 100644
|
||||
--- a/xar/lib/archive.h
|
||||
+++ b/xar/lib/archive.h
|
||||
@@ -40,12 +40,6 @@
|
||||
#define _XAR_ARCHIVE_H_
|
||||
#include <zlib.h>
|
||||
#include <libxml/hash.h>
|
||||
-#ifdef __APPLE__
|
||||
-#include <CommonCrypto/CommonDigest.h>
|
||||
-#include <CommonCrypto/CommonDigestSPI.h>
|
||||
-#else
|
||||
-#include <openssl/evp.h>
|
||||
-#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "xar.h"
|
||||
diff --git a/xar/lib/hash.c b/xar/lib/hash.c
|
||||
index cb4f6cf..b99eca9 100644
|
||||
--- a/xar/lib/hash.c
|
||||
+++ b/xar/lib/hash.c
|
||||
@@ -41,7 +41,10 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <zlib.h>
|
||||
-#ifdef __APPLE__
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#include <CommonCrypto/CommonDigestSPI.h>
|
||||
#else
|
||||
@@ -50,7 +53,6 @@
|
||||
|
||||
#include "xar.h"
|
||||
#include "hash.h"
|
||||
-#include "config.h"
|
||||
#ifndef HAVE_ASPRINTF
|
||||
#include "asprintf.h"
|
||||
#endif
|
||||
@@ -58,7 +60,7 @@
|
||||
|
||||
#pragma mark Hash Wrapper Object
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
|
||||
CCDigestRef digestRef_from_name(const char* name, unsigned int *outHashSize) {
|
||||
CCDigestRef result = NULL;
|
||||
@@ -88,13 +90,13 @@ CCDigestRef digestRef_from_name(const char* name, unsigned int *outHashSize) {
|
||||
|
||||
return result;
|
||||
}
|
||||
-#endif // __APPLE__
|
||||
+#endif // !defined(HAVE_OPENSSL)
|
||||
|
||||
|
||||
struct __xar_hash_t {
|
||||
const char *digest_name;
|
||||
void *context;
|
||||
-#ifdef __APPLE__
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
CCDigestRef digest;
|
||||
#else
|
||||
EVP_MD_CTX *digest;
|
||||
@@ -113,7 +115,7 @@ xar_hash_t xar_hash_new(const char *digest_name, void *context) {
|
||||
if( context )
|
||||
HASH_CTX(hash)->context = context;
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
HASH_CTX(hash)->digest = digestRef_from_name(digest_name, &HASH_CTX(hash)->length);
|
||||
#else
|
||||
OpenSSL_add_all_digests();
|
||||
@@ -136,7 +138,7 @@ const char *xar_hash_get_digest_name(xar_hash_t hash) {
|
||||
}
|
||||
|
||||
void xar_hash_update(xar_hash_t hash, void *buffer, size_t nbyte) {
|
||||
-#ifdef __APPLE__
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
CCDigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
|
||||
#else
|
||||
EVP_DigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
|
||||
@@ -144,7 +146,7 @@ void xar_hash_update(xar_hash_t hash, void *buffer, size_t nbyte) {
|
||||
}
|
||||
|
||||
void *xar_hash_finish(xar_hash_t hash, size_t *nbyte) {
|
||||
-#ifdef __APPLE__
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
void *buffer = calloc(1, CC_SHA512_DIGEST_LENGTH); // current biggest digest size This is what OpenSSL uses
|
||||
#else
|
||||
void *buffer = calloc(1, EVP_MAX_MD_SIZE);
|
||||
@@ -152,7 +154,7 @@ void *xar_hash_finish(xar_hash_t hash, size_t *nbyte) {
|
||||
if( ! buffer )
|
||||
return NULL;
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
CCDigestFinal(HASH_CTX(hash)->digest, buffer);
|
||||
CCDigestDestroy(HASH_CTX(hash)->digest);
|
||||
#else
|
||||
--
|
||||
2.44.1
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
export NIX_SSL_CERT_FILE=@out@/etc/ssl/certs/ca-bundle.crt
|
||||
export NIX_SSL_CERT_FILE="${NIX_SSL_CERT_FILE:-@out@/etc/ssl/certs/ca-bundle.crt}"
|
||||
|
||||
# compatibility
|
||||
# - openssl
|
||||
export SSL_CERT_FILE=@out@/etc/ssl/certs/ca-bundle.crt
|
||||
export SSL_CERT_FILE=$NIX_SSL_CERT_FILE
|
||||
# - Haskell x509-system
|
||||
export SYSTEM_CERTIFICATE_PATH=@out@/etc/ssl/certs/ca-bundle.crt
|
||||
export SYSTEM_CERTIFICATE_PATH=$NIX_SSL_CERT_FILE
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "publicsuffix-list";
|
||||
version = "0-unstable-2024-06-19";
|
||||
version = "0-unstable-2024-08-21";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "publicsuffix";
|
||||
repo = "list";
|
||||
rev = "92c74a6cde6092a5e80531c0662e1055abeb975e";
|
||||
hash = "sha256-fkfjR2A2nf3/F16Pn0hCwXtAd26TbUVA5gIv+J4DOjc=";
|
||||
rev = "30c3fc2db5ec0ecbc2efbb798b12459e9a22fffd";
|
||||
hash = "sha256-RmSlBl6lHFFvEEG2rsnwMpF9X8tv0VhPwhnke4UxUmA=";
|
||||
};
|
||||
|
||||
dontBuild = true;
|
||||
|
|
|
@ -47,11 +47,11 @@ let
|
|||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "go";
|
||||
version = "1.22.6";
|
||||
version = "1.22.7";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://go.dev/dl/go${finalAttrs.version}.src.tar.gz";
|
||||
hash = "sha256-nkjZnVGYgleZF9gYnBfpjDc84lq667mHcuKScIiZKlE=";
|
||||
hash = "sha256-ZkMth9heDPrD7f/mN9WTD8Td9XkzE/4R5KDzMwI8h58=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
|
|
|
@ -20,7 +20,6 @@ stdenv.mkDerivation rec {
|
|||
configureFlags = [ "--with-openssl=${openssl.dev}" ];
|
||||
|
||||
preConfigure = ''
|
||||
export PGHEADER="${postgresql}/include/libpq-fe.h";
|
||||
export MSHEADER="${libmysqlclient}/include/mysql/mysql.h";
|
||||
export SQHEADER="${sqlite.dev}/include/sqlite3.h";
|
||||
export ICU_INCLUDES="-I${icu.dev}/include";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# shellcheck shell=bash disable=SC2154,SC2086
|
||||
# shellcheck shell=bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
readonly zigDefaultFlagsArray=(@zig_default_flags@)
|
||||
|
||||
function zigSetGlobalCacheDir {
|
||||
|
@ -10,10 +11,9 @@ function zigSetGlobalCacheDir {
|
|||
function zigBuildPhase {
|
||||
runHook preBuild
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray
|
||||
|
||||
echoCmd 'zig build flags' "${flagsArray[@]}"
|
||||
zig build "${flagsArray[@]}"
|
||||
|
@ -24,10 +24,9 @@ function zigBuildPhase {
|
|||
function zigCheckPhase {
|
||||
runHook preCheck
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigCheckFlags "${zigCheckFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigCheckFlags zigCheckFlagsArray
|
||||
|
||||
echoCmd 'zig check flags' "${flagsArray[@]}"
|
||||
zig build test "${flagsArray[@]}"
|
||||
|
@ -38,11 +37,10 @@ function zigCheckPhase {
|
|||
function zigInstallPhase {
|
||||
runHook preInstall
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
$zigInstallFlags "${zigInstallFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray \
|
||||
zigInstallFlags zigInstallFlagsArray
|
||||
|
||||
if [ -z "${dontAddPrefix-}" ]; then
|
||||
# Zig does not recognize `--prefix=/dir/`, only `--prefix /dir/`
|
||||
|
@ -55,6 +53,7 @@ function zigInstallPhase {
|
|||
runHook postInstall
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
addEnvHooks "$targetOffset" zigSetGlobalCacheDir
|
||||
|
||||
if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# shellcheck shell=bash disable=SC2154,SC2086
|
||||
# shellcheck shell=bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
readonly zigDefaultFlagsArray=(@zig_default_flags@)
|
||||
|
||||
function zigSetGlobalCacheDir {
|
||||
|
@ -10,10 +11,9 @@ function zigSetGlobalCacheDir {
|
|||
function zigBuildPhase {
|
||||
runHook preBuild
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray
|
||||
|
||||
echoCmd 'zig build flags' "${flagsArray[@]}"
|
||||
zig build "${flagsArray[@]}"
|
||||
|
@ -24,10 +24,9 @@ function zigBuildPhase {
|
|||
function zigCheckPhase {
|
||||
runHook preCheck
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigCheckFlags "${zigCheckFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigCheckFlags zigCheckFlagsArray
|
||||
|
||||
echoCmd 'zig check flags' "${flagsArray[@]}"
|
||||
zig build test "${flagsArray[@]}"
|
||||
|
@ -38,11 +37,10 @@ function zigCheckPhase {
|
|||
function zigInstallPhase {
|
||||
runHook preInstall
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
$zigInstallFlags "${zigInstallFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray \
|
||||
zigInstallFlags zigInstallFlagsArray
|
||||
|
||||
if [ -z "${dontAddPrefix-}" ]; then
|
||||
# Zig does not recognize `--prefix=/dir/`, only `--prefix /dir/`
|
||||
|
@ -55,6 +53,7 @@ function zigInstallPhase {
|
|||
runHook postInstall
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
addEnvHooks "$targetOffset" zigSetGlobalCacheDir
|
||||
|
||||
if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# shellcheck shell=bash disable=SC2154,SC2086
|
||||
# shellcheck shell=bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
readonly zigDefaultFlagsArray=(@zig_default_flags@)
|
||||
|
||||
function zigSetGlobalCacheDir {
|
||||
|
@ -10,10 +11,9 @@ function zigSetGlobalCacheDir {
|
|||
function zigBuildPhase {
|
||||
runHook preBuild
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray
|
||||
|
||||
echoCmd 'zig build flags' "${flagsArray[@]}"
|
||||
zig build "${flagsArray[@]}"
|
||||
|
@ -24,10 +24,9 @@ function zigBuildPhase {
|
|||
function zigCheckPhase {
|
||||
runHook preCheck
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigCheckFlags "${zigCheckFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigCheckFlags zigCheckFlagsArray
|
||||
|
||||
echoCmd 'zig check flags' "${flagsArray[@]}"
|
||||
zig build test "${flagsArray[@]}"
|
||||
|
@ -38,11 +37,10 @@ function zigCheckPhase {
|
|||
function zigInstallPhase {
|
||||
runHook preInstall
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
$zigInstallFlags "${zigInstallFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray \
|
||||
zigInstallFlags zigInstallFlagsArray
|
||||
|
||||
if [ -z "${dontAddPrefix-}" ]; then
|
||||
# Zig does not recognize `--prefix=/dir/`, only `--prefix /dir/`
|
||||
|
@ -55,6 +53,7 @@ function zigInstallPhase {
|
|||
runHook postInstall
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
addEnvHooks "$targetOffset" zigSetGlobalCacheDir
|
||||
|
||||
if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# shellcheck shell=bash disable=SC2154,SC2086
|
||||
# shellcheck shell=bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
readonly zigDefaultFlagsArray=(@zig_default_flags@)
|
||||
|
||||
function zigSetGlobalCacheDir {
|
||||
|
@ -10,10 +11,9 @@ function zigSetGlobalCacheDir {
|
|||
function zigBuildPhase {
|
||||
runHook preBuild
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray
|
||||
|
||||
echoCmd 'zig build flags' "${flagsArray[@]}"
|
||||
zig build "${flagsArray[@]}"
|
||||
|
@ -24,10 +24,9 @@ function zigBuildPhase {
|
|||
function zigCheckPhase {
|
||||
runHook preCheck
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigCheckFlags "${zigCheckFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigCheckFlags zigCheckFlagsArray
|
||||
|
||||
echoCmd 'zig check flags' "${flagsArray[@]}"
|
||||
zig build test "${flagsArray[@]}"
|
||||
|
@ -38,11 +37,10 @@ function zigCheckPhase {
|
|||
function zigInstallPhase {
|
||||
runHook preInstall
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
$zigInstallFlags "${zigInstallFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray \
|
||||
zigInstallFlags zigInstallFlagsArray
|
||||
|
||||
if [ -z "${dontAddPrefix-}" ]; then
|
||||
# Zig does not recognize `--prefix=/dir/`, only `--prefix /dir/`
|
||||
|
@ -55,6 +53,7 @@ function zigInstallPhase {
|
|||
runHook postInstall
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
addEnvHooks "$targetOffset" zigSetGlobalCacheDir
|
||||
|
||||
if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# shellcheck shell=bash disable=SC2154,SC2086
|
||||
# shellcheck shell=bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
readonly zigDefaultFlagsArray=(@zig_default_flags@)
|
||||
|
||||
function zigSetGlobalCacheDir {
|
||||
|
@ -10,10 +11,9 @@ function zigSetGlobalCacheDir {
|
|||
function zigBuildPhase {
|
||||
runHook preBuild
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray
|
||||
|
||||
echoCmd 'zig build flags' "${flagsArray[@]}"
|
||||
zig build "${flagsArray[@]}"
|
||||
|
@ -24,10 +24,9 @@ function zigBuildPhase {
|
|||
function zigCheckPhase {
|
||||
runHook preCheck
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigCheckFlags "${zigCheckFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigCheckFlags zigCheckFlagsArray
|
||||
|
||||
echoCmd 'zig check flags' "${flagsArray[@]}"
|
||||
zig build test "${flagsArray[@]}"
|
||||
|
@ -38,11 +37,10 @@ function zigCheckPhase {
|
|||
function zigInstallPhase {
|
||||
runHook preInstall
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
$zigInstallFlags "${zigInstallFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray \
|
||||
zigInstallFlags zigInstallFlagsArray
|
||||
|
||||
if [ -z "${dontAddPrefix-}" ]; then
|
||||
# Zig does not recognize `--prefix=/dir/`, only `--prefix /dir/`
|
||||
|
@ -55,6 +53,7 @@ function zigInstallPhase {
|
|||
runHook postInstall
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
addEnvHooks "$targetOffset" zigSetGlobalCacheDir
|
||||
|
||||
if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# shellcheck shell=bash disable=SC2154,SC2086
|
||||
# shellcheck shell=bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
readonly zigDefaultFlagsArray=(@zig_default_flags@)
|
||||
|
||||
function zigSetGlobalCacheDir {
|
||||
|
@ -10,10 +11,9 @@ function zigSetGlobalCacheDir {
|
|||
function zigBuildPhase {
|
||||
runHook preBuild
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray
|
||||
|
||||
echoCmd 'zig build flags' "${flagsArray[@]}"
|
||||
zig build "${flagsArray[@]}"
|
||||
|
@ -24,10 +24,9 @@ function zigBuildPhase {
|
|||
function zigCheckPhase {
|
||||
runHook preCheck
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigCheckFlags "${zigCheckFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigCheckFlags zigCheckFlagsArray
|
||||
|
||||
echoCmd 'zig check flags' "${flagsArray[@]}"
|
||||
zig build test "${flagsArray[@]}"
|
||||
|
@ -38,11 +37,10 @@ function zigCheckPhase {
|
|||
function zigInstallPhase {
|
||||
runHook preInstall
|
||||
|
||||
local flagsArray=(
|
||||
"${zigDefaultFlagsArray[@]}"
|
||||
$zigBuildFlags "${zigBuildFlagsArray[@]}"
|
||||
$zigInstallFlags "${zigInstallFlagsArray[@]}"
|
||||
)
|
||||
local flagsArray=()
|
||||
concatTo flagsArray zigDefaultFlagsArray \
|
||||
zigBuildFlags zigBuildFlagsArray \
|
||||
zigInstallFlags zigInstallFlagsArray
|
||||
|
||||
if [ -z "${dontAddPrefix-}" ]; then
|
||||
# Zig does not recognize `--prefix=/dir/`, only `--prefix /dir/`
|
||||
|
@ -55,6 +53,7 @@ function zigInstallPhase {
|
|||
runHook postInstall
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
addEnvHooks "$targetOffset" zigSetGlobalCacheDir
|
||||
|
||||
if [ -z "${dontUseZigBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||
|
|
|
@ -11,61 +11,6 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
|
|||
index 0c2510e..7fb98af 100644
|
||||
--- a/Lib/ctypes/util.py
|
||||
+++ b/Lib/ctypes/util.py
|
||||
@@ -100,53 +100,7 @@ elif os.name == "posix":
|
||||
return thefile.read(4) == elf_header
|
||||
|
||||
def _findLib_gcc(name):
|
||||
- # Run GCC's linker with the -t (aka --trace) option and examine the
|
||||
- # library name it prints out. The GCC command will fail because we
|
||||
- # haven't supplied a proper program with main(), but that does not
|
||||
- # matter.
|
||||
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
|
||||
-
|
||||
- c_compiler = shutil.which('gcc')
|
||||
- if not c_compiler:
|
||||
- c_compiler = shutil.which('cc')
|
||||
- if not c_compiler:
|
||||
- # No C compiler available, give up
|
||||
- return None
|
||||
-
|
||||
- temp = tempfile.NamedTemporaryFile()
|
||||
- try:
|
||||
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
|
||||
-
|
||||
- env = dict(os.environ)
|
||||
- env['LC_ALL'] = 'C'
|
||||
- env['LANG'] = 'C'
|
||||
- try:
|
||||
- proc = subprocess.Popen(args,
|
||||
- stdout=subprocess.PIPE,
|
||||
- stderr=subprocess.STDOUT,
|
||||
- env=env)
|
||||
- except OSError: # E.g. bad executable
|
||||
- return None
|
||||
- with proc:
|
||||
- trace = proc.stdout.read()
|
||||
- finally:
|
||||
- try:
|
||||
- temp.close()
|
||||
- except FileNotFoundError:
|
||||
- # Raised if the file was already removed, which is the normal
|
||||
- # behaviour of GCC if linking fails
|
||||
- pass
|
||||
- res = re.findall(expr, trace)
|
||||
- if not res:
|
||||
- return None
|
||||
-
|
||||
- for file in res:
|
||||
- # Check if the given file is an elf file: gcc can report
|
||||
- # some files that are linker scripts and not actual
|
||||
- # shared objects. See bpo-41976 for more details
|
||||
- if not _is_elf(file):
|
||||
- continue
|
||||
- return os.fsdecode(file)
|
||||
+ return None
|
||||
|
||||
|
||||
if sys.platform == "sunos5":
|
||||
@@ -268,34 +222,7 @@ elif os.name == "posix":
|
||||
else:
|
||||
|
||||
|
|
|
@ -11,61 +11,6 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
|
|||
index 0c2510e161..7fb98af308 100644
|
||||
--- a/Lib/ctypes/util.py
|
||||
+++ b/Lib/ctypes/util.py
|
||||
@@ -100,53 +100,7 @@ def _is_elf(filename):
|
||||
return thefile.read(4) == elf_header
|
||||
|
||||
def _findLib_gcc(name):
|
||||
- # Run GCC's linker with the -t (aka --trace) option and examine the
|
||||
- # library name it prints out. The GCC command will fail because we
|
||||
- # haven't supplied a proper program with main(), but that does not
|
||||
- # matter.
|
||||
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
|
||||
-
|
||||
- c_compiler = shutil.which('gcc')
|
||||
- if not c_compiler:
|
||||
- c_compiler = shutil.which('cc')
|
||||
- if not c_compiler:
|
||||
- # No C compiler available, give up
|
||||
- return None
|
||||
-
|
||||
- temp = tempfile.NamedTemporaryFile()
|
||||
- try:
|
||||
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
|
||||
-
|
||||
- env = dict(os.environ)
|
||||
- env['LC_ALL'] = 'C'
|
||||
- env['LANG'] = 'C'
|
||||
- try:
|
||||
- proc = subprocess.Popen(args,
|
||||
- stdout=subprocess.PIPE,
|
||||
- stderr=subprocess.STDOUT,
|
||||
- env=env)
|
||||
- except OSError: # E.g. bad executable
|
||||
- return None
|
||||
- with proc:
|
||||
- trace = proc.stdout.read()
|
||||
- finally:
|
||||
- try:
|
||||
- temp.close()
|
||||
- except FileNotFoundError:
|
||||
- # Raised if the file was already removed, which is the normal
|
||||
- # behaviour of GCC if linking fails
|
||||
- pass
|
||||
- res = re.findall(expr, trace)
|
||||
- if not res:
|
||||
- return None
|
||||
-
|
||||
- for file in res:
|
||||
- # Check if the given file is an elf file: gcc can report
|
||||
- # some files that are linker scripts and not actual
|
||||
- # shared objects. See bpo-41976 for more details
|
||||
- if not _is_elf(file):
|
||||
- continue
|
||||
- return os.fsdecode(file)
|
||||
+ return None
|
||||
|
||||
|
||||
if sys.platform == "sunos5":
|
||||
@@ -268,34 +222,7 @@ def find_library(name, is64 = False):
|
||||
else:
|
||||
|
||||
|
|
|
@ -11,61 +11,6 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
|
|||
index 0c2510e161..7fb98af308 100644
|
||||
--- a/Lib/ctypes/util.py
|
||||
+++ b/Lib/ctypes/util.py
|
||||
@@ -100,53 +100,7 @@ def _is_elf(filename):
|
||||
return thefile.read(4) == elf_header
|
||||
|
||||
def _findLib_gcc(name):
|
||||
- # Run GCC's linker with the -t (aka --trace) option and examine the
|
||||
- # library name it prints out. The GCC command will fail because we
|
||||
- # haven't supplied a proper program with main(), but that does not
|
||||
- # matter.
|
||||
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
|
||||
-
|
||||
- c_compiler = shutil.which('gcc')
|
||||
- if not c_compiler:
|
||||
- c_compiler = shutil.which('cc')
|
||||
- if not c_compiler:
|
||||
- # No C compiler available, give up
|
||||
- return None
|
||||
-
|
||||
- temp = tempfile.NamedTemporaryFile()
|
||||
- try:
|
||||
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
|
||||
-
|
||||
- env = dict(os.environ)
|
||||
- env['LC_ALL'] = 'C'
|
||||
- env['LANG'] = 'C'
|
||||
- try:
|
||||
- proc = subprocess.Popen(args,
|
||||
- stdout=subprocess.PIPE,
|
||||
- stderr=subprocess.STDOUT,
|
||||
- env=env)
|
||||
- except OSError: # E.g. bad executable
|
||||
- return None
|
||||
- with proc:
|
||||
- trace = proc.stdout.read()
|
||||
- finally:
|
||||
- try:
|
||||
- temp.close()
|
||||
- except FileNotFoundError:
|
||||
- # Raised if the file was already removed, which is the normal
|
||||
- # behaviour of GCC if linking fails
|
||||
- pass
|
||||
- res = re.findall(expr, trace)
|
||||
- if not res:
|
||||
- return None
|
||||
-
|
||||
- for file in res:
|
||||
- # Check if the given file is an elf file: gcc can report
|
||||
- # some files that are linker scripts and not actual
|
||||
- # shared objects. See bpo-41976 for more details
|
||||
- if not _is_elf(file):
|
||||
- continue
|
||||
- return os.fsdecode(file)
|
||||
+ return None
|
||||
|
||||
|
||||
if sys.platform == "sunos5":
|
||||
@@ -268,34 +222,7 @@ def find_library(name, is64 = False):
|
||||
else:
|
||||
|
||||
|
|
|
@ -11,61 +11,6 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
|
|||
index 0c2510e161..7fb98af308 100644
|
||||
--- a/Lib/ctypes/util.py
|
||||
+++ b/Lib/ctypes/util.py
|
||||
@@ -100,53 +100,7 @@ def _is_elf(filename):
|
||||
return thefile.read(4) == elf_header
|
||||
|
||||
def _findLib_gcc(name):
|
||||
- # Run GCC's linker with the -t (aka --trace) option and examine the
|
||||
- # library name it prints out. The GCC command will fail because we
|
||||
- # haven't supplied a proper program with main(), but that does not
|
||||
- # matter.
|
||||
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
|
||||
-
|
||||
- c_compiler = shutil.which('gcc')
|
||||
- if not c_compiler:
|
||||
- c_compiler = shutil.which('cc')
|
||||
- if not c_compiler:
|
||||
- # No C compiler available, give up
|
||||
- return None
|
||||
-
|
||||
- temp = tempfile.NamedTemporaryFile()
|
||||
- try:
|
||||
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
|
||||
-
|
||||
- env = dict(os.environ)
|
||||
- env['LC_ALL'] = 'C'
|
||||
- env['LANG'] = 'C'
|
||||
- try:
|
||||
- proc = subprocess.Popen(args,
|
||||
- stdout=subprocess.PIPE,
|
||||
- stderr=subprocess.STDOUT,
|
||||
- env=env)
|
||||
- except OSError: # E.g. bad executable
|
||||
- return None
|
||||
- with proc:
|
||||
- trace = proc.stdout.read()
|
||||
- finally:
|
||||
- try:
|
||||
- temp.close()
|
||||
- except FileNotFoundError:
|
||||
- # Raised if the file was already removed, which is the normal
|
||||
- # behaviour of GCC if linking fails
|
||||
- pass
|
||||
- res = re.findall(expr, trace)
|
||||
- if not res:
|
||||
- return None
|
||||
-
|
||||
- for file in res:
|
||||
- # Check if the given file is an elf file: gcc can report
|
||||
- # some files that are linker scripts and not actual
|
||||
- # shared objects. See bpo-41976 for more details
|
||||
- if not _is_elf(file):
|
||||
- continue
|
||||
- return os.fsdecode(file)
|
||||
+ return None
|
||||
|
||||
|
||||
if sys.platform == "sunos5":
|
||||
@@ -268,34 +222,7 @@ def find_library(name, is64 = False):
|
||||
else:
|
||||
|
||||
|
|
|
@ -11,61 +11,6 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
|
|||
index 0c2510e161..7fb98af308 100644
|
||||
--- a/Lib/ctypes/util.py
|
||||
+++ b/Lib/ctypes/util.py
|
||||
@@ -100,53 +100,7 @@ elif os.name == "posix":
|
||||
return thefile.read(4) == elf_header
|
||||
|
||||
def _findLib_gcc(name):
|
||||
- # Run GCC's linker with the -t (aka --trace) option and examine the
|
||||
- # library name it prints out. The GCC command will fail because we
|
||||
- # haven't supplied a proper program with main(), but that does not
|
||||
- # matter.
|
||||
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
|
||||
-
|
||||
- c_compiler = shutil.which('gcc')
|
||||
- if not c_compiler:
|
||||
- c_compiler = shutil.which('cc')
|
||||
- if not c_compiler:
|
||||
- # No C compiler available, give up
|
||||
- return None
|
||||
-
|
||||
- temp = tempfile.NamedTemporaryFile()
|
||||
- try:
|
||||
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
|
||||
-
|
||||
- env = dict(os.environ)
|
||||
- env['LC_ALL'] = 'C'
|
||||
- env['LANG'] = 'C'
|
||||
- try:
|
||||
- proc = subprocess.Popen(args,
|
||||
- stdout=subprocess.PIPE,
|
||||
- stderr=subprocess.STDOUT,
|
||||
- env=env)
|
||||
- except OSError: # E.g. bad executable
|
||||
- return None
|
||||
- with proc:
|
||||
- trace = proc.stdout.read()
|
||||
- finally:
|
||||
- try:
|
||||
- temp.close()
|
||||
- except FileNotFoundError:
|
||||
- # Raised if the file was already removed, which is the normal
|
||||
- # behaviour of GCC if linking fails
|
||||
- pass
|
||||
- res = re.findall(expr, trace)
|
||||
- if not res:
|
||||
- return None
|
||||
-
|
||||
- for file in res:
|
||||
- # Check if the given file is an elf file: gcc can report
|
||||
- # some files that are linker scripts and not actual
|
||||
- # shared objects. See bpo-41976 for more details
|
||||
- if not _is_elf(file):
|
||||
- continue
|
||||
- return os.fsdecode(file)
|
||||
+ return None
|
||||
|
||||
|
||||
if sys.platform == "sunos5":
|
||||
@@ -268,34 +222,7 @@ elif os.name == "posix":
|
||||
else:
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
openfecSupport ? true,
|
||||
openfec,
|
||||
speexdsp,
|
||||
libunwindSupport ? true,
|
||||
libunwindSupport ? lib.meta.availableOn stdenv.hostPlatform libunwind,
|
||||
libunwind,
|
||||
pulseaudioSupport ? true,
|
||||
libpulseaudio,
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "aws-c-auth";
|
||||
version = "0.7.25";
|
||||
version = "0.7.26";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "awslabs";
|
||||
repo = "aws-c-auth";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-pj2LnvF1/h8AQNc810U7oYWKun13+qPBNCbGPj3wKlo=";
|
||||
hash = "sha256-02dy2xgMGWkLf+HyBztbkCcazfZNAMwpJPU2gGBPokY=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
|
|
@ -69,6 +69,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
postInstall = ''
|
||||
cd "$out/etc/fonts"
|
||||
xsltproc --stringparam fontDirectories "${dejavu_fonts.minimal}" \
|
||||
--stringparam includes /etc/fonts/conf.d \
|
||||
--path $out/share/xml/fontconfig \
|
||||
${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \
|
||||
> fonts.conf.tmp
|
||||
|
|
|
@ -92,6 +92,7 @@ stdenv.mkDerivation rec {
|
|||
# - fastopen: no idea; it broke between 3.6.2 and 3.6.3 (3437fdde6 in particular)
|
||||
# - trust-store: default trust store path (/etc/ssl/...) is missing in sandbox (3.5.11)
|
||||
# - psk-file: no idea; it broke between 3.6.3 and 3.6.4
|
||||
# - ktls: requires tls module loaded into kernel
|
||||
# Change p11-kit test to use pkg-config to find p11-kit
|
||||
postPatch = ''
|
||||
sed '2iexit 77' -i tests/{pkgconfig,fastopen}.sh
|
||||
|
@ -99,6 +100,8 @@ stdenv.mkDerivation rec {
|
|||
sed 's:/usr/lib64/pkcs11/ /usr/lib/pkcs11/ /usr/lib/x86_64-linux-gnu/pkcs11/:`pkg-config --variable=p11_module_path p11-kit-1`:' -i tests/p11-kit-trust.sh
|
||||
'' + lib.optionalString stdenv.hostPlatform.isMusl '' # See https://gitlab.com/gnutls/gnutls/-/issues/945
|
||||
sed '2iecho "certtool tests skipped in musl build"\nexit 0' -i tests/cert-tests/certtool.sh
|
||||
'' + lib.optionalString stdenv.isLinux ''
|
||||
sed '2iexit 77' -i tests/{ktls,ktls_keyupdate}.sh
|
||||
'';
|
||||
|
||||
preConfigure = "patchShebangs .";
|
||||
|
@ -112,6 +115,8 @@ stdenv.mkDerivation rec {
|
|||
"--with-unbound-root-key-file=${dns-root-data}/root.key"
|
||||
(lib.withFeature withP11-kit "p11-kit")
|
||||
(lib.enableFeature cxxBindings "cxx")
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
"--enable-ktls"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMinGW) [
|
||||
"--disable-doc"
|
||||
];
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
, mutest
|
||||
, nixosTests
|
||||
, glib
|
||||
, withDocumentation ? !stdenv.hostPlatform.isStatic
|
||||
, withDocumentation ? stdenv.buildPlatform.canExecute stdenv.hostPlatform || stdenv.hostPlatform.emulatorAvailable buildPackages
|
||||
, gtk-doc
|
||||
, docbook_xsl
|
||||
, docbook_xml_dtd_43
|
||||
|
@ -65,10 +65,10 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
docbook_xml_dtd_43
|
||||
docbook_xsl
|
||||
gtk-doc
|
||||
] ++ lib.optionals (withDocumentation && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
||||
mesonEmulatorHook
|
||||
] ++ lib.optionals withIntrospection [
|
||||
gobject-introspection
|
||||
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
||||
mesonEmulatorHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
|
@ -103,7 +103,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
in lib.optionalString withIntrospection ''
|
||||
if [ -x '${introspectionPy}' ] ; then
|
||||
wrapProgram '${introspectionPy}' \
|
||||
--prefix GI_TYPELIB_PATH : "$out/lib/girepository-1.0"
|
||||
--prefix GI_TYPELIB_PATH : "${lib.makeSearchPath "lib/girepository-1.0" [ glib.out (placeholder "out") ]}"
|
||||
fi
|
||||
'';
|
||||
|
||||
|
|
|
@ -10,15 +10,20 @@
|
|||
, glib
|
||||
, makeWrapper
|
||||
, libcap
|
||||
, libunwind
|
||||
, elfutils # for libdw
|
||||
, bash-completion
|
||||
, lib
|
||||
, Cocoa
|
||||
, CoreServices
|
||||
, gobject-introspection
|
||||
, rustc
|
||||
, testers
|
||||
, gobject-introspection
|
||||
, buildPackages
|
||||
, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
|
||||
, libunwind
|
||||
, withLibunwind ?
|
||||
lib.meta.availableOn stdenv.hostPlatform libunwind &&
|
||||
lib.elem "libunwind" libunwind.meta.pkgConfigModules or []
|
||||
# Checks meson.is_cross_build(), so even canExecute isn't enough.
|
||||
, enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform, hotdoc
|
||||
}:
|
||||
|
@ -58,10 +63,11 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
makeWrapper
|
||||
glib
|
||||
bash-completion
|
||||
gobject-introspection
|
||||
rustc
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
libcap # for setcap binary
|
||||
] ++ lib.optionals withIntrospection [
|
||||
gobject-introspection
|
||||
] ++ lib.optionals enableDocumentation [
|
||||
hotdoc
|
||||
];
|
||||
|
@ -70,9 +76,10 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
bash-completion
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
libcap
|
||||
libunwind
|
||||
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
|
||||
elfutils
|
||||
] ++ lib.optionals withLibunwind [
|
||||
libunwind
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
Cocoa
|
||||
CoreServices
|
||||
|
@ -85,11 +92,10 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
mesonFlags = [
|
||||
"-Ddbghelp=disabled" # not needed as we already provide libunwind and libdw, and dbghelp is a fallback to those
|
||||
"-Dexamples=disabled" # requires many dependencies and probably not useful for our users
|
||||
(lib.mesonEnable "introspection" withIntrospection)
|
||||
(lib.mesonEnable "doc" enableDocumentation)
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
# darwin.libunwind doesn't have pkg-config definitions so meson doesn't detect it.
|
||||
"-Dlibunwind=disabled"
|
||||
"-Dlibdw=disabled"
|
||||
(lib.mesonEnable "libunwind" withLibunwind)
|
||||
(lib.mesonEnable "libdw" withLibunwind)
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
|
|
@ -42,8 +42,6 @@ stdenv.mkDerivation rec {
|
|||
"--with-sqlite3-libdir=${sqlite.out}/lib/sqlite"
|
||||
] ++ lib.optionals (postgresql != null) [
|
||||
"--with-pgsql"
|
||||
"--with-pgsql_incdir=${postgresql}/include"
|
||||
"--with-pgsql_libdir=${postgresql.lib}/lib"
|
||||
];
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isClang [
|
||||
|
|
|
@ -45,7 +45,7 @@ in
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libinput";
|
||||
version = "1.26.1";
|
||||
version = "1.26.2";
|
||||
|
||||
outputs = [ "bin" "out" "dev" ];
|
||||
|
||||
|
@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
|
|||
owner = "libinput";
|
||||
repo = "libinput";
|
||||
rev = version;
|
||||
hash = "sha256-3iWKqg9HSicocDAyp1Lk87nBbj+Slg1/e1VKEOIQkyQ=";
|
||||
hash = "sha256-Ly832W2U38JuXiqvt6e7u3APynrmwi4Ns98bBdTBnP8=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
|
|
|
@ -23,8 +23,9 @@ stdenv.mkDerivation rec {
|
|||
hash = "sha256-mp9qjG7bplDPnqVUdc0XLdKEhzFoBOnHMgLZdXLNOi0=";
|
||||
};
|
||||
|
||||
# bin/psl-make-dafsa brings a large runtime closure through python3
|
||||
outputs = lib.optional (!stdenv.hostPlatform.isStatic) "bin" ++ [ "out" "dev" ];
|
||||
outputs = [ "out" "dev" ]
|
||||
# bin/psl-make-dafsa brings a large runtime closure through python3
|
||||
++ lib.optional (!stdenv.hostPlatform.isStatic) "bin";
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoreconfHook
|
||||
|
@ -77,7 +78,7 @@ stdenv.mkDerivation rec {
|
|||
the domain in a user interface or sorting domain lists by site.
|
||||
'';
|
||||
homepage = "https://rockdaboot.github.io/libpsl/";
|
||||
changelog = "https://raw.githubusercontent.com/rockdaboot/${pname}/${pname}-${version}/NEWS";
|
||||
changelog = "https://raw.githubusercontent.com/rockdaboot/libpsl/libpsl-${version}/NEWS";
|
||||
license = licenses.mit;
|
||||
maintainers = [ maintainers.c0bw3b ];
|
||||
mainProgram = "psl";
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
{ stdenv, lib, fetchpatch, fetchFromGitHub, autoreconfHook, xz, buildPackages }:
|
||||
{ stdenv, lib, fetchpatch, fetchFromGitHub, autoreconfHook, buildPackages
|
||||
, xz
|
||||
, testers
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "libunwind";
|
||||
version = "1.8.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "libunwind";
|
||||
repo = "libunwind";
|
||||
rev = "v${version}";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-rCFBHs6rCSnp5FEwbUR5veNNTqSQpFblAv8ebSPX0qE=";
|
||||
};
|
||||
|
||||
|
@ -50,12 +53,18 @@ stdenv.mkDerivation rec {
|
|||
|
||||
doCheck = false; # fails
|
||||
|
||||
passthru.tests.pkg-config = testers.hasPkgConfigModules {
|
||||
package = finalAttrs.finalPackage;
|
||||
versionCheck = true;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.nongnu.org/libunwind";
|
||||
description = "Portable and efficient API to determine the call-chain of a program";
|
||||
maintainers = with maintainers; [ orivej ];
|
||||
pkgConfigModules = [ "libunwind" "libunwind-coredump" "libunwind-generic" "libunwind-ptrace" "libunwind-setjmp" ];
|
||||
# https://github.com/libunwind/libunwind#libunwind
|
||||
platforms = [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-freebsd" "i686-linux" "loongarch64-linux" "mips64el-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv64-linux" "s390x-linux" "x86_64-freebsd" "x86_64-linux" "x86_64-solaris" ];
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
||||
})
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
# nix build .#legacyPackages.x86_64-darwin.mesa .#legacyPackages.aarch64-darwin.mesa
|
||||
rec {
|
||||
pname = "mesa";
|
||||
version = "24.2.1";
|
||||
version = "24.2.2";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
domain = "gitlab.freedesktop.org";
|
||||
owner = "mesa";
|
||||
repo = "mesa";
|
||||
rev = "mesa-${version}";
|
||||
hash = "sha256-1aOK5M4Xe1FnmouOIoyafrvnxyoGpNK8wLVDC8yO4p0=";
|
||||
hash = "sha256-1aRnG5BnFDuBOnGIb7X3yDk4PkhpBbMpp+IjfpmgtkM=";
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
, expat
|
||||
, fetchCrate
|
||||
, fetchFromGitLab
|
||||
, fetchpatch
|
||||
, file
|
||||
, flex
|
||||
, glslang
|
||||
|
|
|
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
|
|||
|
||||
preConfigure = ''
|
||||
export CPPFLAGS="-I${getDev libmysqlclient}/include/mysql"
|
||||
export LDFLAGS="-L${libmysqlclient}/lib/mysql -L${postgresql}/lib"
|
||||
export LDFLAGS="-L${libmysqlclient}/lib/mysql"
|
||||
configureFlagsArray=(--with-backends="mysql pgsql sqlite3")
|
||||
'';
|
||||
|
||||
|
|
|
@ -1,40 +1,36 @@
|
|||
. @fix_qmake_libtool@
|
||||
|
||||
qmakeFlags=( ${qmakeFlags-} )
|
||||
|
||||
qmakePrePhase() {
|
||||
qmakeFlags_orig=( "${qmakeFlags[@]}" )
|
||||
|
||||
# These flags must be added _before_ the flags specified in the derivation.
|
||||
qmakeFlags=( \
|
||||
"PREFIX=$out" \
|
||||
"NIX_OUTPUT_OUT=$out" \
|
||||
"NIX_OUTPUT_DEV=${!outputDev}" \
|
||||
"NIX_OUTPUT_BIN=${!outputBin}" \
|
||||
"NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \
|
||||
"NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \
|
||||
"NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" \
|
||||
)
|
||||
prependToVar qmakeFlags \
|
||||
"PREFIX=$out" \
|
||||
"NIX_OUTPUT_OUT=$out" \
|
||||
"NIX_OUTPUT_DEV=${!outputDev}" \
|
||||
"NIX_OUTPUT_BIN=${!outputBin}" \
|
||||
"NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \
|
||||
"NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \
|
||||
"NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}"
|
||||
|
||||
if [ -n "@debug@" ]; then
|
||||
qmakeFlags+=( "CONFIG+=debug" )
|
||||
prependToVar qmakeFlags "CONFIG+=debug"
|
||||
else
|
||||
qmakeFlags+=( "CONFIG+=release" )
|
||||
prependToVar qmakeFlags "CONFIG+=release"
|
||||
fi
|
||||
|
||||
# do the stripping ourselves (needed for separateDebugInfo)
|
||||
qmakeFlags+=( "CONFIG+=nostrip" )
|
||||
|
||||
qmakeFlags+=( "${qmakeFlags_orig[@]}" )
|
||||
prependToVar qmakeFlags "CONFIG+=nostrip"
|
||||
}
|
||||
prePhases+=" qmakePrePhase"
|
||||
|
||||
qmakeConfigurePhase() {
|
||||
runHook preConfigure
|
||||
|
||||
local flagsArray=()
|
||||
concatTo flagsArray qmakeFlags
|
||||
|
||||
echo "QMAKEPATH=$QMAKEPATH"
|
||||
echo qmake "${qmakeFlags[@]}"
|
||||
qmake "${qmakeFlags[@]}"
|
||||
echo qmake "${flagsArray[@]}"
|
||||
qmake "${flagsArray[@]}"
|
||||
|
||||
if ! [[ -v enableParallelBuilding ]]; then
|
||||
enableParallelBuilding=1
|
||||
|
|
|
@ -1 +1 @@
|
|||
qmakeFlags+=( "QMAKE_LRELEASE=@dev@/bin/lrelease" )
|
||||
appendToVar qmakeFlags "QMAKE_LRELEASE=@dev@/bin/lrelease"
|
||||
|
|
|
@ -1,33 +1,29 @@
|
|||
. @fix_qmake_libtool@
|
||||
|
||||
qmakeFlags=(${qmakeFlags-})
|
||||
|
||||
qmakePrePhase() {
|
||||
qmakeFlags_orig=("${qmakeFlags[@]}")
|
||||
|
||||
# These flags must be added _before_ the flags specified in the derivation.
|
||||
# TODO: these flags also need a patch which isn't applied
|
||||
# can we either remove these flags or update the qt5 patch?
|
||||
# "NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \
|
||||
qmakeFlags=(
|
||||
"PREFIX=$out"
|
||||
"NIX_OUTPUT_OUT=$out"
|
||||
"NIX_OUTPUT_DEV=${!outputDev}"
|
||||
"NIX_OUTPUT_BIN=${!outputBin}"
|
||||
"NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}"
|
||||
"NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}"
|
||||
)
|
||||
|
||||
qmakeFlags+=("${qmakeFlags_orig[@]}")
|
||||
prependToVar qmakeFlags \
|
||||
"PREFIX=$out" \
|
||||
"NIX_OUTPUT_OUT=$out" \
|
||||
"NIX_OUTPUT_DEV=${!outputDev}" \
|
||||
"NIX_OUTPUT_BIN=${!outputBin}" \
|
||||
"NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \
|
||||
"NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}"
|
||||
}
|
||||
prePhases+=" qmakePrePhase"
|
||||
|
||||
qmakeConfigurePhase() {
|
||||
runHook preConfigure
|
||||
|
||||
local flagsArray=()
|
||||
concatTo flagsArray qmakeFlags
|
||||
|
||||
echo "QMAKEPATH=$QMAKEPATH"
|
||||
echo qmake "${qmakeFlags[@]}"
|
||||
qmake "${qmakeFlags[@]}"
|
||||
echo qmake "${flagsArray[@]}"
|
||||
qmake "${flagsArray[@]}"
|
||||
|
||||
if ! [[ -v enableParallelBuilding ]]; then
|
||||
enableParallelBuilding=1
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "spirv-headers";
|
||||
version = "1.3.283.0";
|
||||
version = "1.3.290.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "SPIRV-Headers";
|
||||
rev = "vulkan-sdk-${version}";
|
||||
hash = "sha256-CAmDDqeMVKNdV/91VQYAKyCc+e+H99PRYZzt5WjswBI=";
|
||||
hash = "sha256-c9ruBCnf9PNJz030bfRhHwyqju6T8YCRx+efKCEYgSo=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
{ lib, stdenv, fetchFromGitHub, cmake }:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "vulkan-headers";
|
||||
version = "1.3.283.0";
|
||||
version = "1.3.290.0";
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
# TODO: investigate why <algorithm> isn't found
|
||||
cmakeFlags = lib.optionals stdenv.isDarwin [ "-DVULKAN_HEADERS_ENABLE_MODULE=OFF" ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "Vulkan-Headers";
|
||||
rev = "vulkan-sdk-${version}";
|
||||
hash = "sha256-DpbTYlEJPtyf/m9QEI8fdAm1Hw8MpFd+iCd7WB2gp/M=";
|
||||
hash = "sha256-goxA3Wg3u5hNCz54tWMJnFaS0JGVjphy14Ng/sAK/EM=";
|
||||
};
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "vulkan-loader";
|
||||
version = "1.3.283.0";
|
||||
version = "1.3.290.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "Vulkan-Loader";
|
||||
rev = "vulkan-sdk-${finalAttrs.version}";
|
||||
hash = "sha256-pe4WYbfB20yRI5Pg+RxgmQcmdXsSoRxbBkQ3DdAL8r4=";
|
||||
hash = "sha256-z26xvp7bKaOQAXF+/Sk24Syuw3N9QXc6sk2vlQwceJ8=";
|
||||
};
|
||||
|
||||
patches = [ ./fix-pkgconfig.patch ];
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "vulkan-utility-libraries";
|
||||
version = "1.3.283.0";
|
||||
version = "1.3.290.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "Vulkan-Utility-Libraries";
|
||||
rev = "vulkan-sdk-${finalAttrs.version}";
|
||||
hash = "sha256-oQC//4RHJjSncQtHPVsYnpLYtXfxSSJdbUBf8clevDI=";
|
||||
hash = "sha256-dzX2xePUkjL4G+IMwPCUgFs1iKsqwZScQQBDt5toUzc=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ];
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue