From patchwork Sun Dec 12 10:54:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allan McRae X-Patchwork-Id: 1991 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:56 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id gAU7AgDVtWFjTgUAK+/4rw (envelope-from ) for ; Sun, 12 Dec 2021 10:54:56 +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 E7367B3DBED; Sun, 12 Dec 2021 10:54:54 +0000 (UTC) Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id 4C8E7A83828; Sun, 12 Dec 2021 10:54:53 +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 [95.216.189.61]) by lists.archlinux.org (Postfix) with ESMTPS id 480DAA83821 for ; Sun, 12 Dec 2021 10:54:52 +0000 (UTC) From: Allan McRae DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1639306491; 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=4PP/wR8Mf7+XhSAzQ5X+4TieYDyDJ8dfKNcLDM09HVk=; b=upu8yx3AfimDi1TQ50Pppi88HupNuwIYzETYG5qMs6HAThFB3Ji0ZaYSIIKK6Cl8qSw45k nTlEUYYTfySkMyNkNJaxxi2GI6vDW1c6zCgJJXRmfPOB785+FtgRvI+ulTlVzvCii82VOK cHbfRiaXM9fxUgUyYIvJpe/kDIbH69H289jvuhfUE+7N/iG1wsdQT5/d825Vo9mx830P55 R16eRqZorYQ08jI/O+q9oyZOUkw1nbLVTIkApWpbovN07QOIar54XClu7mvJg2ptN2ukg+ Xl3Sb86+VgR4ACeiJja5dtfG/0z8E2XVfg1hwH4uDCXWmiH1J4BAE2y4WSA3Lzv4XwXzj7 MQ1UgNVu/M+3nL+x5pajPwQToMiD39LEWbElvpxx/q0H7oEYL6EpNgywd8qFkqyFKFYLnq UXGYV/WkVHamquYxLKtgCxWGVkHfFHzYIgyaNdoq8VlwEj4wtJIci0qH7Gq4+bGGuBMDS/ bDF9dr+bUiPhkAl4vP57rZwGqHI8Ymes6bkMCQwnvyEUSApD1/3aCNhW5RmLR0ic88c5JN dwCZh5kDBbdKkEKO05qFgDVdPTxbj3/E21D9T2LM5OHxA1/TAEkypPYNNUVmCRL7n6GutR dlFAcLbDVTNKkx5UYXR8VG+NZq36R3K63hOBj4hXWSm1fBrV3LxNU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1639306491; 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=4PP/wR8Mf7+XhSAzQ5X+4TieYDyDJ8dfKNcLDM09HVk=; b=YZVsK3e4DUxZAG+MQ3hHq6E5wLx8MXSJGCYvsYGx0vl9UGCcYKLOwfW1oevNr9DGm9alCz Kr+3L2deQeMAFpBw== To: pacman-dev@lists.archlinux.org Subject: [PATCH] makepkg: remove libdepends and libprovides Date: Sun, 12 Dec 2021 20:54:37 +1000 Message-Id: <20211212105440.1129363-2-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=upu8yx3A; dkim=pass header.d=archlinux.org header.s=dkim-ed25519 header.b=YZVsK3e4; 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: E7367B3DBED 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)[95.216.189.61:received,95.217.236.249:from]; R_DKIM_ALLOW(-0.20)[archlinux.org:s=dkim-rsa,archlinux.org:s=dkim-ed25519]; MAILLIST(-0.20)[mailman]; R_SPF_ALLOW(-0.20)[+ip4:95.217.236.249:c]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; MIME_TRACE(0.00)[0:+]; NEURAL_HAM(-0.00)[-1.000]; ASN(0.00)[asn:24940, ipnet:95.217.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; PREVIOUSLY_DELIVERED(0.00)[pacman-dev@lists.archlinux.org]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[archlinux.org:+]; TO_DN_NONE(0.00)[]; FROM_NEQ_ENVFROM(0.00)[allan@archlinux.org,pacman-dev-bounces@lists.archlinux.org]; RCPT_COUNT_ONE(0.00)[1]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Server: mail.archlinux.org This will be replaced by a better system Signed-off-by: Allan McRae --- doc/PKGBUILD.5.asciidoc | 9 --- scripts/makepkg.sh.in | 118 ---------------------------------------- 2 files changed, 127 deletions(-) diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index dee15f5e..4ca8eb3b 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -187,11 +187,6 @@ contain whitespace characters. than or equal to), `<=` (less than or equal to), `=` (equal to), `>` (greater than), or `<` (less than). + -If the dependency name appears to be a library (ends with .so), makepkg will -try to find a binary that depends on the library in the built package and -append the version needed by the binary. Appending the version yourself -disables automatic detection. -+ Additional architecture-specific depends can be added by appending an underscore and the architecture name e.g., 'depends_x86_64=()'. @@ -245,10 +240,6 @@ example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0' dependency of other packages. Provisions involving the `>` and `<` operators are invalid as only specific versions of a package may be provided. + -If the provision name appears to be a library (ends with .so), makepkg will -try to find the library in the built package and append the correct -version. Appending the version yourself disables automatic detection. -+ Additional architecture-specific provides can be added by appending an underscore and the architecture name e.g., 'provides_x86_64=()'. diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3c7977db..639ea84a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -463,121 +463,6 @@ run_package() { run_function_safe "package${1:+_$1}" } -find_libdepends() { - local d sodepends - - sodepends=0 - for d in "${depends[@]}"; do - if [[ $d = *.so ]]; then - sodepends=1 - break - fi - done - - if (( sodepends == 0 )); then - (( ${#depends[@]} )) && printf '%s\n' "${depends[@]}" - return 0 - fi - - local libdeps filename soarch sofile soname soversion - declare -A libdeps - - while IFS= read -rd '' filename; do - # get architecture of the file; if soarch is empty it's not an ELF binary - soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') - [[ -n "$soarch" ]] || continue - - # process all libraries needed by the binary - for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') - do - # extract the library name: libfoo.so - soname="${sofile%.so?(+(.+([0-9])))}".so - # extract the major version: 1 - soversion="${sofile##*\.so\.}" - - if [[ ${libdeps[$soname]} ]]; then - if [[ ${libdeps[$soname]} != *${soversion}-${soarch}* ]]; then - libdeps[$soname]+=" ${soversion}-${soarch}" - fi - else - libdeps[$soname]="${soversion}-${soarch}" - fi - done - done < <(find "$pkgdir" -type f -perm -u+x -print0) - - local libdepends v - for d in "${depends[@]}"; do - case "$d" in - *.so) - if [[ ${libdeps[$d]} ]]; then - for v in ${libdeps[$d]}; do - libdepends+=("$d=$v") - done - else - warning "$(gettext "Library listed in %s is not required by any files: %s")" "'depends'" "$d" - libdepends+=("$d") - fi - ;; - *) - libdepends+=("$d") - ;; - esac - done - - (( ${#libdepends[@]} )) && printf '%s\n' "${libdepends[@]}" -} - - -find_libprovides() { - local p versioned_provides libprovides missing - for p in "${provides[@]}"; do - missing=0 - versioned_provides=() - case "$p" in - *.so) - mapfile -t filename < <(find "$pkgdir" -type f -name $p\* | LC_ALL=C sort) - if [[ $filename ]]; then - # packages may provide multiple versions of the same library - for fn in "${filename[@]}"; do - # check if we really have a shared object - if LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then - # get the string binaries link to (e.g. libfoo.so.1.2 -> libfoo.so.1) - local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p') - if [[ -z "$sofile" ]]; then - warning "$(gettext "Library listed in %s is not versioned: %s")" "'provides'" "$p" - continue - fi - - # get the library architecture (32 or 64 bit) - local soarch=$(LC_ALL=C readelf -h "$fn" | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') - - # extract the library major version - local soversion="${sofile##*\.so\.}" - - versioned_provides+=("${p}=${soversion}-${soarch}") - else - warning "$(gettext "Library listed in %s is not a shared object: %s")" "'provides'" "$p" - fi - done - else - missing=1 - fi - ;; - esac - - if (( missing )); then - warning "$(gettext "Cannot find library listed in %s: %s")" "'provides'" "$p" - fi - if (( ${#versioned_provides[@]} > 0 )); then - libprovides+=("${versioned_provides[@]}") - else - libprovides+=("$p") - fi - done - - (( ${#libprovides[@]} )) && printf '%s\n' "${libprovides[@]}" -} - write_kv_pair() { local key="$1" shift @@ -617,9 +502,6 @@ write_pkginfo() { write_kv_pair "size" "$size" write_kv_pair "arch" "$pkgarch" - mapfile -t provides < <(find_libprovides) - mapfile -t depends < <(find_libdepends) - write_kv_pair "license" "${license[@]}" write_kv_pair "replaces" "${replaces[@]}" write_kv_pair "group" "${groups[@]}"