package: add generic support for lz archives
authorBaruch Siach <baruch@tkos.co.il>
Sun, 12 Feb 2017 20:15:39 +0000 (22:15 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 15 Feb 2017 21:11:11 +0000 (22:11 +0100)
This commit teaches the generic package handling code how to extract .tar.lz
archives. When lzip is not installed on the host, host-lzip gets built
automatically.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Config.in
Makefile
package/pkg-utils.mk
support/dependencies/check-host-lzip.mk [new file with mode: 0644]
support/dependencies/check-host-lzip.sh [new file with mode: 0755]

index ccd777e8bb00e56cec09a61f630dda8773e31d28..bd8f0d1a10ee1976bc3776a79f4a76eb9eacf55b 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -158,6 +158,13 @@ config BR2_XZCAT
          Command to be used to extract a xz'ed file to stdout.
          Default is "xzcat"
 
+config BR2_LZCAT
+       string "lzcat command"
+       default "lzip -d -c"
+       help
+         Command to be used to extract a lzip'ed file to stdout.
+         Default is "lzip -d -c"
+
 config BR2_TAR_OPTIONS
        string "Tar options"
        default ""
index 4db971b0cd8b9a8541824b8de4ebd8ca15615cd8..9663d15ee07dd99603e40cc6ed9658968576253e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -432,6 +432,7 @@ KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
 ZCAT := $(call qstrip,$(BR2_ZCAT))
 BZCAT := $(call qstrip,$(BR2_BZCAT))
 XZCAT := $(call qstrip,$(BR2_XZCAT))
+LZCAT := $(call qstrip,$(BR2_LZCAT))
 TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
 
 # packages compiled for the host go here
index 38d00dbbfb772582a6df22dc8786fdaa933984df..c95e77953b05edeeb872eb242d0ac9542b0375e3 100644 (file)
@@ -36,6 +36,7 @@ pkgname = $(lastword $(subst /, ,$(pkgdir)))
 # Define extractors for different archive suffixes
 INFLATE.bz2  = $(BZCAT)
 INFLATE.gz   = $(ZCAT)
+INFLATE.lz   = $(LZCAT)
 INFLATE.lzma = $(XZCAT)
 INFLATE.tbz  = $(BZCAT)
 INFLATE.tbz2 = $(BZCAT)
diff --git a/support/dependencies/check-host-lzip.mk b/support/dependencies/check-host-lzip.mk
new file mode 100644 (file)
index 0000000..6acfdc6
--- /dev/null
@@ -0,0 +1,5 @@
+ifeq (,$(call suitable-host-package,lzip,$(LZCAT)))
+DEPENDENCIES_HOST_PREREQ += host-lzip
+EXTRACTOR_DEPENDENCY_PRECHECKED_EXTENSIONS += .lz
+LZCAT = $(HOST_DIR)/usr/bin/lzip -d -c
+endif
diff --git a/support/dependencies/check-host-lzip.sh b/support/dependencies/check-host-lzip.sh
new file mode 100755 (executable)
index 0000000..4f8a2ba
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+candidate="$1"
+
+lzip=`which $candidate 2>/dev/null`
+if [ ! -x "$lzip" ]; then
+       lzip=`which lzip 2>/dev/null`
+       if [ ! -x "$lzip" ]; then
+               # echo nothing: no suitable lzip found
+               exit 1
+       fi
+fi
+
+echo $lzip