From patchwork Thu May 7 18:13:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wouter Wijsman X-Patchwork-Id: 1626 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 6B98A18A24AE6 for ; Thu, 7 May 2020 18:14:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=DMARC_FAIL_NONE=0.25, FREEMAIL_FROM=0.5,MAILING_LIST_MULTI=-1,MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01, T_DMARC_TESTS_FAIL=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Thu, 7 May 2020 18:14:04 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 6AEF41B960F9BD; Thu, 7 May 2020 18:13:51 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 2C51B1B960F9B7; Thu, 7 May 2020 18:13:51 +0000 (UTC) Authentication-Results: orion.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 163AA29CD4; Thu, 7 May 2020 18:13:51 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id F2A7C29CD3 for ; Thu, 7 May 2020 18:13:46 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Thu, 7 May 2020 18:13:46 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id C7C711B960F9B5 for ; Thu, 7 May 2020 18:13:44 +0000 (UTC) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-oln040092068024.outbound.protection.outlook.com [40.92.68.24]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Thu, 7 May 2020 18:13:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=baWGIxIEu9rhK/lzJ2sjx1Jm4xJf3KgzhxjtnHX07e7r1J9/ucYmbdlaj8yTmxe13NS4K3UZzogGl/4KiW09ZHsXd8GpNNT4j5JIBC9rN2ZI/qIGGKkSQaG4yGc7yQAYRmUNsA8OsI8t0JFg6gQUSZeYbww9QjLI8gyBniTMDDUS7ORYxIthNNNIvjLaNAElEPSHjbvRDeWOQBwfffl8RsL0RAI+ZaTN7b6qPYC33r3S8vIb7j2DFP156hz53njqX7NFOdKt0mOKgGi4T1gHVx+uD+D4EPhZ1ugelahpphKzTurkdoECNgrN5RqpGZI1qKKYjVMQP49gWmTtI88g/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BVJK5h5yLfn6qaXiSV2rdoci9miwTt7LzGuvPR6vTsU=; b=CpgFUITaWyLxLtnQ+dq885MSBcNDmoHxoALIP89cAtD4pCf9we+GmwZqDAlcMRZkxfsUe42F/3szkh7AioD+3I4OgcUMR37dWYc6lkdrymw+WymNXjNgHAvZtVZZGIvd0YzEfxpdMbHWpn9O0jmQJs5kz9kSSlzAMItVH9PuIZa7k0DYTOlUmUuKsrGxtoyqN9kbaHTqBfY0OSrZbZUqOT/r5daHSAbLGn3MDm1fy52sOUqD20uQtueZv8FxJPxIduUHFALQ2dSKgtZu/adAN15wsw93pJZt7jVmYRbOOZYVAKl4xHc/npk6N2M0y+O3DlJLKjfqhWVCjxHKMCZ/2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.nl; dmarc=pass action=none header.from=live.nl; dkim=pass header.d=live.nl; arc=none Received: from AM5EUR02FT057.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::48) by AM5EUR02HT140.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::321) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27; Thu, 7 May 2020 18:13:43 +0000 Received: from DB7PR10MB2508.EURPRD10.PROD.OUTLOOK.COM (2a01:111:e400:7e1c::4b) by AM5EUR02FT057.mail.protection.outlook.com (2a01:111:e400:7e1c::498) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27 via Frontend Transport; Thu, 7 May 2020 18:13:43 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:BC53EC673C26C7D883AE46FED36A7CCE7953E192B391C1BAA1103B5F3489677B; UpperCasedChecksum:93E4051631B7D9E759FB3087947CB1C545DF293E0D7D364074EE2F335254ECA5; SizeAsReceived:7407; Count:48 Received: from DB7PR10MB2508.EURPRD10.PROD.OUTLOOK.COM ([fe80::28c2:2f5b:dd0a:400]) by DB7PR10MB2508.EURPRD10.PROD.OUTLOOK.COM ([fe80::28c2:2f5b:dd0a:400%6]) with mapi id 15.20.2958.034; Thu, 7 May 2020 18:13:43 +0000 From: Wouter Wijsman To: pacman-dev@archlinux.org Date: Thu, 7 May 2020 20:13:32 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 X-ClientProxiedBy: AM0P190CA0019.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::29) To DB7PR10MB2508.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:4c::28) X-Microsoft-Original-Message-ID: <20200507181332.27343-1-wwijsman@live.nl> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.197.214.235) by AM0P190CA0019.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.29 via Frontend Transport; Thu, 7 May 2020 18:13:42 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200507181332.27343-1-wwijsman@live.nl> X-TMN: [F5m7HD+eIkAFo6K/N4t9bc1NSdoVcy+w] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: fc1ec018-5249-48c7-237b-08d7f2b26053 X-MS-TrafficTypeDiagnostic: AM5EUR02HT140: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2CQ1RfJBH2wJ6oZw5pt+Dm8y/S384+L5CzRAvsLzJY/yrSKbohCG3XMqheIduatPiVZ/CTkneGVOB2N8+o4Ze9Ezc99vD9uL4RnHxsZqKclFDr6HK5aS1Kgd4ERa2ojSz1Tx9W00aHVWk0PFeCjomWlpD9DsPUdHo9eElIP9I7QfiCD7UYi394ViJF0MphYa2Faw5l02bP106ffS3x2pmw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:0; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR10MB2508.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:; DIR:OUT; SFP:1901; X-MS-Exchange-AntiSpam-MessageData: Q9vJiRQpGJL2JOP9dGwAJzhut9Q8b2TdQjrFvzM6GZs5743ErABg+IyZTAsCFlQ/ezFCAUaX5H4hA1KBwLE/tzTkPG/20Cc4mdjAM7UBWOa2RduuAXx1J0ENo2+Tkl9eo6C1BeURkoKuS4KMYYEHTQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc1ec018-5249-48c7-237b-08d7f2b26053 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2020 18:13:43.7622 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT140 Subject: [pacman-dev] [PATCH] Use absolute path for pacman and pacman-conf in makepkg X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Discussion list for pacman development Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" Currently makepkg requires pacman and pacman-conf to be in the path of the user. Since these executables should never move, it should be safe to add the full paths to the scripts at compile time, assuming the user uses the install command as well. This change works for both autotools and meson. Signed-off-by: Wouter Wijsman --- build-aux/edit-script.sh.in | 1 + meson.build | 1 + scripts/Makefile.am | 3 ++- scripts/makepkg.sh.in | 6 ++++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build-aux/edit-script.sh.in b/build-aux/edit-script.sh.in index 661c22d5..44103f08 100644 --- a/build-aux/edit-script.sh.in +++ b/build-aux/edit-script.sh.in @@ -20,6 +20,7 @@ mode=$3 -e "s|@DEBUGSUFFIX[@]|@DEBUGSUFFIX@|g" \ -e "s|@INODECMD[@]|@INODECMD@|g" \ -e "s|@FILECMD[@]|@FILECMD@|g" \ + -e "s|@fullbindir[@]|@FULLBINDIR@|g" \ "$input" >"$output" if [[ $mode ]]; then diff --git a/meson.build b/meson.build index 680cf62b..92e8a9a5 100644 --- a/meson.build +++ b/meson.build @@ -257,6 +257,7 @@ substs.set('LOCALEDIR', LOCALEDIR) substs.set('sysconfdir', SYSCONFDIR) substs.set('localstatedir', LOCALSTATEDIR) substs.set('PKGDATADIR', PKGDATADIR) +substs.set('FULLBINDIR', '@0@/@1@'.format(PREFIX, get_option('bindir'))) substs.set('PREFIX', PREFIX) substs.set('BASH', BASH.path()) substs.set('PACKAGE_VERSION', PACKAGE_VERSION) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 47455ed2..a79e9389 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -182,7 +182,8 @@ edit = sed \ -e 's|@DEBUGSUFFIX[@]|$(DEBUGSUFFIX)|g' \ -e "s|@INODECMD[@]|$(INODECMD)|g" \ -e "s|@FILECMD[@]|$(FILECMD)|g" \ - -e 's|@SCRIPTNAME[@]|$@|g' + -e 's|@SCRIPTNAME[@]|$@|g' \ + -e 's|@fullbindir[@]|$(FULLBINDIR)|g' ## All the scripts depend on Makefile so that they are rebuilt when the ## prefix etc. changes. Use chmod -w to prevent people from editing the diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d1416d15..2f7b838e 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,6 +44,8 @@ declare -r makepkg_version='@PACKAGE_VERSION@' declare -r confdir='@sysconfdir@' declare -r BUILDSCRIPT='@BUILDSCRIPT@' declare -r startdir="$(pwd -P)" +declare -r PACMAN_EXECUTABLE='@fullbindir@/pacman' +declare -r PACMAN_CONF_EXECUTABLE='@fullbindir@/pacman-conf' LIBRARY=${LIBRARY:-'@libmakepkgdir@'} @@ -235,7 +237,7 @@ run_pacman() { else cmd=(su root -c "$(printf '%q ' "${cmd[@]}")") fi - local lockfile="$(pacman-conf DBPath)/db.lck" + local lockfile="$(${PACMAN_CONF_EXECUTABLE} DBPath)/db.lck" while [[ -f $lockfile ]]; do local timer=0 msg "$(gettext "Pacman is currently in use, please wait...")" @@ -1123,7 +1125,7 @@ unset var PACKAGER=${PACKAGER:-"Unknown Packager"} # set pacman command if not already defined -PACMAN=${PACMAN:-pacman} +PACMAN=${PACMAN:-${PACMAN_EXECUTABLE}} # save full path to command as PATH may change when sourcing /etc/profile PACMAN_PATH=$(type -P $PACMAN)