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

Diff of /eclass/unpacker.eclass

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

Revision 1.10 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.10 2012/08/22 01:41:12 ottxor 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
272 else 272 else
273 ar x "${deb}" 273 ar x "${deb}"
274 fi 274 fi
275 275
276 unpacker ./data.tar* 276 unpacker ./data.tar*
277
278 # Clean things up #458658. No one seems to actually care about
279 # these, so wait until someone requests to do something else ...
280 rm -f debian-binary {control,data}.tar*
277} 281}
278 282
279# @FUNCTION: unpack_cpio 283# @FUNCTION: unpack_cpio
280# @USAGE: <one cpio to unpack> 284# @USAGE: <one cpio to unpack>
281# @DESCRIPTION: 285# @DESCRIPTION:
291 else 295 else
292 local cpio=$(find_unpackable_file "$1") 296 local cpio=$(find_unpackable_file "$1")
293 unpack_banner "${cpio}" 297 unpack_banner "${cpio}"
294 "${cpio_cmd[@]}" <"${cpio}" 298 "${cpio_cmd[@]}" <"${cpio}"
295 fi 299 fi
300}
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)"
296} 317}
297 318
298# @FUNCTION: _unpacker 319# @FUNCTION: _unpacker
299# @USAGE: <one archive to unpack> 320# @USAGE: <one archive to unpack>
300# @INTERNAL 321# @INTERNAL
344 # Makeself archives can be annoyingly named 365 # Makeself archives can be annoyingly named
345 if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then 366 if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then
346 arch="unpack_makeself" 367 arch="unpack_makeself"
347 fi 368 fi
348 ;; 369 ;;
370 *.zip)
371 arch="unpack_zip" ;;
349 esac 372 esac
350 373
351 # finally do the unpack 374 # finally do the unpack
352 if [[ -z ${arch}${comp} ]] ; then 375 if [[ -z ${arch}${comp} ]] ; then
353 unpack "$1" 376 unpack "$1"
408 d="app-arch/unrar" ;; 431 d="app-arch/unrar" ;;
409 *.7z) 432 *.7z)
410 d="app-arch/p7zip" ;; 433 d="app-arch/p7zip" ;;
411 *.xz) 434 *.xz)
412 d="app-arch/xz-utils" ;; 435 d="app-arch/xz-utils" ;;
436 *.zip)
437 d="app-arch/unzip" ;;
413 esac 438 esac
414 deps+=" ${d}" 439 deps+=" ${d}"
415 done 440 done
416 441
417 echo "${deps}" 442 echo "${deps}"

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

  ViewVC Help
Powered by ViewVC 1.1.20