public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] scripts/find-debuginfo.in: Add -q|--quiet
@ 2023-01-26 21:08 Prarit Bhargava
  2023-01-27 17:38 ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Prarit Bhargava @ 2023-01-26 21:08 UTC (permalink / raw)
  To: debugedit; +Cc: Prarit Bhargava

Projects with a large number of compiled files end up with a large number
of 'extracting debug info from' messages in the build log.  In the case of
the Fedora kernel these messages account for 8504 lines in the log, or 61%
of the entire log [1].

Removing these lines make the log easier to view and comprehend for some
projects, however, not all projects will want to silence these messages so
suppressing them must be optional.

Add a -q|--quiet which allows users to silence the non-error output from
the script.

[1] https://kojipkgs.fedoraproject.org//packages/kernel/6.2.0/0.rc5.20230123git2475bf0250de.38.fc38/data/logs/x86_64/build.log

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 scripts/find-debuginfo.in | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
index b07a52fe4b98..e55a62cc78f1 100755
--- a/scripts/find-debuginfo.in
+++ b/scripts/find-debuginfo.in
@@ -26,7 +26,7 @@ Usage: find-debuginfo [OPTION]... [builddir]
 automagically generates debug info and file lists
 
 Options:
-[--strict-build-id] [-g] [-r] [-m] [-i] [-n]
+[--strict-build-id] [-g] [-r] [-m] [-i] [-n] [-q]
 [--keep-section SECTION] [--remove-section SECTION]
 [--g-libs]
 [-j N] [--jobs N]
@@ -94,6 +94,8 @@ will be called /usr/debug/src/<BASE>.  This makes sure the debug source
 dirs are unique between package version, release and achitecture (Use
 --unique-debug-src-base "%{name}-%{VERSION}-%{RELEASE}.%{_arch}")
 
+The -q or --quiet flag silences non-error output from the script.
+
 All file names in switches are relative to builddir ('.' if not given).
 EOF
 }
@@ -146,6 +148,9 @@ n_jobs=1
 # exit early on --version or --help
 done=false
 
+# silence non-error output
+quiet=false
+
 BUILDDIR=.
 out=debugfiles.list
 srcout=
@@ -239,6 +244,9 @@ while [ $# -gt 0 ]; do
     srcout=$2
     shift
     ;;
+  -q|--quiet)
+    quiet=true
+    ;;
   --version)
     echo "find-debuginfo @VERSION@"
     done=true;
@@ -437,7 +445,7 @@ do_file()
   get_debugfn "$f"
   [ -f "${debugfn}" ] && return
 
-  echo "extracting debug info from $f"
+  $quiet || echo "extracting debug info from $f"
   # See also cpio SOURCEFILE copy. Directories must match up.
   debug_base_name="$RPM_BUILD_DIR"
   debug_dest_name="/usr/src/debug"
@@ -513,7 +521,7 @@ do_file()
     grep "^$inum " "$temp/linked" | while read inum linked; do
       link=$debugfn
       get_debugfn "$linked"
-      echo "hard linked $link to $debugfn"
+      $quiet || echo "hard linked $link to $debugfn"
       mkdir -p "$(dirname "$debugfn")" && ln -nf "$link" "$debugfn"
     done
   fi
@@ -576,7 +584,7 @@ if $run_dwz \
    && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then
   readarray dwz_files < <(cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug | LC_ALL=C sort)
   if [ ${#dwz_files[@]} -gt 0 ]; then
-    size_before=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
+    $quiet || size_before=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
     dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}"
     dwz_multifile_suffix=
     dwz_multifile_idx=0
@@ -599,8 +607,8 @@ if $run_dwz \
       echo >&2 "*** ERROR: DWARF compression requested, but no dwz installed"
       exit 2
     fi
-    size_after=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
-    echo "original debug info size: ${size_before}kB, size after compression: ${size_after}kB"
+    $quiet || size_after=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
+    $quiet || echo "original debug info size: ${size_before}kB, size after compression: ${size_after}kB"
     # Remove .dwz directory if empty
     rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null
 
@@ -620,7 +628,7 @@ do
   f=${f#$RPM_BUILD_ROOT}
   t=${t#$RPM_BUILD_ROOT}
   if [ -f "$debugdir$t" ]; then
-    echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug"
+    $quiet || echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug"
     debug_link "/usr/lib/debug$t" "${f}.debug"
   fi
 done
-- 
2.39.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scripts/find-debuginfo.in: Add -q|--quiet
  2023-01-26 21:08 [PATCH] scripts/find-debuginfo.in: Add -q|--quiet Prarit Bhargava
@ 2023-01-27 17:38 ` Mark Wielaard
  2023-01-28 13:24   ` Prarit Bhargava
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2023-01-27 17:38 UTC (permalink / raw)
  To: Prarit Bhargava, debugedit

Hi Prarit,

On Thu, 2023-01-26 at 16:08 -0500, Prarit Bhargava wrote:
> Projects with a large number of compiled files end up with a large number
> of 'extracting debug info from' messages in the build log.  In the case of
> the Fedora kernel these messages account for 8504 lines in the log, or 61%
> of the entire log [1].
> 
> Removing these lines make the log easier to view and comprehend for some
> projects, however, not all projects will want to silence these messages so
> suppressing them must be optional.
> 
> Add a -q|--quiet which allows users to silence the non-error output from
> the script.

Looks perfect. Applied as is. Also backported to Fedora rawhide package
debugedit-5.0-7.fc38 so you can test it out there.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scripts/find-debuginfo.in: Add -q|--quiet
  2023-01-27 17:38 ` Mark Wielaard
@ 2023-01-28 13:24   ` Prarit Bhargava
  2023-01-28 23:07     ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Prarit Bhargava @ 2023-01-28 13:24 UTC (permalink / raw)
  To: Mark Wielaard, debugedit

On 1/27/23 12:38, Mark Wielaard wrote:
> Hi Prarit,
> 
> On Thu, 2023-01-26 at 16:08 -0500, Prarit Bhargava wrote:
>> Projects with a large number of compiled files end up with a large number
>> of 'extracting debug info from' messages in the build log.  In the case of
>> the Fedora kernel these messages account for 8504 lines in the log, or 61%
>> of the entire log [1].
>>
>> Removing these lines make the log easier to view and comprehend for some
>> projects, however, not all projects will want to silence these messages so
>> suppressing them must be optional.
>>
>> Add a -q|--quiet which allows users to silence the non-error output from
>> the script.
> 
> Looks perfect. Applied as is. Also backported to Fedora rawhide package
> debugedit-5.0-7.fc38 so you can test it out there.
> 

Thanks.  LGTM.  Is there any chance you could also create packages for 
F37 and F36?

https://src.fedoraproject.org/rpms/debugedit

I'd like to add --quiet to the kernel.spec but cannot do so until the 
fix reaches all supported fedora releases.

P.

> Thanks,
> 
> Mark
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scripts/find-debuginfo.in: Add -q|--quiet
  2023-01-28 13:24   ` Prarit Bhargava
@ 2023-01-28 23:07     ` Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2023-01-28 23:07 UTC (permalink / raw)
  To: Prarit Bhargava; +Cc: debugedit

Hi Prarit,

On Sat, Jan 28, 2023 at 08:24:06AM -0500, Prarit Bhargava wrote:
> On 1/27/23 12:38, Mark Wielaard wrote:
> >Looks perfect. Applied as is. Also backported to Fedora rawhide package
> >debugedit-5.0-7.fc38 so you can test it out there.
> >
> 
> Thanks.  LGTM.  Is there any chance you could also create packages
> for F37 and F36?
> 
> https://src.fedoraproject.org/rpms/debugedit
> 
> I'd like to add --quiet to the kernel.spec but cannot do so until
> the fix reaches all supported fedora releases.

Backported to f36 and f37

  https://bodhi.fedoraproject.org/updates/FEDORA-2023-9ed6123537
  https://bodhi.fedoraproject.org/updates/FEDORA-2023-afb47cff16

It will take a couple of days/weeks for it lands, it needs to spend
some time in testing.

Cheers,

Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-28 23:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 21:08 [PATCH] scripts/find-debuginfo.in: Add -q|--quiet Prarit Bhargava
2023-01-27 17:38 ` Mark Wielaard
2023-01-28 13:24   ` Prarit Bhargava
2023-01-28 23:07     ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).