diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-03-30 13:30:47 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-03-31 10:13:20 +0000 |
commit | f2e61678de300336b3666afd19af7565efb0c4cf (patch) | |
tree | 49f6906c9d557f7fdd58257ff85ec17fc4495f31 /nixpkgs/pkgs/tools/archivers | |
parent | f920d5e07c29a9aa1b77d9b88bd604cf1a1f3664 (diff) | |
parent | 00e27c78d3d2de6964096ceee8d70e5b487365e3 (diff) | |
download | nixlib-f2e61678de300336b3666afd19af7565efb0c4cf.tar nixlib-f2e61678de300336b3666afd19af7565efb0c4cf.tar.gz nixlib-f2e61678de300336b3666afd19af7565efb0c4cf.tar.bz2 nixlib-f2e61678de300336b3666afd19af7565efb0c4cf.tar.lz nixlib-f2e61678de300336b3666afd19af7565efb0c4cf.tar.xz nixlib-f2e61678de300336b3666afd19af7565efb0c4cf.tar.zst nixlib-f2e61678de300336b3666afd19af7565efb0c4cf.zip |
Merge commit '00e27c78d3d2de6964096ceee8d70e5b487365e3'
Conflicts: nixpkgs/nixos/modules/system/boot/systemd.nix nixpkgs/pkgs/applications/networking/browsers/firefox/common.nix nixpkgs/pkgs/applications/version-management/git-and-tools/cgit/common.nix nixpkgs/pkgs/applications/version-management/git-and-tools/cgit/default.nix nixpkgs/pkgs/applications/version-management/git-and-tools/cgit/pink.nix nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/tools/archivers')
-rw-r--r-- | nixpkgs/pkgs/tools/archivers/7zz/default.nix | 58 | ||||
-rwxr-xr-x | nixpkgs/pkgs/tools/archivers/7zz/update.sh | 50 | ||||
-rw-r--r-- | nixpkgs/pkgs/tools/archivers/p7zip/default.nix | 35 | ||||
-rwxr-xr-x | nixpkgs/pkgs/tools/archivers/p7zip/update.sh | 47 | ||||
-rw-r--r-- | nixpkgs/pkgs/tools/archivers/rar/default.nix | 24 |
5 files changed, 187 insertions, 27 deletions
diff --git a/nixpkgs/pkgs/tools/archivers/7zz/default.nix b/nixpkgs/pkgs/tools/archivers/7zz/default.nix index c93a750e48f0..c4ccae0272eb 100644 --- a/nixpkgs/pkgs/tools/archivers/7zz/default.nix +++ b/nixpkgs/pkgs/tools/archivers/7zz/default.nix @@ -1,4 +1,14 @@ -{ stdenv, lib, fetchurl, p7zip, uasm, useUasm ? stdenv.isx86_64 }: +{ stdenv +, lib +, fetchurl + +, uasm +, useUasm ? stdenv.isx86_64 + + # RAR code is under non-free unRAR license + # see the meta.license section below for more details +, enableUnfree ? false +}: let inherit (stdenv.hostPlatform) system; @@ -14,17 +24,38 @@ stdenv.mkDerivation rec { version = "21.07"; src = fetchurl { - url = "https://7-zip.org/a/7z${lib.replaceStrings [ "." ] [ "" ] version}-src.7z"; - sha256 = "sha256-0QdNVvQVqrmdmeWXp7ZtxFXbpjSa6KTInfdkdbahKEw="; + url = "https://7-zip.org/a/7z${lib.replaceStrings [ "." ] [ "" ] version}-src.tar.xz"; + sha256 = { + free = "sha256-SMM6kQ6AZ05s4miJjMoE4NnsXQ0tlkdWx0q2HKjhaM8="; + unfree = "sha256-IT1ZRAfLjvy6NmELFSykkh7aFBYzELQ5A9E+aDE+Hjk="; + }.${if enableUnfree then "unfree" else "free"}; + downloadToTemp = (!enableUnfree); + # remove the unRAR related code from the src drv + # > the license requires that you agree to these use restrictions, + # > or you must remove the software (source and binary) from your hard disks + # https://fedoraproject.org/wiki/Licensing:Unrar + postFetch = lib.optionalString (!enableUnfree) '' + mkdir tmp + tar xf $downloadedFile -C ./tmp + rm -r ./tmp/CPP/7zip/Compress/Rar* + tar cfJ $out -C ./tmp . \ + --sort=name \ + --mtime="@$SOURCE_DATE_EPOCH" \ + --owner=0 --group=0 --numeric-owner \ + --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime + ''; }; sourceRoot = "CPP/7zip/Bundles/Alone2"; - makeFlags = lib.optionals useUasm [ "MY_ASM=uasm" ]; + makeFlags = + lib.optionals useUasm [ "MY_ASM=uasm" ] ++ + # it's the compression code with the restriction, see DOC/License.txt + lib.optionals (!enableUnfree) [ "DISABLE_RAR_COMPRESS=true" ]; makefile = "../../cmpl_gcc${platformSuffix}.mak"; - nativeBuildInputs = [ p7zip ] ++ lib.optionals useUasm [ uasm ]; + nativeBuildInputs = lib.optionals useUasm [ uasm ]; enableParallelBuilding = true; @@ -40,14 +71,27 @@ stdenv.mkDerivation rec { doInstallCheck = true; installCheckPhase = '' + runHook preInstallCheck + $out/bin/7zz --help | grep ${version} + + runHook postInstallCheck ''; + passthru.updateScript = ./update.sh; + meta = with lib; { description = "Command line archiver utility"; homepage = "https://7-zip.org"; - license = licenses.lgpl21Plus; - maintainers = with maintainers; [ anna328p peterhoeg ]; + license = with licenses; + # 7zip code is largely lgpl2Plus + # CPP/7zip/Compress/LzfseDecoder.cpp is bsd3 + [ lgpl2Plus /* and */ bsd3 ] ++ + # and CPP/7zip/Compress/Rar* are unfree with the unRAR license restriction + # the unRAR compression code is disabled by default + lib.optionals enableUnfree [ unfree ]; + maintainers = with maintainers; [ anna328p peterhoeg jk ]; platforms = platforms.linux; + mainProgram = "7zz"; }; } diff --git a/nixpkgs/pkgs/tools/archivers/7zz/update.sh b/nixpkgs/pkgs/tools/archivers/7zz/update.sh new file mode 100755 index 000000000000..bbc9804799ab --- /dev/null +++ b/nixpkgs/pkgs/tools/archivers/7zz/update.sh @@ -0,0 +1,50 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p coreutils gnused curl jq +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +DRV_DIR="$PWD" + +OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)" + +NEW_VERSION="$(curl "https://sourceforge.net/projects/sevenzip/best_release.json" | jq '.platform_releases.linux.filename' -r | cut -d/ -f3)" + +echo "comparing versions $OLD_VERSION => $NEW_VERSION" +if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then + echo "Already up to date! Doing nothing" + exit 0 +fi + +NIXPKGS_ROOT="$(realpath "$DRV_DIR/../../../..")" + +echo "getting free source hash" +OLD_FREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; _7zz.src.drvAttrs.outputHash" | tr -d '"')" +echo "getting unfree source hash" +OLD_UNFREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; (_7zz.override { enableUnfree = true; }).src.drvAttrs.outputHash" | tr -d '"')" + +NEW_VERSION_FORMATTED="$(echo "$NEW_VERSION" | tr -d '.')" +URL="https://7-zip.org/a/7z${NEW_VERSION_FORMATTED}-src.tar.xz" + + +NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "_7zz.src" --url "$URL") + +NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(_7zz.override { enableUnfree = true; }).src" --url "$URL" --output raw --print-path) +# first line of raw output is the hash +NEW_UNFREE_HASH="$(echo "$NEW_UNFREE_OUT" | sed -n 1p)" +# second line of raw output is the src path +NEW_UNFREE_SRC="$(echo "$NEW_UNFREE_OUT" | sed -n 2p)" +# make sure to nuke the unfree src from the updater's machine +# > the license requires that you agree to these use restrictions, or you must remove the software (source and binary) from your hard disks +# https://fedoraproject.org/wiki/Licensing:Unrar +nix-store --delete "$NEW_UNFREE_SRC" + + +echo "updating version" +sed -i "s/version = \"$OLD_VERSION\";/version = \"$NEW_VERSION\";/" "$DRV_DIR/default.nix" + +echo "updating free hash" +sed -i "s@free = \"$OLD_FREE_HASH\";@free = \"$NEW_FREE_HASH\";@" "$DRV_DIR/default.nix" +echo "updating unfree hash" +sed -i "s@unfree = \"$OLD_UNFREE_HASH\";@unfree = \"$NEW_UNFREE_HASH\";@" "$DRV_DIR/default.nix" + +echo "done" diff --git a/nixpkgs/pkgs/tools/archivers/p7zip/default.nix b/nixpkgs/pkgs/tools/archivers/p7zip/default.nix index 7f892a44da5d..5e92553b636c 100644 --- a/nixpkgs/pkgs/tools/archivers/p7zip/default.nix +++ b/nixpkgs/pkgs/tools/archivers/p7zip/default.nix @@ -8,7 +8,18 @@ stdenv.mkDerivation rec { owner = "jinfeihan57"; repo = pname; rev = "v${version}"; - sha256 = "sha256-19F4hPV0nKVuFZNbOcXrcA1uW6Y3HQolaHVIYXGmh18="; + sha256 = { + free = "sha256-DrBuf2VPdcprHI6pMSmL7psm2ofOrUf0Oj0qwMjXzkk="; + unfree = "sha256-19F4hPV0nKVuFZNbOcXrcA1uW6Y3HQolaHVIYXGmh18="; + }.${if enableUnfree then "unfree" else "free"}; + # remove the unRAR related code from the src drv + # > the license requires that you agree to these use restrictions, + # > or you must remove the software (source and binary) from your hard disks + # https://fedoraproject.org/wiki/Licensing:Unrar + extraPostFetch = lib.optionalString (!enableUnfree) '' + rm -r $out/CPP/7zip/Compress/Rar* + find $out -name makefile'*' -exec sed -i '/Rar/d' {} + + ''; }; # Default makefile is full of impurities on Darwin. The patch doesn't hurt Linux so I'm leaving it unconditional @@ -25,11 +36,6 @@ stdenv.mkDerivation rec { substituteInPlace makefile.machine \ --replace 'CC=gcc' 'CC=${stdenv.cc.targetPrefix}gcc' \ --replace 'CXX=g++' 'CXX=${stdenv.cc.targetPrefix}g++' - '' + lib.optionalString (!enableUnfree) '' - # Remove non-free RAR source code - # (see DOC/License.txt, https://fedoraproject.org/wiki/Licensing:Unrar) - rm -r CPP/7zip/Compress/Rar* - find . -name makefile'*' -exec sed -i '/Rar/d' {} + ''; makeFlags = [ "DEST_HOME=${placeholder "out"}" ]; @@ -46,13 +52,20 @@ stdenv.mkDerivation rec { NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing"; - meta = { + passthru.updateScript = ./update.sh; + + meta = with lib; { homepage = "https://github.com/jinfeihan57/p7zip"; description = "A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/p7zip/)"; - platforms = lib.platforms.unix; - maintainers = [ lib.maintainers.raskin ]; + license = with licenses; + # p7zip code is largely lgpl2Plus + # CPP/7zip/Compress/LzfseDecoder.cpp is bsd3 + [ lgpl2Plus /* and */ bsd3 ] ++ + # and CPP/7zip/Compress/Rar* are unfree with the unRAR license restriction + # the unRAR compression code is disabled by default + lib.optionals enableUnfree [ unfree ]; + maintainers = with maintainers; [ raskin jk ]; + platforms = platforms.unix; mainProgram = "7z"; - # RAR code is under non-free UnRAR license, but we remove it - license = if enableUnfree then lib.licenses.unfree else lib.licenses.lgpl2Plus; }; } diff --git a/nixpkgs/pkgs/tools/archivers/p7zip/update.sh b/nixpkgs/pkgs/tools/archivers/p7zip/update.sh new file mode 100755 index 000000000000..0d4b91e56e80 --- /dev/null +++ b/nixpkgs/pkgs/tools/archivers/p7zip/update.sh @@ -0,0 +1,47 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p coreutils gnused curl jq +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +DRV_DIR="$PWD" + +OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)" + +NEW_VERSION="$(curl https://api.github.com/repos/jinfeihan57/p7zip/releases/latest | jq .tag_name -r | tr -d 'v')" + +echo "comparing versions $OLD_VERSION => $NEW_VERSION" +if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then + echo "Already up to date! Doing nothing" + exit 0 +fi + +NIXPKGS_ROOT="$(realpath "$DRV_DIR/../../../..")" + +echo "getting free source hash" +OLD_FREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; p7zip.src.drvAttrs.outputHash" | tr -d '"')" +echo "getting unfree source hash" +OLD_UNFREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; (p7zip.override { enableUnfree = true; }).src.drvAttrs.outputHash" | tr -d '"')" + + +NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "p7zip.src" --rev "v$NEW_VERSION") + +NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(p7zip.override { enableUnfree = true; }).src" --rev "v$NEW_VERSION" --output raw --print-path) +# first line of raw output is the hash +NEW_UNFREE_HASH="$(echo "$NEW_UNFREE_OUT" | sed -n 1p)" +# second line of raw output is the src path +NEW_UNFREE_SRC="$(echo "$NEW_UNFREE_OUT" | sed -n 2p)" +# make sure to nuke the unfree src from the updater's machine +# > the license requires that you agree to these use restrictions, or you must remove the software (source and binary) from your hard disks +# https://fedoraproject.org/wiki/Licensing:Unrar +nix-store --delete "$NEW_UNFREE_SRC" + + +echo "updating version" +sed -i "s/version = \"$OLD_VERSION\";/version = \"$NEW_VERSION\";/" "$DRV_DIR/default.nix" + +echo "updating free hash" +sed -i "s@free = \"$OLD_FREE_HASH\";@free = \"$NEW_FREE_HASH\";@" "$DRV_DIR/default.nix" +echo "updating unfree hash" +sed -i "s@unfree = \"$OLD_UNFREE_HASH\";@unfree = \"$NEW_UNFREE_HASH\";@" "$DRV_DIR/default.nix" + +echo "done" diff --git a/nixpkgs/pkgs/tools/archivers/rar/default.nix b/nixpkgs/pkgs/tools/archivers/rar/default.nix index a359beb21adf..6f47992b512c 100644 --- a/nixpkgs/pkgs/tools/archivers/rar/default.nix +++ b/nixpkgs/pkgs/tools/archivers/rar/default.nix @@ -1,19 +1,24 @@ { lib, stdenv, fetchurl, autoPatchelfHook, installShellFiles }: let - version = "6.0.2"; + version = "6.11"; + downloadVersion = lib.replaceStrings [ "." ] [ "" ] version; srcUrl = { i686-linux = { - url = "https://www.rarlab.com/rar/rarlinux-${version}.tar.gz"; - sha256 = "sha256-5iqk7eoo+hgltgscquob+wofzhuqz0m/8jf7bxdf9qa="; + url = "https://www.rarlab.com/rar/rarlinux-x32-${downloadVersion}.tar.gz"; + sha256 = "sha256-7mpKkOEspGskt9yfSDrdK7CieJ0AectJKTi8TxLnbtk="; }; x86_64-linux = { - url = "https://www.rarlab.com/rar/rarlinux-x64-${version}.tar.gz"; - sha256 = "sha256-WAvrUGCgfwI51Mo/RYSSF0OLPPrTegUCuDEsnBeR9uQ="; + url = "https://www.rarlab.com/rar/rarlinux-x64-${downloadVersion}.tar.gz"; + sha256 = "sha256-pb3QdLqdxIf3ybLfPao3MdilTHYjCB1BujYsTQuEMtE="; + }; + aarch64-darwin = { + url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz"; + sha256 = "sha256-q2fC4w2/tJ+GaD3ETPP+V3SAApdlLDgr3eE2YcERQXA="; }; x86_64-darwin = { - url = "https://www.rarlab.com/rar/rarosx-${version}.tar.gz"; - sha256 = "sha256-baZ71vYXIGs25f7PJ0ujoGUrsWZRmFLhvDI0KoVktsg="; + url = "https://www.rarlab.com/rar/rarmacos-x64-${downloadVersion}.tar.gz"; + sha256 = "sha256-yHWxAscqnLKrG9Clsaiy6wSbyVz4gpvN6AjyirCmIKQ="; }; }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}"); manSrc = fetchurl { @@ -30,9 +35,10 @@ stdenv.mkDerivation rec { dontBuild = true; - buildInputs = [ stdenv.cc.cc.lib ]; + buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ]; - nativeBuildInputs = [ autoPatchelfHook installShellFiles ]; + nativeBuildInputs = [ installShellFiles ] + ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ]; installPhase = '' runHook preInstall |