Blob Blame History Raw
From a2aefc2276e124b1c329a722ed43cf7fcf7f473f Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzeleny@redhat.com>
Date: Wed, 30 Jul 2014 10:00:26 +0200
Subject: [PATCH] Modified the behavior of debuginfo generation process

* add correct dependencies to debuginfo packages.
* add conditional definition of __debug_package macro
  (allow turning debuginfor packages off)
* remove automatic creation of debuginfo for metapackage
---
 macros.scl | 51 ++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 17 deletions(-)

diff --git a/macros.scl b/macros.scl
index d344b5e80f4fa6d97c7243df2f40847303eb26df..db85a5002f831e5e319152db8eba6e9e92efec82 100644
--- a/macros.scl
+++ b/macros.scl
@@ -3,6 +3,39 @@
 # Copyright (C) 2012 Red Hat, Inc.
 #   Written by Jindrich Novy <jnovy@redhat.com>.
 
+%scl_debug() %{expand:
+%define old_debug %{lua:print(rpm.expand("%{debug_package}"):len())}
+%global debug_package %{expand:
+%if "%{?old_debug}" == "0"
+       %{expand: %{nil}}
+%else
+%if "%{?scl}%{!?scl:0}" == "%{pkg_name}"
+        %{expand: %{nil}}
+%else
+%ifnarch noarch
+%package debuginfo
+Summary: Debug information for package %{name}
+Group: Development/Debug
+AutoReqProv: 0
+Requires: %scl_runtime
+Provides: scl-package(%scl)
+%{lua:
+        debuginfo=tonumber(rpm.expand("%{old_debug}"))
+        if debuginfo > 0 then
+                rpm.define("__debug_package 1")
+        end
+}
+%description debuginfo
+This package provides debug information for package %{name}.
+Debug information is useful when developing applications that use this
+package or when debugging this package.
+%files debuginfo -f debugfiles.list
+%defattr(-,root,root)
+%endif
+%endif
+%endif
+%{nil}}}
+
 %scl_package() %{expand:%{!?_root_prefix:
 %global pkg_name		%1
 %global scl_name		%{scl}
@@ -42,6 +75,7 @@
 %global _defaultdocdir		%{_docdir}
 }
 %global scl_pkg_name		%{scl}-%{pkg_name}
+%scl_debug
 %global __os_install_post %{expand:
     /usr/lib/rpm/brp-scl-compress %{_scl_root}
     %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}
@@ -52,23 +86,6 @@
     /usr/lib/rpm/redhat/brp-python-hardlink
     %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars}
 %{nil}}
-%global debug_package %{expand:
-%ifnarch noarch
-%global __debug_package 1
-%package debuginfo
-Summary: Debug information for package %{name}
-Group: Development/Debug
-AutoReqProv: 0
-Requires: %scl_runtime
-Provides: scl-package(%scl)
-%description debuginfo
-This package provides debug information for package %{name}.
-Debug information is useful when developing applications that use this
-package or when debugging this package.
-%files debuginfo -f debugfiles.list
-%defattr(-,root,root)
-%endif
-%{nil}}
 BuildRequires: scl-utils-build
 %if "%{?scl}%{!?scl:0}" == "%{pkg_name}"
 Requires: %{scl_runtime}
-- 
1.9.3