Skip to content

Commit

Permalink
unpapawify: fix breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Jan 20, 2020
1 parent a435377 commit 7046180
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ do
done

install -m 755 build-$1-arm-any32-linux-musleabi/papawify artifacts/papawify-$1
install -m 755 unpapawify artifacts/unpapawify-$1
install -m 755 build-$1-arm-any32-linux-musleabi/unpapawify artifacts/unpapawify-$1
15 changes: 11 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ cfg = configuration_data()
compression_sources = []
compression_cflags = ['-DPAPAW_XZ', '-Wno-unused-function']
compression_includes = [include_directories('xz-embedded/userspace'), include_directories('xz-embedded/linux/include/linux')]
cfg.set('CMD', '"xz", "-c", "--check=none", "--lzma2=preset=9e,dict=512KiB"')
cfg.set('COMPRESSION_CMD', '"xz", "-c", "--check=none", "--lzma2=preset=9e,dict=512KiB"')
cfg.set('DECOMPRESSION_CMD', '"xz", "-d"')

compression = get_option('compression')
if compression == 'lzma'
compression_cflags = ['-DPAPAW_LZMA']
compression_includes = []
cfg.set('CMD', '"xz", "-c", "--format=lzma", "--lzma1=preset=9e,dict=512KiB"')
cfg.set('COMPRESSION_CMD', '"xz", "-c", "--format=lzma", "--lzma1=preset=9e,dict=512KiB"')
elif compression == 'zstd'
compression_cflags = ['-DPAPAW_ZSTD']
compression_includes = []
Expand All @@ -91,11 +92,13 @@ elif compression == 'zstd'
'@INPUT@'
])
]
cfg.set('CMD', '"zstd", "-c", "--ultra", "-22", "--no-check"')
cfg.set('COMPRESSION_CMD', '"zstd", "-c", "--ultra", "-22", "--no-check"')
cfg.set('DECOMPRESSION_CMD', '"zstd", "-d"')
elif compression == 'deflate'
compression_cflags = ['-DPAPAW_DEFLATE']
compression_includes = []
cfg.set('CMD', '"python3", "-c", "import sys, zlib; sys.stdout.buffer.write(zlib.compress(open(sys.argv[1], \'rb\').read(), 9))"')
cfg.set('COMPRESSION_CMD', '"python3", "-c", "import sys, zlib; sys.stdout.buffer.write(zlib.compress(open(sys.argv[1], \'rb\').read(), 9))"')
cfg.set('DECOMPRESSION_CMD', '"python3", "-c", "import sys, zlib; sys.stdout.buffer.write(zlib.decompress(sys.stdin.buffer.read()))"')
endif

papaw = executable('papaw',
Expand Down Expand Up @@ -123,6 +126,10 @@ papawify = configure_file(input: 'papawify.in',
output: 'papawify',
configuration: cfg)

unpapawify = configure_file(input: 'unpapawify.in',
output: 'unpapawify',
configuration: cfg)

if get_option('ci')
libpapaw_so = shared_library('papaw',
'exe.c',
Expand Down
2 changes: 1 addition & 1 deletion papawify.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ parser.add_argument('output')
parser.add_argument('-u', '--uncompressed', dest='uncompressed', action='store_true')
args = parser.parse_args()

cmd = [@CMD@]
cmd = [@COMPRESSION_CMD@]
if args.uncompressed:
cmd = ["cat"]

Expand Down
4 changes: 2 additions & 2 deletions unpapawify → unpapawify.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This file is part of papaw.
#
# Copyright (c) 2019 Dima Krasner
# Copyright (c) 2019, 2020 Dima Krasner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -34,7 +34,7 @@ with open(sys.argv[1], "rb") as infp:
with open(sys.argv[2], "wb") as fp:
fp.write(data[-(size + 8):-8])
else:
xz = subprocess.Popen(["xz", "-d"],
xz = subprocess.Popen([@DECOMPRESSION_CMD@],
stdin=subprocess.PIPE,
stdout=open(sys.argv[2], "wb"))
xz.stdin.write(data[-(size + 8):-8])
Expand Down

0 comments on commit 7046180

Please sign in to comment.