hooks/do-extract: support extracting .gem files with gem unpack.

This commit is contained in:
maxice8 2018-10-26 16:39:18 -03:00 committed by maxice8
parent f25eb64d42
commit c6c249348d
2 changed files with 11 additions and 0 deletions

View file

@ -55,6 +55,7 @@ hook() {
*.diff) cursufx="txt";; *.diff) cursufx="txt";;
*.txt) cursufx="txt";; *.txt) cursufx="txt";;
*.7z) cursufx="7z";; *.7z) cursufx="7z";;
*.gem) cursufx="gem";;
*) msg_error "$pkgver: unknown distfile suffix for $curfile.\n";; *) msg_error "$pkgver: unknown distfile suffix for $curfile.\n";;
esac esac
@ -119,6 +120,12 @@ hook() {
msg_error "$pkgver: cannot find 7z bin for extraction.\n" msg_error "$pkgver: cannot find 7z bin for extraction.\n"
fi fi
;; ;;
gem)
tar -xOf $srcdir/$curfile data.tar.gz | tar -xz -C $extractdir --transform="s,^,$(basename $wrksrc)/,"
if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi
;;
*) *)
msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n" msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n"
;; ;;

View file

@ -43,6 +43,7 @@ contents_cksum() {
*.diff) cursufx="txt";; *.diff) cursufx="txt";;
*.txt) cursufx="txt";; *.txt) cursufx="txt";;
*.7z) cursufx="7z";; *.7z) cursufx="7z";;
*.gem) cursufx="gem";;
*) msg_error "$pkgver: unknown distfile suffix for $curfile.\n";; *) msg_error "$pkgver: unknown distfile suffix for $curfile.\n";;
esac esac
@ -92,6 +93,9 @@ contents_cksum() {
msg_error "$pkgver: cannot find 7z bin for extraction.\n" msg_error "$pkgver: cannot find 7z bin for extraction.\n"
fi fi
;; ;;
gem)
cksum=$(tar -xf "$curfile" data.tar.gz --to-stdout | tar -xzO | sha256sum | awk '{print $1}')
;;
*) *)
msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n" msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n"
;; ;;