From patchwork Sun Dec 12 10:54:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allan McRae X-Patchwork-Id: 1992 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, 12 Dec 2021 10:54:59 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id TvI6OwLVtWFzTgUAK+/4rw (envelope-from ) for ; Sun, 12 Dec 2021 10:54:58 +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 4CBFCB3DC09; Sun, 12 Dec 2021 10:54:58 +0000 (UTC) Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id F31D9A83844; Sun, 12 Dec 2021 10:54:55 +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 A193BA83833 for ; Sun, 12 Dec 2021 10:54:54 +0000 (UTC) From: Allan McRae DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1639306494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qJ7ldJaQESRHFD2jc6nnkBWfdm4+lrzmsv9U3IMR8Hc=; b=VN2KcGnZK3Zg+oT7lBLhthqtFVOiuBuimxlgOYo4nBT8jGdY4mvC+a3XttNUJGCn3Ai7d0 WmOJvrtx7gn4owyq51800dkKylDqNudQGvf+RtpwEwuR29IWnpoaGbmi48N6ZdXRI6P7kW apvvjmdTd9aGa0EMZOG2y/U7SKwBShCWMFXJjLKKBcLnktB3Gg6bjD45aF/KUUDGmWLCTd KmSJ0pym05IiJkw6CGuzLR1QR6Nsu4bNx/3BgwfG7YJfBECKKDPvgxfAojBluJ0unRVN8m B9vHc7gKAUQvRRXGbgxiInZrCg8w42C50dviPiKlBSjsFAYxRiftTChIVPKKeTKdVummj9 SYB+/xuVlAx/0pMXEmvmTepj2jkJaWwDBSbqdA4QVWMKB2kPM0vnDA60sqs/MPPHlHvLZf 41qPCkDelw3r5/vmd0sbibep/VGWpQ5Eh2LAIIPZEUbcstenjGOV+bjt2yWURh9HCpSC3d MYCo8RG2zT79HOeXUG2usXZ3MzeB9bKjoU+2p7HC7LMY+PEjVLuSWjTe1fhDQAoBam8YZa i0NmpRj4bY7g20eaO4JNpCNBv50iNizkaH6TZxv1drY523M3/Doc8IWRd8Gc3BdYSrQefz zsdIORbM6cUR+epf4mrpgEBAn4EV/KM9ZLIXb8GUX69y+3nDrCPak= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1639306494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qJ7ldJaQESRHFD2jc6nnkBWfdm4+lrzmsv9U3IMR8Hc=; b=NKslKH1KtesLYuE1LD8D60C/wRE0yjSqTIb6MhSGDhdvKbWQmzlE4NQ2ocWLc+x5RaiZ9q RMp78lBVh108GjCQ== To: pacman-dev@lists.archlinux.org Subject: [PATCH] libmakepkg: add framework for autodeps Date: Sun, 12 Dec 2021 20:54:38 +1000 Message-Id: <20211212105440.1129363-3-allan@archlinux.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211212105440.1129363-1-allan@archlinux.org> References: <20211212105440.1129363-1-allan@archlinux.org> 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=VN2KcGnZ; dkim=pass header.d=archlinux.org header.s=dkim-ed25519 header.b=NKslKH1K; 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: 4CBFCB3DC09 X-Spamd-Result: default: False [-2.61 / 15.00]; DWL_DNSWL_MED(-2.00)[archlinux.org:dkim]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[archlinux.org,none]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCVD_IN_DNSWL_MED(-0.40)[2a01:4f9:c010:3052::1:received,95.217.236.249:from]; R_DKIM_ALLOW(-0.20)[archlinux.org:s=dkim-rsa,archlinux.org:s=dkim-ed25519]; R_SPF_ALLOW(-0.20)[+ip4:95.217.236.249:c]; MAILLIST(-0.20)[mailman]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:95.217.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; NEURAL_HAM(-0.00)[-1.000]; DKIM_TRACE(0.00)[archlinux.org:+]; PREVIOUSLY_DELIVERED(0.00)[pacman-dev@lists.archlinux.org]; FROM_NEQ_ENVFROM(0.00)[allan@archlinux.org,pacman-dev-bounces@lists.archlinux.org]; TO_DN_NONE(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Server: mail.archlinux.org Signed-off-by: Allan McRae --- etc/makepkg.conf.in | 6 +++-- scripts/libmakepkg/autodep.sh.in | 38 ++++++++++++++++++++++++++++++++ scripts/makepkg.sh.in | 1 + 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/autodep.sh.in diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 5ad3d490..f69a7add 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -76,7 +76,8 @@ BUILDENV=(!distcc color !ccache check !sign) # These are default values for the options=() settings ######################################################################### # -# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto) +# Makepkg defaults: +# OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto !autodeps) # A negated option will do the opposite of the comments below. # #-- strip: Strip symbols from binaries/libraries @@ -88,8 +89,9 @@ BUILDENV=(!distcc color !ccache check !sign) #-- purge: Remove files specified by PURGE_TARGETS #-- debug: Add debugging flags as specified in DEBUG_* variables #-- lto: Add compile flags for building with link time optimization +#-- autodeps: Automatically add depends/provides # -OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto) +OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto !autodeps) #-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2 INTEGRITY_CHECK=(ck) diff --git a/scripts/libmakepkg/autodep.sh.in b/scripts/libmakepkg/autodep.sh.in new file mode 100644 index 00000000..80f66e70 --- /dev/null +++ b/scripts/libmakepkg/autodep.sh.in @@ -0,0 +1,38 @@ +#!/bin/bash +# +# autodep.sh - functions for automatically adding depends/provides +# +# Copyright (c) 2021 Pacman Development Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +[[ -n "$LIBMAKEPKG_AUTODEP_SH" ]] && return +LIBMAKEPKG_AUTODEP_SH=1 + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +declare -a autodep_functions + +for lib in "$LIBRARY/autodep/"*.sh; do + source "$lib" +done + +readonly -a autodep_functions + +generate_autodeps() { + for func in ${autodep_functions[@]}; do + $func + done +} diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 639ea84a..818eb471 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -480,6 +480,7 @@ write_pkginfo() { local size=$(dirsize) merge_arch_attrs + generate_autodeps printf "# Generated by makepkg %s\n" "$makepkg_version" printf "# using %s\n" "$(fakeroot -v)"