Ticket #3751: 3751-0001-extfs-rpm-introduce-the-RPM_QUERY_FMT-variable.patch

File 3751-0001-extfs-rpm-introduce-the-RPM_QUERY_FMT-variable.patch, 1.3 KB (added by mooffie, 8 years ago)
  • src/vfs/extfs/helpers/rpm

    From 9888451aac0af2e8a44f38b2972af7f125422652 Mon Sep 17 00:00:00 2001
    From: Mooffie <mooffie@gmail.com>
    Date: Sun, 1 Jan 2017 17:52:12 +0200
    Subject: [PATCH 1/4] Ticket #3751: extfs: rpm: introduce the $RPM_QUERY_FMT
     variable.
    
    This minor refactoring will enable us to make this helper testable.
    
    Instead of doing:
    
        $RPM -qp --qf a b c
    
    we are now doing:
    
        $RPM_QUERY_FMT a b c
    
    In a future patch we'll then be able to point $RPM_QUERY_FMT to some mock
    program.
    
    Signed-off-by: Mooffie <mooffie@gmail.com>
    ---
     src/vfs/extfs/helpers/rpm | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/src/vfs/extfs/helpers/rpm b/src/vfs/extfs/helpers/rpm
    index 4a01453..454a9c0 100755
    a b if rpm --nosignature --version >/dev/null 2>&1; then 
    6464else 
    6565  RPM="rpm" 
    6666fi 
     67RPM_QUERY_FMT="$RPM -qp --qf" 
    6768RPM2CPIO="rpm2cpio" 
    6869 
    6970SED="sed" 
    mcrpmfs_getAllNeededTags() 
    9293        tag_CONFLICTS="" 
    9394    fi 
    9495 
    95     $RPM -qp --qf \ 
     96    $RPM_QUERY_FMT \ 
    9697"|NAME=%{NAME}"\ 
    9798"|VERSION=%{VERSION}"\ 
    9899"|RELEASE=%{RELEASE}"\ 
    ${tag_CONFLICTS}\ 
    113114 
    114115mcrpmfs_getRawOneTag() 
    115116{ 
    116     $RPM -qp --qf "$1" "${rpm_filename}" 
     117    $RPM_QUERY_FMT "$1" "${rpm_filename}" 
    117118} 
    118119 
    119120mcrpmfs_getOneTag()