From 2aafeedd15e33491f637a20baf5b1b3b4fd5b4a3 Mon Sep 17 00:00:00 2001 From: danbst Date: Thu, 27 Dec 2018 15:13:48 +0200 Subject: [PATCH] squashfs: 4.4dev -> 4.4dev-20180612 This squashfstools release finally has `zstd` support. --- pkgs/tools/filesystems/squashfs/default.nix | 12 +++++++----- .../squashfs/squashfs-tools-4.3-4k-align.patch | 15 ++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pkgs/tools/filesystems/squashfs/default.nix b/pkgs/tools/filesystems/squashfs/default.nix index 389a614f54b..2fd3d52bdf6 100644 --- a/pkgs/tools/filesystems/squashfs/default.nix +++ b/pkgs/tools/filesystems/squashfs/default.nix @@ -1,18 +1,20 @@ { stdenv, fetchFromGitHub, zlib, xz , lz4 ? null , lz4Support ? false +, zstd }: assert lz4Support -> (lz4 != null); stdenv.mkDerivation rec { - name = "squashfs-4.4dev"; + name = "squashfs-${version}"; + version = "4.4dev_20180612"; src = fetchFromGitHub { owner = "plougher"; repo = "squashfs-tools"; - sha256 = "059pa2shdysr3zfmwrhq28s12zbi5nyzbpzyaf5lmspgfh1493ks"; - rev = "9c1db6d13a51a2e009f0027ef336ce03624eac0d"; + sha256 = "1y53z8dkph3khdyhkmkmy0sg9p1n8czv3vj4l324nj8kxyih3l2c"; + rev = "6e242dc95485ada8d1d0b3dd9346c5243d4a517f"; }; patches = [ @@ -28,14 +30,14 @@ stdenv.mkDerivation rec { ./squashfs-tools-4.3-4k-align.patch ] ++ stdenv.lib.optional stdenv.isDarwin ./darwin.patch; - buildInputs = [ zlib xz ] + buildInputs = [ zlib xz zstd ] ++ stdenv.lib.optional lz4Support lz4; preBuild = "cd squashfs-tools"; installFlags = "INSTALL_DIR=\${out}/bin"; - makeFlags = [ "XZ_SUPPORT=1" ] + makeFlags = [ "XZ_SUPPORT=1" "ZSTD_SUPPORT=1" ] ++ stdenv.lib.optional lz4Support "LZ4_SUPPORT=1"; meta = { diff --git a/pkgs/tools/filesystems/squashfs/squashfs-tools-4.3-4k-align.patch b/pkgs/tools/filesystems/squashfs/squashfs-tools-4.3-4k-align.patch index b7c949182e0..cd4308b489f 100644 --- a/pkgs/tools/filesystems/squashfs/squashfs-tools-4.3-4k-align.patch +++ b/pkgs/tools/filesystems/squashfs/squashfs-tools-4.3-4k-align.patch @@ -27,11 +27,12 @@ index 8b1376f..683973d 100644 int use_regex = FALSE; int nopad = FALSE; int exit_on_error = FALSE; + static off_t squashfs_start_offset = 0; +int do_4k_align = FALSE; +#define ALIGN_UP(bytes, size) (bytes = (bytes + size - 1) & ~(size - 1)) - + long long global_uid = -1, global_gid = -1; - + @@ -1513,6 +1515,9 @@ void unlock_fragments() * queue at this time. */ @@ -40,7 +41,7 @@ index 8b1376f..683973d 100644 + if(do_4k_align) + ALIGN_UP(bytes, 4096); write_buffer = queue_get(locked_fragment); - frg = write_buffer->block; + frg = write_buffer->block; size = SQUASHFS_COMPRESSED_SIZE_BLOCK(fragment_table[frg].size); @@ -2420,6 +2420,9 @@ compressed_size = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte); @@ -55,18 +56,18 @@ index 8b1376f..683973d 100644 @@ -2761,6 +2769,10 @@ int write_file_blocks(squashfs_inode *inode, struct dir_ent *dir_ent, long long sparse = 0; struct file_buffer *fragment_buffer = NULL; - + + // 4k align the start of each file. + if(do_4k_align) + ALIGN_UP(bytes, 4096); + if(pre_duplicate(read_size)) return write_file_blocks_dup(inode, dir_ent, read_buffer, dup); - + @@ -4692,6 +4704,7 @@ void write_filesystem_tables(struct squashfs_super_block *sBlk, int nopad) "compressed", no_fragments ? "no" : noF ? "uncompressed" : "compressed", no_xattrs ? "no" : noX ? "uncompressed" : - "compressed"); + "compressed", noI || noId ? "uncompressed" : "compressed"); + printf("\t4k %saligned\n", do_4k_align ? "" : "un"); printf("\tduplicates are %sremoved\n", duplicate_checking ? "" : "not "); @@ -88,5 +89,5 @@ index 8b1376f..683973d 100644 ERROR("\nFilesystem filter options:\n"); ERROR("-p \tAdd pseudo file " "definition\n"); --- +-- 2.14.1.480.gb18f417b89-goog (previously; hand-patched by charles-dyfis-net)