pdfcpu: 0.9.1 -> 0.10.1 (#400851)

This commit is contained in:
Doron Behar
2025-04-23 04:34:56 +03:00
committed by GitHub

View File

@@ -1,18 +1,20 @@
{ {
lib, lib,
buildGoModule, buildGoModule,
stdenv,
fetchFromGitHub, fetchFromGitHub,
writableTmpDirAsHomeHook,
}: }:
buildGoModule rec { buildGoModule rec {
pname = "pdfcpu"; pname = "pdfcpu";
version = "0.9.1"; version = "0.10.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "pdfcpu"; owner = "pdfcpu";
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
hash = "sha256-PJTEaWU/erqVJakvxfB0aYRsi/tcGxYYZjCdEvThmzM="; hash = "sha256-IODE6/TIXZZC5Z8guFK24iiHTwj84fcf9RiAyFkX2F8=";
# Apparently upstream requires that the compiled executable will know the # Apparently upstream requires that the compiled executable will know the
# commit hash and the date of the commit. This information is also presented # commit hash and the date of the commit. This information is also presented
# in the output of `pdfcpu version` which we use as a sanity check in the # in the output of `pdfcpu version` which we use as a sanity check in the
@@ -35,7 +37,7 @@ buildGoModule rec {
''; '';
}; };
vendorHash = "sha256-x5EXv2LkJg2LAdml+1I4MzgTvNo6Gl+6e6UHVQ+Z9rU="; vendorHash = "sha256-27YTR/vYuNggjUIbpKs3/yEJheUXMaLZk8quGPwgNNk=";
ldflags = [ ldflags = [
"-s" "-s"
@@ -52,12 +54,24 @@ buildGoModule rec {
# No tests # No tests
doCheck = false; doCheck = false;
doInstallCheck = true; doInstallCheck = true;
installCheckInputs = [
writableTmpDirAsHomeHook
];
# NOTE: Can't use `versionCheckHook` since a writeable $HOME is required and
# `versionCheckHook` uses --ignore-environment
installCheckPhase = '' installCheckPhase = ''
export HOME=$(mktemp -d)
echo checking the version print of pdfcpu echo checking the version print of pdfcpu
$out/bin/pdfcpu version | grep ${version} mkdir -p $HOME/"${
$out/bin/pdfcpu version | grep $(cat COMMIT | cut -c1-8) if stdenv.hostPlatform.isDarwin then "Library/Application Support" else ".config"
$out/bin/pdfcpu version | grep $(cat SOURCE_DATE) }"/pdfcpu
versionOutput="$($out/bin/pdfcpu version)"
for part in ${version} $(cat COMMIT | cut -c1-8) $(cat SOURCE_DATE); do
if [[ ! "$versionOutput" =~ "$part" ]]; then
echo version output did not contain expected part $part . Output was:
echo "$versionOutput"
exit 3
fi
done
''; '';
subPackages = [ "cmd/pdfcpu" ]; subPackages = [ "cmd/pdfcpu" ];