From patchwork Sun Dec 19 17:49:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Linderud X-Patchwork-Id: 1995 Return-Path: Delivered-To: patchwork@archlinux.org Received: from mail.archlinux.org [2a01:4f9:c010:3052::1] by patchwork.archlinux.org with IMAP (fetchmail-6.4.24) for (single-drop); Sun, 19 Dec 2021 17:49:34 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id oEXdLa1wv2E03gkAK+/4rw (envelope-from ) for ; Sun, 19 Dec 2021 17:49:33 +0000 Received: from lists.archlinux.org (lists.archlinux.org [95.217.236.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.archlinux.org (Postfix) with ESMTPS id 96AFBB71DDA; Sun, 19 Dec 2021 17:49:32 +0000 (UTC) Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id 7DB6AABEDFA; Sun, 19 Dec 2021 17:49:32 +0000 (UTC) X-Original-To: pacman-dev@lists.archlinux.org Delivered-To: pacman-dev@lists.archlinux.org Received: from mail.archlinux.org (mail.archlinux.org [IPv6:2a01:4f9:c010:3052::1]) by lists.archlinux.org (Postfix) with ESMTPS id 7DE33ABEDE9 for ; Sun, 19 Dec 2021 17:49:29 +0000 (UTC) From: Morten Linderud DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1639936168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=mW8n0DRS7SS/7qtEHHYAGfmpQgWtWCF0D6Z5ftIiDpc=; b=CJ2oBUP4axnF1ViMr3m6+16Trt154PAlzDb0DlODHhFygwuJXXXwmxUM02DQDfuIG6Dosp R2RNJ8oYf2Gb6ygE1xGNJmZcWU6O3ww1RPkK2xYu4Gud2IlGqreDFIE+0DB3fCkXVdNyxm Xu+4r9Z3Ao5exUVpnqxCikwRnZU/B9eBXwM1oOrNsLuPsy39X+arGra6n9QZvUJuzg6cVB uDzCQ/KrCv7LV4WqbItqa7H7nLU7m5NMHPyO737fSFrOqL/lZNgZMtxi8/6N6+lQ6lsx8/ baFJbVP0fAzHy44VMP1mBIIg0ULANGuem79CjsR0SqqVW0iA5qHr2sPpjhw0hxyL3VK9iw 68CLJrO7AxbK8otm86sqRIwXQp6MbNE3aj/e9QDvyo5rIYEg68YOXU72ES1Gu6rLd4AHLT V1+qPQgmAapfQzch8xTI2qYpjqD/+mgLv0uS2E5DYmu5bTqmPqZscidaAIXiP0GvzXV56d 4fAWbLW2k7eJVAqRdlZ3odoEfhnt0glMQMIziTmRAf5YWsBZvcTh31/554j+KEHLAxi+uM D7PO4hEGNCm3VQESUTpN5Hc/LqBNiL1vw1yGXH3F/6jC5P82VyAnx8Y2kc7DlJ5ZG3zE9x +NoqB8Ju7iyedQ0y6ahjRMdfwjfh35QUB/YApK2Fesy5xp0dEgEx0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1639936169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=mW8n0DRS7SS/7qtEHHYAGfmpQgWtWCF0D6Z5ftIiDpc=; b=sgJgSrDWoX78/mtcsnCX8sVhYirFnhduUQm+Cgj349bex/qwqvJSDXzxA8H4MXhUaQYp9w XLZFp/AWt0rKBoCg== To: pacman-dev@lists.archlinux.org Cc: Morten Linderud Subject: [PATCH] makepkg: Implement pkgtype in .PKGINFO Date: Sun, 19 Dec 2021 18:49:04 +0100 Message-Id: <20211219174904.542634-1-foxboron@archlinux.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: pacman-dev@lists.archlinux.org X-Mailman-Version: 2.1.38 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pacman-dev-bounces@lists.archlinux.org Sender: "pacman-dev" Authentication-Results: mail.archlinux.org; dkim=pass header.d=archlinux.org header.s=dkim-rsa header.b=CJ2oBUP4; dkim=pass header.d=archlinux.org header.s=dkim-ed25519 header.b=sgJgSrDW; dmarc=pass (policy=none) header.from=archlinux.org; spf=pass (mail.archlinux.org: domain of pacman-dev-bounces@lists.archlinux.org designates 95.217.236.249 as permitted sender) smtp.mailfrom=pacman-dev-bounces@lists.archlinux.org X-Rspamd-Queue-Id: 96AFBB71DDA X-Spamd-Result: default: False [-2.61 / 15.00]; DWL_DNSWL_MED(-2.00)[archlinux.org:dkim]; MID_CONTAINS_FROM(1.00)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; DMARC_POLICY_ALLOW(-0.50)[archlinux.org,none]; R_MISSING_CHARSET(0.50)[]; RCVD_IN_DNSWL_MED(-0.40)[2a01:4f9:c010:3052::1:received,95.217.236.249:from]; MAILLIST(-0.20)[mailman]; R_SPF_ALLOW(-0.20)[+ip4:95.217.236.249:c]; R_DKIM_ALLOW(-0.20)[archlinux.org:s=dkim-rsa,archlinux.org:s=dkim-ed25519]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[pacman-dev@lists.archlinux.org]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:24940, ipnet:95.217.0.0/16, country:DE]; DKIM_TRACE(0.00)[archlinux.org:+]; RCVD_COUNT_THREE(0.00)[3]; FROM_NEQ_ENVFROM(0.00)[foxboron@archlinux.org,pacman-dev-bounces@lists.archlinux.org]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; NEURAL_HAM(-0.00)[-1.000]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Server: mail.archlinux.org From: Morten Linderud This implements pkgtype into .PKGINFO. This is useful to ensure tools parsing packages do not miss important context on the creation of the package. For instance discovering if a given .pkg.tar is a debug package, one would have to do heuristics on the pkgdesc and "${pkgbase}-debug". However both of these values are controlled by the packager. Similarly, the heuristic for discovering split packages is if pkgbase and pkgname differ, which can happen in any package as both values are packager controlled. This should ensure we don't need to rely on heuristics and instead include the context of how the package was created. Signed-off-by: Morten Linderud --- scripts/makepkg.sh.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3c7977db..9f5fd401 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -601,6 +601,7 @@ write_pkginfo() { write_kv_pair "pkgname" "$pkgname" write_kv_pair "pkgbase" "$pkgbase" + write_kv_pair "pkgtype" "$pkgtype" local fullver=$(get_full_version) write_kv_pair "pkgver" "$fullver" @@ -681,6 +682,8 @@ list_package_files() { create_package() { (( NOARCHIVE )) && return 0 + pkgtype=${pkgtype:-pkg} + if [[ ! -d $pkgdir ]]; then error "$(gettext "Missing %s directory.")" "\$pkgdir/" plainerr "$(gettext "Aborting...")" @@ -765,6 +768,7 @@ create_debug_package() { pkgdesc="Detached debugging symbols for $pkgname" pkgname=$pkgbase-@DEBUGSUFFIX@ + pkgtype=debug create_package } @@ -775,6 +779,8 @@ create_srcpackage() { local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)" mkdir "${srclinks}"/${pkgbase} + pkgtype=src + msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT" ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}" @@ -950,6 +956,7 @@ run_single_packaging() { run_split_packaging() { local pkgname_backup=("${pkgname[@]}") + pkgtype=split backup_package_variables for pkgname in ${pkgname_backup[@]}; do run_single_packaging $pkgname