From nobody Sun May 12 21:21:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1632245740; cv=none; d=zohomail.com; s=zohoarc; b=M20c7hm6mNqoiRy0RwtNHoKeTNkWXwlYDQqDpSTR3nJTEgfiKePLECauKKUuZudAsvUEMskcQhqt4lbiRLiLd19WPZFvkj+QtwIFSv1n2hg3UDBnulZtF3WkDzHi6itai8QFJNhkOd1Rbsbf54+UBMhdTcXSyx0VA01yPS2O89E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632245740; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VBkHK+jIphvyYhTiMhVbisVI7GizSue1GCtOOrLO9RE=; b=f+v3O2tWynKskx00Yx+V4XgyGAHgK/whx/GhsVIDgDUfpYU9DElHCEDjWgzmV9nWaOlMGTYjDW5oqWhnRTjlQfEPqei0JKG35vg9eVqGk14f89yRd4Ex6KRbRBB1q9XPKOJ6yDoelHVrnSJxDJv7R3dLrC1zOtswMaY3JeWVKp0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1632245740067777.7150588310219; Tue, 21 Sep 2021 10:35:40 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-CJOeUz70NduvPAAUU_yv-A-1; Tue, 21 Sep 2021 13:35:37 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0BF2101AFA7; Tue, 21 Sep 2021 17:35:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C229F1869D; Tue, 21 Sep 2021 17:35:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7D2681803B30; Tue, 21 Sep 2021 17:35:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18LHV9N6022091 for ; Tue, 21 Sep 2021 13:31:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id D9130604CC; Tue, 21 Sep 2021 17:31:09 +0000 (UTC) Received: from nautilus.local (unknown [10.40.192.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3373612D4A; Tue, 21 Sep 2021 17:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632245738; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VBkHK+jIphvyYhTiMhVbisVI7GizSue1GCtOOrLO9RE=; b=SAsuO3SEmjvC1KpcX8H9coMSXtdyTFAV284mCeI2ziwcqp5VnJx8SByx1aFZarjWdFM0XC 7wARc4zYo5JGAsJp0ZsvFPAtjK1zMgPgDfkt+xM7b3YFpdCRdhQwZp2xih7tbDYqE1J9D0 Ez+JW3D+UAq4v89uA/0xx0O4e9tgK7I= X-MC-Unique: CJOeUz70NduvPAAUU_yv-A-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH 1/1] libvirt.spec.in: Replace %global with %define Date: Tue, 21 Sep 2021 19:30:29 +0200 Message-Id: <21c26cba3ef3025d19cd58481f885b699f785bcd.1632245413.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632245741410100001 Content-Type: text/plain; charset="utf-8" Commit b5e8db8f14d tuned the SPEC file so that libvirt daemons restart on package upgrade. In order to do that it added a bunch of parametrized macros using the %global directive. This caused a problem when running RPM builds on CentOS Stream 8 resulting in: error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration. error: Macro %libvirt_daemon_perform_restart failed to expand error: line 1275: %global libvirt_daemon_perform_restart() \ if test %libvirt_daemon_needs_restart %1 \ then \ /bin/systemctl try-restart %1.service >/dev/null 2>&1 || : \ fi \ %libvirt_daemon_finish_restart %1 There are 2 important differences between %global and %define directives: 1) %define is local-only and does have scope - in reality though, its scope is apparently not really enforced because it behaves exactly the same way as %global 2) %define is evaluated at the of use while %global is evaluated at the time of definition The latter and the fact the macro is parametrized is the reason why the RPM builds fails on CentOS. Strangely enough this only happens on CentOS Stream, but not Fedora (which is also the main proponent of replacing %define with %global). Anyhow, replacing %global with %define makes the rpmbuild to pass on both and along with package upgrades. Signed-off-by: Erik Skultety Reviewed-by: Michal Privoznik --- libvirt.spec.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 624b0e0302..1725e5eb14 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1259,28 +1259,28 @@ mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libv= irt_qemu_probes.stp \ # raising the test timeout VIR_TEST_DEBUG=3D1 %meson_test --no-suite syntax-check --timeout-multiplie= r 10 =20 -%global libvirt_daemon_schedule_restart() mkdir -p %{_localstatedir}/lib/r= pm-state/libvirt || : \ +%define libvirt_daemon_schedule_restart() mkdir -p %{_localstatedir}/lib/r= pm-state/libvirt || : \ /bin/systemctl is-active %1.service 1>/dev/null 2>&1 && \ touch %{_localstatedir}/lib/rpm-state/libvirt/restart-%1 || : =20 -%global libvirt_daemon_finish_restart() rm -f %{_localstatedir}/lib/rpm-st= ate/libvirt/restart-%1 \ +%define libvirt_daemon_finish_restart() rm -f %{_localstatedir}/lib/rpm-st= ate/libvirt/restart-%1 \ rmdir %{_localstatedir}/lib/rpm-state/libvirt 2>/dev/null || : =20 -%global libvirt_daemon_needs_restart() -f %{_localstatedir}/lib/rpm-state/= libvirt/restart-%1 +%define libvirt_daemon_needs_restart() -f %{_localstatedir}/lib/rpm-state/= libvirt/restart-%1 =20 -%global libvirt_daemon_perform_restart() if test %libvirt_daemon_needs_res= tart %1 \ +%define libvirt_daemon_perform_restart() if test %libvirt_daemon_needs_res= tart %1 \ then \ /bin/systemctl try-restart %1.service >/dev/null 2>&1 || : \ fi \ %libvirt_daemon_finish_restart %1 =20 -%global libvirt_daemon_systemd_post() %systemd_post %1.socket %1-ro.socket= %1-admin.socket %1.service +%define libvirt_daemon_systemd_post() %systemd_post %1.socket %1-ro.socket= %1-admin.socket %1.service =20 -%global libvirt_daemon_systemd_post_inet() %systemd_post %1.socket %1-ro.s= ocket %1-admin.socket %1-tls.socket %1-tcp.socket %1.service +%define libvirt_daemon_systemd_post_inet() %systemd_post %1.socket %1-ro.s= ocket %1-admin.socket %1-tls.socket %1-tcp.socket %1.service =20 -%global libvirt_daemon_systemd_preun() %systemd_preun %1.service %1-ro.soc= ket %1-admin.socket %1.socket +%define libvirt_daemon_systemd_preun() %systemd_preun %1.service %1-ro.soc= ket %1-admin.socket %1.socket =20 -%global libvirt_daemon_systemd_preun_inet() %systemd_preun %1.service %1-r= o.socket %1-admin.socket %1-tls.socket %1-tcp.socket %1.socket +%define libvirt_daemon_systemd_preun_inet() %systemd_preun %1.service %1-r= o.socket %1-admin.socket %1-tls.socket %1-tcp.socket %1.socket =20 %pre daemon # 'libvirt' group is just to allow password-less polkit access to --=20 2.31.1