From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E64E9138334 for ; Sat, 6 Oct 2018 11:18:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 79689E0917; Sat, 6 Oct 2018 11:17:57 +0000 (UTC) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 18B2EE084A for ; Sat, 6 Oct 2018 11:17:56 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id w21-v6so11043205lff.6 for ; Sat, 06 Oct 2018 04:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=M5K4hW2E6X2EfpIf3fob2//gaQzXZmM9FdBynmDI2qY=; b=Xt+/0Z8qlKDavrYRnUECXd9MWEDSxUsrPZ2jDjrmJpG0kQTl1+yzLncw5UB8V1JCdB 4egzNzIbArAP/0IRR7ibByuh+lb/N2dOFZeOx+0vWRCPvkP1zfAxKI9iYC8U2o/g4I96 SB8UssDzF6aso3RhGzWbBuFY59Mwbkd3FMixsaoYZIyG8oYqzCy6MU92B7ozPH/NT+O7 YeBzFXBgjdEccAUkG8wcZa53E8IHl+cxb4nnlcwp9wD3rbDHQKknLlE/C9ZxIMm3aDvm vmqvXN8cqUR5bLiRbcpcT+BfrAgjP1WKGaE5HNJRAsSQkSSun78gNoskaUgTGGxdsld3 Qhqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M5K4hW2E6X2EfpIf3fob2//gaQzXZmM9FdBynmDI2qY=; b=cNyIEJQMgQhvTLPUP2xakfT2U0JVq3ZwBNVOuJC3jJmBaPPKwdW5s4yS1x1Z0dW1Ee zjgTfawZdBSxrXW6R6AQ3dSvNGdfdbXMzJsSdOkAKmnj1oYQTqSAnWBIU5nioyC7bXP+ Dqk2W9JB9Ao/yyTlxZj8t3jbxkTznYvnXVXAbhgVBORC+kZIR6Ad1aCntfYhY90Y5oRB Den9HF8I+dLS/7t6kHofbiat1KqZmKuihaTATBUd9aBNwOXdx/kBxvG3smIEWNcXD1mT lGM4O2LCLQMSAcTgryKtyGt5cAEC8kDX1BeFXCDkItPZ2EdhVAFrvO0dqq8MdVKVN3iW Bqcg== X-Gm-Message-State: ABuFfoiGY+rNDeZx3qxF/ggPrQyoplJY6hquKAhboVnNY+lGkyRzbGOt p9pv5ch023qhDy4slb0OssWT/aTfNZM= X-Google-Smtp-Source: ACcGV62+4B2sTYQT/o376qW91Dh9WFTqyJEDLdcjH5G/lQwHPPbBzWuXXRBlPIJBvttDfB2qHMxMBw== X-Received: by 2002:a19:c650:: with SMTP id w77-v6mr9324121lff.108.1538824674819; Sat, 06 Oct 2018 04:17:54 -0700 (PDT) Received: from antonovka.local.uaprom ([91.195.214.232]) by smtp.gmail.com with ESMTPSA id k19-v6sm2436722lfi.51.2018.10.06.04.17.53 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 06 Oct 2018 04:17:54 -0700 (PDT) From: Mykyta Holubakha To: gentoo-dev@lists.gentoo.org Cc: Mykyta Holubakha Subject: [gentoo-dev] [RFC] [PATCH] appimage.eclass: new eclass Date: Sat, 6 Oct 2018 14:17:50 +0300 Message-Id: <20181006111750.34898-1-hilobakho@gmail.com> X-Mailer: git-send-email 2.15.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 96994d11-05ab-42f4-8029-77bd0d06aeda X-Archives-Hash: c5a7d09379386416d62bbb1380cd80e8 Signed-off-by: Mykyta Holubakha I'm proposing to add a new eclass: appimage.eclass, to facilitate extraction off AppImage bundles. The rationale is that some upstreams have migrated to distributing their proprietary software exclusively as AppImage bundles. (for instance dev-util/staruml-bin). An example ebuild can be seen at https://git.io/fx3Mg I'd like to ask the following questions: 1. Can I put myself and proxy-maint under @MAINTAINER (or do I need to find a gentoo dev)? 2. Are we OK with executing AppImage bundles downloaded from the Internet (an alternative would be to implement a proper extractor program, which would unpack the images without executing them, and add it to DEPENDs). Thanks --- eclass/appimage.eclass | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 eclass/appimage.eclass diff --git a/eclass/appimage.eclass b/eclass/appimage.eclass new file mode 100644 index 00000000000..454bdedc07b --- /dev/null +++ b/eclass/appimage.eclass @@ -0,0 +1,69 @@ +# Copyright 2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: appimage.eclass +# @MAINTAINER: +# maintainer-wanted@gentoo.org +# @AUTHOR: +# Mykyta Holubakha +# @BLURB: convenience eclass for extracting AppImage bundles +# @DESCRIPTION: +# This eclass provides a src_unpack function to extract AppImage bundles + +case "${EAPI:-0}" in + 6|7) + ;; + *) + die "EAPI ${EAPI:-0} is not supported" + ;; +esac + +EXPORT_FUNCTIONS src_unpack + +# @VARIABLE: APPIMAGE_EXTRACT_DIR +# @DEFAULT_UNSET: squashfs_root +# @DESCRIPTION: +# This variable specifies the directory, in which the AppImage bundle +# is expected to be extracted. + +# @VARIABLE: APPIMAGE_EXTRACT_DEST +# @DEFAULT_UNSET: ${P} +# @DESCRIPTION: +# This variable specifies the directory, to which the extracted image +# will be moved. + +# @FUNCTION: appimage_src_unpack +# @DESCRIPTION: +# Unpack all the AppImage bundles from ${A} (with .appimage extension). +# Other files are passed to regular unpack. +appimage_src_unpack() { + debug-print-function ${FUNCNAME} "${@}" + + local extract_dir="${APPIMAGE_EXTRACT_DIR:-squashfs-root}" + local extract_dest="${APPIMAGE_EXTRACT_DEST:-${P}}" + + local f + for f in ${A} + do + case "${f}" in + *.appimage|*.AppImage) + cp "${DISTDIR}/${f}" "${WORKDIR}" + debug-print "${FUNCNAME}: unpacking bundle ${f} to ${extract_dest}" + chmod +x "${f}" \ + || die "Failed to add execute permissions to bundle" + "${WORKDIR}/${f}" --appimage-help >/dev/null 2>/dev/null \ + || die "Invalid AppImage bundle" + "${WORKDIR}/${f}" --appimage-extract >/dev/null 2>/dev/null \ + || die "Failed to extract AppImage bundle" + rm -f "${f}" || die "Failed to remove bundle copy" + mv "${extract_dir}" "${extract_dest}" \ + || die "Failed to move AppImage bundle to destination" + ;; + *) + debug-print "${FUNCNAME}: falling back to unpack for ${f}" + unpack "${f}" + ;; + esac + done +} + -- 2.15.1