From 075f50f2d167affaefe3783dc21922a8288f4247 Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Sun, 16 Apr 2023 03:32:26 +1000 Subject: [PATCH] dart.fetch-dart-deps: Compress the generated pubspec.lock file This is much more practical for users to copy, as it significantly reduces the length of the output. --- pkgs/build-support/dart/fetch-dart-deps/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/dart/fetch-dart-deps/default.nix b/pkgs/build-support/dart/fetch-dart-deps/default.nix index fc4954ae9e83..acde38fc67e0 100644 --- a/pkgs/build-support/dart/fetch-dart-deps/default.nix +++ b/pkgs/build-support/dart/fetch-dart-deps/default.nix @@ -86,18 +86,20 @@ let ${lib.optionalString (pubspecLockFile != null) "install -m644 ${pubspecLockFile} pubspec.lock"} if ! cp "pubspec.lock" "$out/pubspec"; then echo 1>&2 -e '\nThe pubspec.lock file is missing. This is a requirement for reproducible builds.' \ - '\nThe following should be done to fix this issue:' \ + '\nThe following steps should be taken to fix this issue:' \ '\n 1. If you are building an application, contact the developer(s).' \ '\n The pubspec.lock file should be provided with the source code.' \ '\n https://dart.dev/guides/libraries/private-files#pubspeclock' \ - '\n 2. An attempt to generate and print a pubspec.lock file will be made now.' \ - '\n Save it to a file, and provide the path to that file in the pubspecLockFile argument.' \ + '\n 2. An attempt to generate and print a compressed pubspec.lock file will be made now.' \ + '\n It is compressed with gzip and base64 encoded.' \ + '\n Paste it to a file and extract it with `base64 -d pubspec.lock.in | gzip -d > pubspec.lock`.' \ + '\n Provide the path to the pubspec.lock file in the pubspecLockFile argument.' \ '\n This must be updated whenever the application is updated.' \ '\n' _pub_get echo "" - cat 1>&2 pubspec.lock - echo 1>&2 -e '\nA pubspec.lock file has been printed. Please see the informational message above.' + gzip --to-stdout --best pubspec.lock | base64 1>&2 + echo 1>&2 -e '\nA gzipped pubspec.lock file has been printed. Please see the informational message above.' exit 1 fi