Unverified Commit 3997920e authored by Thiago Kenji Okada's avatar Thiago Kenji Okada Committed by GitHub
Browse files

rar: 7.01 -> 7.12; generate manpage from rar.txt (#453045)

parents fa3cc58e ba269f70
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -4,34 +4,26 @@
  fetchurl,
  autoPatchelfHook,
  installShellFiles,
  perl,
}:

let
  version = "7.01";
  version = "7.12";
  downloadVersion = lib.replaceStrings [ "." ] [ "" ] version;
  # Use `./update.sh` to generate the entries below
  srcs = {
    i686-linux = {
      url = "https://www.rarlab.com/rar/rarlinux-x32-${downloadVersion}.tar.gz";
      hash = "sha256-1CSbxM7arGpn4Yj5fHEFKcDURFPrC2+XptLoaDH8LDs=";
    };
    x86_64-linux = {
      url = "https://www.rarlab.com/rar/rarlinux-x64-${downloadVersion}.tar.gz";
      hash = "sha256-34iWajylsSmIOuAT6kV7c2537qWFHc+gT+JT/trWrw8=";
      hash = "sha256-Yw2andExNnJzZnvuB5rRA/Rp8bfNvJtCpPKDzCmTurI=";
    };
    aarch64-darwin = {
      url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz";
      hash = "sha256-BjEJFzKyRpN4XL6KYW7ykQcSxqF4tYr2dCFf50JHH38=";
      hash = "sha256-lQeOD1n/0F6+ZlpVfp1NHAcxVqJ3fZFn9sQg7kSKg8U=";
    };
    x86_64-darwin = {
      url = "https://www.rarlab.com/rar/rarmacos-x64-${downloadVersion}.tar.gz";
      hash = "sha256-1ExnVDre49wWwB/BKP/L9xdYOMx8qkeZfmObJ7xm4dY=";
    };
      hash = "sha256-Wzp5Izpc4usNldBEb3OZCeNyByTTJegoxbDD8HNnCPo=";
    };
  manSrc = fetchurl {
    url = "https://aur.archlinux.org/cgit/aur.git/plain/rar.1?h=rar&id=8e39a12e88d8a3b168c496c44c18d443c876dd10";
    name = "rar.1";
    hash = "sha256-93cSr9oAsi+xHUtMsUvICyHJe66vAImS2tLie7nt8Uw=";
  };
in
stdenv.mkDerivation {
@@ -48,9 +40,17 @@ stdenv.mkDerivation {

  nativeBuildInputs = [
    installShellFiles
    perl
  ]
  ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];

  postPatch = ''
    perl -0777 -i -pe 's/ ([\w .-]+\n) ~+\n/=head1 \U$1/g' rar.txt
    perl -0777 -i -pe 's/ (Copyrights)/=head1 \U$1/g;' rar.txt
    mv rar.txt rar.1.pod
    pod2man -c "RAR User's Manual" -n "RAR" -r "rar ${version}" -s 1 rar.1.pod > rar.1
  '';

  installPhase = ''
    runHook preInstall

@@ -58,14 +58,11 @@ stdenv.mkDerivation {
    install -Dm755 default.sfx -t "$out/lib"
    install -Dm644 {acknow.txt,license.txt} -t "$out/share/doc/rar"
    install -Dm644 rarfiles.lst -t "$out/etc"
    installManPage rar.1

    runHook postInstall
  '';

  postInstall = ''
    installManPage ${manSrc}
  '';

  passthru.updateScript = ./update.sh;

  meta = with lib; {
+2 −3
Original line number Diff line number Diff line
@@ -42,12 +42,12 @@ updateHash() {
    hash=$(nix store prefetch-file --json "$url" | jq -r .hash)
    currentHash=$(cd "$DIRNAME" && nix "${NIX_FLAGS[@]}" eval --raw "$NIXPKGS_ROOT#legacyPackages.$nix_arch.rar.src.outputHash")

    sed -i "s|$currentHash|$hash|g" "$DIRNAME/default.nix"
    sed -i "s|$currentHash|$hash|g" "$DIRNAME/package.nix"
}

updateVersion() {
    local -r version="$1"
    sed -i "s|version = \"[0-9.]*\";|version = \"$version\";|g" "$DIRNAME/default.nix"
    sed -i "s|version = \"[0-9.]*\";|version = \"$version\";|g" "$DIRNAME/package.nix"
}

latestVersion="${1:-}"
@@ -70,7 +70,6 @@ if [[ "$currentVersion" == "$latestVersion" ]]; then
    exit 0
fi

updateHash "$latestVersion" x32 linux i686-linux
updateHash "$latestVersion" x64 linux x86_64-linux
updateHash "$latestVersion" arm macos aarch64-darwin
updateHash "$latestVersion" x64 macos x86_64-darwin