quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH 2/4] setup: Delay the computation of md5sums


From: Jean Delvare
Subject: [Quilt-dev] [PATCH 2/4] setup: Delay the computation of md5sums
Date: Tue, 16 Jun 2015 21:34:04 +0200

In fast mode, don't compute the md5sum of the files in the source
directory before we need them. In most cases we will never actually
need them, so this avoids computing them for nothing.

Speed gain from this change can reach 12 %.
---
 quilt/scripts/inspect-wrapper.in |    7 +++++++
 quilt/setup.in                   |   12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

--- a/quilt/scripts/inspect-wrapper.in
+++ b/quilt/scripts/inspect-wrapper.in
@@ -5,6 +5,13 @@ original_file()
 {
        local md5sum=$1
 
+       if ! [ -e $tmpdir/md5sums ]
+       then
+               echo >&4
+               create_md5sums "$RPM_SOURCE_DIR" $tmpdir/md5sums
+               echo -n "### rpmbuild: " >&4
+       fi
+
        while read md5sum_ file_
        do
                if [ "$md5sum" = "$md5sum_" ]
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -142,7 +142,7 @@ create_md5sums()
                        # In fast mode, we are only interested in patches, so 
filter out
                        # archives
                        *.tar|*.tar.Z|*.tar.gz|*.tgz|*.tar.bz2|*.tar.xz|*.zip)
-                               [ -n "$targetdir" ] && continue
+                               [ -n "$QUILT_SETUP_FAST" ] && continue
                                ;;
                esac
                [ -f "$file" ] || continue
@@ -223,6 +223,7 @@ inspect()
        if [ -n "$targetdir" ]
        then
                # Fast mode
+               export QUILT_SETUP_FAST=1
                [ -d "$targetdir" ] || mkdir -p "$targetdir" || exit 1
                ln -s "$targetdir" $tmpdir/build
        else
@@ -240,12 +241,17 @@ inspect()
                exec 3>&1 4>&2 5>/dev/null
        fi
 
-       create_md5sums "$sourcedir" $tmpdir/md5sums
+       if [ -n "$QUILT_SETUP_FAST" ]
+       then
+               export -f create_md5sums
+       else
+               create_md5sums "$sourcedir" $tmpdir/md5sums
+       fi
 
        # let rpm do all the dirty specfile stuff ...
        echo -n "### rpmbuild: " >&4
 
-       PATH="$tmpdir/bin:$PATH" QUILT_SETUP_FAST=${targetdir:+1} \
+       PATH="$tmpdir/bin:$PATH" \
        rpmbuild --eval "%define _sourcedir $abs_sourcedir" \
                 --eval "%define _specdir   $specdir" \
                 --eval "%define _builddir  $tmpdir/build" \

-- 
Jean Delvare
SUSE L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]