/[gentoo-x86]/eclass/unpacker.eclass
Gentoo

Diff of /eclass/unpacker.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.11 Revision 1.12
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.11 2013/03/23 19:35:59 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.12 2013/03/23 21:18:25 hasufell Exp $
4 4
5# @ECLASS: unpacker.eclass 5# @ECLASS: unpacker.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: helpers for extraneous file formats and consistent behavior across EAPIs 8# @BLURB: helpers for extraneous file formats and consistent behavior across EAPIs
297 unpack_banner "${cpio}" 297 unpack_banner "${cpio}"
298 "${cpio_cmd[@]}" <"${cpio}" 298 "${cpio_cmd[@]}" <"${cpio}"
299 fi 299 fi
300} 300}
301 301
302# @FUNCTION: unpack_zip
303# @USAGE: <zip file>
304# @DESCRIPTION:
305# Unpack zip archives.
306# This function ignores all non-fatal errors (i.e. warnings).
307# That is useful for zip archives with extra crap attached
308# (e.g. self-extracting archives).
309unpack_zip() {
310 [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>"
311
312 local zip=$(find_unpackable_file "$1")
313 unpack_banner "${zip}"
314 unzip -qo "${zip}"
315
316 [[ $? -le 1 ]] || die "unpacking ${zip} failed (arch=unpack_zip)"
317}
318
302# @FUNCTION: _unpacker 319# @FUNCTION: _unpacker
303# @USAGE: <one archive to unpack> 320# @USAGE: <one archive to unpack>
304# @INTERNAL 321# @INTERNAL
305# @DESCRIPTION: 322# @DESCRIPTION:
306# Unpack the specified archive. We only operate on one archive here 323# Unpack the specified archive. We only operate on one archive here
348 # Makeself archives can be annoyingly named 365 # Makeself archives can be annoyingly named
349 if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then 366 if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then
350 arch="unpack_makeself" 367 arch="unpack_makeself"
351 fi 368 fi
352 ;; 369 ;;
370 *.zip)
371 arch="unpack_zip" ;;
353 esac 372 esac
354 373
355 # finally do the unpack 374 # finally do the unpack
356 if [[ -z ${arch}${comp} ]] ; then 375 if [[ -z ${arch}${comp} ]] ; then
357 unpack "$1" 376 unpack "$1"
412 d="app-arch/unrar" ;; 431 d="app-arch/unrar" ;;
413 *.7z) 432 *.7z)
414 d="app-arch/p7zip" ;; 433 d="app-arch/p7zip" ;;
415 *.xz) 434 *.xz)
416 d="app-arch/xz-utils" ;; 435 d="app-arch/xz-utils" ;;
436 *.zip)
437 d="app-arch/unzip" ;;
417 esac 438 esac
418 deps+=" ${d}" 439 deps+=" ${d}"
419 done 440 done
420 441
421 echo "${deps}" 442 echo "${deps}"

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20