Ticket #1590: 0001-Single-rpm-script-that-also-does-srpm-job.patch

File 0001-Single-rpm-script-that-also-does-srpm-job.patch, 11.7 KB (added by arekm, 15 years ago)

patch

  • vfs/extfs/Makefile.am

    From 188d82f9c1a150cb49969623974d37cc77417b28 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= <arekm@maven.pl>
    Date: Sun, 6 Sep 2009 20:27:00 +0200
    Subject: [PATCH] Single rpm script that also does srpm job.
    
    Use rpm script for srpm job, too.
    ---
     vfs/extfs/Makefile.am |    8 ++-
     vfs/extfs/rpm         |   18 ++++-
     vfs/extfs/srpm        |  198 -------------------------------------------------
     3 files changed, 24 insertions(+), 200 deletions(-)
     delete mode 100644 vfs/extfs/srpm
    
    diff --git a/vfs/extfs/Makefile.am b/vfs/extfs/Makefile.am
    index 48253f3..4177cb8 100644
    a b EXTFSCONFFILES = extfs.ini sfs.ini 
    66EXTFS_MISC  = README 
    77 
    88# Scripts hat don't need adaptation to the local system 
    9 EXTFS_CONST = bpp rpm trpm srpm u7z 
     9EXTFS_CONST = bpp rpm trpm u7z 
    1010 
    1111# Scripts that need adaptation to the local system - source files 
    1212EXTFS_IN    =                   \ 
    endif 
    7272 
    7373EXTRA_DIST = $(EXTFS_MISC) $(EXTFS_CONST) $(EXTFSCONFFILES) 
    7474 
     75install-exec-local: 
     76        $(MKDIR_P) $(DESTDIR)$(extfsdir) 
     77        $(LN_S) rpm $(DESTDIR)$(extfsdir)/srpm 
     78 
     79uninstall-local: 
     80        -rm $(DESTDIR)$(extfsdir)/srpm 
  • vfs/extfs/rpm

    diff --git a/vfs/extfs/rpm b/vfs/extfs/rpm
    index 219bc8a..2a7da12 100644
    a b unset LC_ALL 
    1919LC_TIME=C 
    2020export LC_TIME 
    2121 
     22if rpmbuild --version >/dev/null 2>&1; then 
     23        RPMBUILD="rpmbuild" 
     24else 
     25        RPMBUILD="rpm" 
     26fi 
     27 
    2228if rpm --nosignature --version >/dev/null 2>&1; then 
    2329  RPM="rpm --nosignature" 
     30  RPMBUILD="$RPMBUILD --nosignature" 
    2431else 
    2532  RPM="rpm" 
    2633fi 
    mcrpmfs_list () 
    4855    HEADERSIZE=`echo "$DESC" | wc -c` 
    4956    echo "-r--r--r--   1 root     root  $HEADERSIZE $DATE HEADER" 
    5057    echo "-r-xr-xr-x   1 root     root    39 $DATE INSTALL" 
    51     echo "-r-xr-xr-x   1 root     root    39 $DATE UPGRADE" 
     58    case "$f" in 
     59                *.src.rpm) 
     60                echo "-r-xr-xr-x   1 root     root    39 $DATE REBUILD" 
     61                ;; 
     62                *) 
     63                echo "-r-xr-xr-x   1 root     root    39 $DATE UPGRADE" 
     64                ;; 
     65        esac 
    5266    echo "dr-xr-xr-x   3 root     root     0 $DATE INFO" 
    5367    echo "$FILEPREF 0 $DATE INFO/NAME-VERSION-RELEASE" 
    5468    echo "$FILEPREF 0 $DATE INFO/GROUP" 
    mcrpmfs_copyout () 
    138152        HEADER) $RPM -qip "$f" > "$3"; exit 0;; 
    139153        INSTALL) echo "# Run this to install this RPM package" > "$3"; exit 0;; 
    140154        UPGRADE) echo "# Run this to upgrade this RPM package" > "$3"; exit 0;; 
     155        REBUILD) echo "# Run this to rebuild this RPM package" > "$3"; exit 0;; 
    141156        ERROR) $RPM -qip "$f" > /dev/null 2> "$3"; exit 0;; 
    142157        INFO/NAME-VERSION-RELEASE)      $RPM -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" "$f" > "$3"; exit 0;; 
    143158        INFO/RELEASE)           $RPM -qp --qf "%{RELEASE}\n" "$f" > "$3"; exit 0;; 
    mcrpmfs_run () 
    179194    case "$2" in 
    180195        INSTALL) echo "Installing \"\"$f\"\""; $RPM -ivh "$f"; exit 0;; 
    181196        UPGRADE) echo "Upgrading \"\"$f\"\""; $RPM -Uvh "$f"; exit 0;; 
     197        REBUILD) echo "Rebuilding \"$1\""; $RPMBUILD --rebuild "$1"; exit 0;; 
    182198    esac 
    183199} 
    184200 
  • deleted file vfs/extfs/srpm

    diff --git a/vfs/extfs/srpm b/vfs/extfs/srpm
    deleted file mode 100644
    index 168b5c0..0000000
    + -  
    1 #! /bin/sh 
    2 # 
    3 # Written by Erik Troan (ewt@redhat.com) 1996 
    4 #            Jakub Jelinek (jj@sunsite.mff.cuni.cz) 1996,2004 
    5 #            Tomasz K³oczko (kloczek@rudy.mif.pg.gda.pl) 1997 
    6 # minor changes by Wojtek Pilorz (wpilorz@bdk.lublin.pl) 1997 
    7 # minor changes by Michele Marziani (marziani@fe.infn.it) 1997 
    8 # bug files by Marc Merlin (marcsoft@merlins.org) 1998 
    9 # locale bugfix by Michal Svec (rebel@penguin.cz) 2000 
    10 # Whitespace(s) & single quote(s) in filename workaround 
    11 #   by Andrew V. Samoilov <sav@bcs.zp.ua> 2004 
    12 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=64007 
    13 # 
    14 # (C) 1996-2004 The Free Software Foundation. 
    15 # 
    16  
    17 # override any locale for dates 
    18 unset LC_ALL 
    19 LC_TIME=C 
    20 export LC_TIME 
    21  
    22 if rpmbuild --version >/dev/null 2>&1; then 
    23         RPMBUILD="rpmbuild" 
    24 else 
    25         RPMBUILD="rpm" 
    26 fi 
    27  
    28 if rpm --nosignature --version >/dev/null 2>&1; then 
    29   RPM="rpm --nosignature" 
    30   RPMBUILD="$RPMBUILD --nosignature" 
    31 else 
    32   RPM="rpm" 
    33 fi 
    34 RPM2CPIO="rpm2cpio" 
    35 SED="sed" 
    36 # Surround the whole filename with single quotes and handle specially 
    37 # \', ' and \ at the end of the string. 
    38 SEDCMD="s/\\(\\\\\\?\\)'/'\\1\\1\\\\''/g;s/\\\\\$/'\\\\\\\\'/;s/^/'/;s/\$/'/" 
    39  
    40 mcrpmfs_list () 
    41 { 
    42     # set MCFASTRPM_DFLT to 1 for faster rpm files handling by default, to 0 for 
    43     # slower handling 
    44     MCFASTRPM_DFLT=0 
    45     if test -z "$MCFASTRPM"; then 
    46       MCFASTRPM=$MCFASTRPM_DFLT 
    47     fi 
    48     f="`echo "$1" | $SED "$SEDCMD"`" 
    49     FILEPREF="-r--r--r--   1 root     root    " 
    50     DESC=`$RPM -qip "$f" 2>/dev/null` || { 
    51         echo "$FILEPREF 0 "`date +"%b %d %H:%M"`" ERROR" 
    52         exit 1 
    53     } 
    54     DATE=`$RPM -qp --qf "%{BUILDTIME:date}\n" "$f" | cut -c 5-11,21-24` 
    55     HEADERSIZE=`echo "$DESC" | wc -c` 
    56     echo "-r--r--r--   1 root     root  $HEADERSIZE $DATE HEADER" 
    57     echo "-r-xr-xr-x   1 root     root    39 $DATE INSTALL" 
    58     echo "-r-xr-xr-x   1 root     root    39 $DATE REBUILD" 
    59     echo "dr-xr-xr-x   3 root     root     0 $DATE INFO" 
    60     echo "$FILEPREF 0 $DATE INFO/NAME-VERSION-RELEASE" 
    61     echo "$FILEPREF 0 $DATE INFO/GROUP" 
    62     echo "$FILEPREF 0 $DATE INFO/BUILDHOST" 
    63     echo "$FILEPREF 0 $DATE INFO/SOURCERPM" 
    64     if test "$MCFASTRPM" = 0 ; then 
    65      test "`$RPM -qp --qf \"%{DISTRIBUTION}\" \"$f\"`" = "(none)" || 
    66          echo "$FILEPREF 0 $DATE INFO/DISTRIBUTION" 
    67      test "`$RPM -qp --qf \"%{VENDOR}\" \"$f\"`" = "(none)" || 
    68          echo "$FILEPREF 0 $DATE INFO/VENDOR" 
    69      test "`$RPM -qp --qf \"%{DESCRIPTION}\" \"$f\"`" = "(none)" || 
    70          echo "$FILEPREF 0 $DATE INFO/DESCRIPTION" 
    71      test "`$RPM -qp --qf \"%{SUMMARY}\" \"$f\"`" = "(none)" || 
    72          echo "$FILEPREF 0 $DATE INFO/SUMMARY" 
    73      if test "`$RPM -qp --qf \"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\" \"$f\"`" != "(none)(none)(none)(none)(none)"; then 
    74         echo "dr-xr-xr-x   1 root     root     0 $DATE INFO/SCRIPTS" 
    75         test "`$RPM -qp --qf \"%{RPMTAG_PREIN}\" \"$f\"`" = '(none)' || 
    76            echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN" 
    77         test "`$RPM -qp --qf \"%{RPMTAG_POSTIN}\" \"$f\"`" = '(none)' || 
    78            echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTIN" 
    79         test "`$RPM -qp --qf \"%{RPMTAG_PREUN}\" \"$f\"`" = '(none)' || 
    80            echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREUN" 
    81         test "`$RPM -qp --qf \"%{RPMTAG_POSTUN}\" \"$f\"`" = '(none)' || 
    82            echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTUN" 
    83         test "`$RPM -qp --qf \"%{VERIFYSCRIPT}\" \"$f\"`" = '(none)' || 
    84            echo "$FILEPREF 0 $DATE INFO/SCRIPTS/VERIFYSCRIPT" 
    85         echo "$FILEPREF 0 $DATE INFO/SCRIPTS/ALL" 
    86      fi 
    87     else 
    88      echo "$FILEPREF 0 $DATE INFO/DISTRIBUTION" 
    89      echo "$FILEPREF 0 $DATE INFO/VENDOR" 
    90      echo "$FILEPREF 0 $DATE INFO/DESCRIPTION" 
    91      echo "$FILEPREF 0 $DATE INFO/SUMMARY" 
    92      echo "dr-xr-xr-x   1 root     root     0 $DATE INFO/SCRIPTS" 
    93      echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN" 
    94      echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTIN" 
    95      echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREUN" 
    96      echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTUN" 
    97      echo "$FILEPREF 0 $DATE INFO/SCRIPTS/VERIFYSCRIPT" 
    98      echo "$FILEPREF 0 $DATE INFO/SCRIPTS/ALL" 
    99     fi 
    100     if test "$MCFASTRPM" = 0 ; then 
    101      test "`$RPM -qp --qf \"%{PACKAGER}\" \"$f\"`" = "(none)" || 
    102          echo "$FILEPREF 0 $DATE INFO/PACKAGER" 
    103      test "`$RPM -qp --qf \"%{URL}\" \"$f\"`" = "(none)" || 
    104          echo "$FILEPREF 0 $DATE INFO/URL" 
    105      test "`$RPM -qp --qf \"%{EPOCH}\" \"$f\"`" = "(none)" || 
    106          echo "$FILEPREF 0 $DATE INFO/EPOCH" 
    107      test "`$RPM -qp --qf \"%{LICENSE}\" \"$f\"`" = "(none)" || 
    108          echo "$FILEPREF 0 $DATE INFO/LICENSE" 
    109     else 
    110          echo "$FILEPREF 0 $DATE INFO/PACKAGER" 
    111          echo "$FILEPREF 0 $DATE INFO/URL" 
    112          echo "$FILEPREF 0 $DATE INFO/EPOCH" 
    113          echo "$FILEPREF 0 $DATE INFO/LICENSE" 
    114     fi 
    115     echo "$FILEPREF 0 $DATE INFO/BUILDTIME" 
    116     echo "$FILEPREF 0 $DATE INFO/RPMVERSION" 
    117     echo "$FILEPREF 0 $DATE INFO/OS" 
    118     echo "$FILEPREF 0 $DATE INFO/SIZE" 
    119     if test "$MCFASTRPM" != 0 ; then 
    120     $RPM -qp --qf "[%{REQUIRENAME}\n]" "$f" | grep "(none)" > /dev/null || 
    121         echo "$FILEPREF 0 $DATE INFO/REQUIRENAME" 
    122     $RPM -qp --qf "[%{OBSOLETES}\n]" "$f" | grep "(none)" > /dev/null || 
    123         echo "$FILEPREF 0 $DATE INFO/OBSOLETES" 
    124     $RPM -qp --qf "[%{PROVIDES}\n]" "$f" | grep "(none)" > /dev/null || 
    125         echo "$FILEPREF 0 $DATE INFO/PROVIDES" 
    126     $RPM -qp --qf "[%{CONFLICTS}\n]" "$f" | grep "(none)" > /dev/null || 
    127         echo "$FILEPREF 0 $DATE INFO/CONFLICTS" 
    128     test "`$RPM -qp --qf \"%{CHANGELOGTEXT}\" \"$f\"`" = "(none)" || 
    129        echo "$FILEPREF 0 $DATE INFO/CHANGELOG" 
    130     else  
    131         echo "$FILEPREF 0 $DATE INFO/REQUIRENAME" 
    132         echo "$FILEPREF 0 $DATE INFO/OBSOLETES" 
    133         echo "$FILEPREF 0 $DATE INFO/PROVIDES" 
    134         echo "$FILEPREF 0 $DATE INFO/CONFLICTS" 
    135         echo "$FILEPREF 0 $DATE INFO/CHANGELOG" 
    136     fi 
    137  
    138     echo "$FILEPREF 0 $DATE CONTENTS.cpio" 
    139 } 
    140  
    141 mcrpmfs_copyout () 
    142 { 
    143     f="`echo "$1" | $SED "$SEDCMD"`" 
    144     case "$2" in 
    145         HEADER) $RPM -qip "$f" > "$3"; exit 0;; 
    146         INSTALL) echo "# Run this to install this RPM package" > "$3"; exit 0;; 
    147         REBUILD) echo "# Run this to rebuild this RPM package" > "$3"; exit 0;; 
    148         ERROR) $RPM -qip "$f" > /dev/null 2> "$3"; exit 0;; 
    149         INFO/NAME-VERSION-RELEASE)      $RPM -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" "$f" > "$3"; exit 0;; 
    150         INFO/RELEASE)           $RPM -qp --qf "%{RELEASE}\n" "$f" > "$3"; exit 0;; 
    151         INFO/GROUP)             $RPM -qp --qf "%{GROUP}\n" "$f" > "$3"; exit 0;; 
    152         INFO/DISTRIBUTION)      $RPM -qp --qf "%{DISTRIBUTION}\n" "$f" > "$3"; exit 0;; 
    153         INFO/VENDOR)            $RPM -qp --qf "%{VENDOR}\n" "$f" > "$3"; exit 0;; 
    154         INFO/BUILDHOST)         $RPM -qp --qf "%{BUILDHOST}\n" "$f" > "$3"; exit 0;; 
    155         INFO/SOURCERPM)         $RPM -qp --qf "%{SOURCERPM}\n" "$f" > "$3"; exit 0;; 
    156         INFO/DESCRIPTION)       $RPM -qp --qf "%{DESCRIPTION}\n" "$f" > "$3"; exit 0;; 
    157         INFO/PACKAGER)          $RPM -qp --qf "%{PACKAGER}\n" "$f" > "$3"; exit 0;; 
    158         INFO/URL)               $RPM -qp --qf "%{URL}\n" "$f" >"$3"; exit 0;; 
    159         INFO/BUILDTIME)         $RPM -qp --qf "%{BUILDTIME:date}\n" "$f" >"$3"; exit 0;; 
    160         INFO/EPOCH)             $RPM -qp --qf "%{EPOCH}\n" "$f" >"$3"; exit 0;; 
    161         INFO/LICENSE)           $RPM -qp --qf "%{LICENSE}\n" "$f" >"$3"; exit 0;; 
    162         INFO/RPMVERSION)        $RPM -qp --qf "%{RPMVERSION}\n" "$f" >"$3"; exit 0;; 
    163         INFO/REQUIRENAME)       $RPM -qp --qf "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" "$f" >"$3"; exit 0;; 
    164         INFO/PROVIDES)          $RPM -qp --qf "[%{PROVIDES}\n]" "$f" >"$3"; exit 0;; 
    165         INFO/SCRIPTS/PREIN)     $RPM -qp --qf "%{RPMTAG_PREIN}\n" "$f" >"$3"; exit 0;; 
    166         INFO/SCRIPTS/POSTIN)    $RPM -qp --qf "%{RPMTAG_POSTIN}\n" "$f" >"$3"; exit 0;; 
    167         INFO/SCRIPTS/PREUN)     $RPM -qp --qf "%{RPMTAG_PREUN}\n" "$f" >"$3"; exit 0;; 
    168         INFO/SCRIPTS/POSTUN)    $RPM -qp --qf "%{RPMTAG_POSTUN}\n" "$f" >"$3"; exit 0;; 
    169         INFO/SCRIPTS/VERIFYSCRIPT)      $RPM -qp --qf "%{VERIFYSCRIPT}\n" "$f" >"$3"; exit 0;; 
    170         INFO/SCRIPTS/ALL)               $RPM -qp --scripts "$f" > "$3"; exit 0;; 
    171         INFO/SUMMARY)           $RPM -qp --qf "%{SUMMARY}\n" "$f" > "$3"; exit 0;; 
    172         INFO/OS)                $RPM -qp --qf "%{OS}\n" "$f" > "$3"; exit 0;; 
    173         INFO/CHANGELOG)         $RPM -qp --qf "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" "$f" > "$3"; exit 0;; 
    174         INFO/SIZE)              $RPM -qp --qf "%{SIZE} bytes\n" "$f" > "$3"; exit 0;; 
    175         INFO/OBSOLETES)         $RPM -qp --qf "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]" "$f" > "$3"; exit 0;; 
    176         INFO/CONFLICTS)         $RPM -qp --qf "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]" "$f" >"$3"; exit 0;; 
    177         CONTENTS.cpio)          $RPM2CPIO "$1" > "$3"; exit 0;; 
    178         *) 
    179             ;; 
    180     esac 
    181 } 
    182  
    183 mcrpmfs_run () 
    184 { 
    185     f="`echo "$1" | $SED "$SEDCMD"`" 
    186     case "$2" in 
    187         INSTALL) echo "Installing \"\"$f\"\""; $RPM -ivh "$f"; exit 0;; 
    188         REBUILD) echo "Rebuilding \"$1\""; $RPMBUILD --rebuild "$1"; exit 0;; 
    189     esac 
    190 } 
    191  
    192 umask 077 
    193 case "$1" in 
    194   list) mcrpmfs_list "$2"; exit 0;; 
    195   copyout) mcrpmfs_copyout "$2" "$3" "$4"; exit 0;; 
    196   run) mcrpmfs_run "$2" "$3"; exit 1;; 
    197 esac 
    198 exit 1