Support tar payload of rpm.

mc always expects to see cpio payload inside rpm packages. However, it
is also possible for rpm packages to contain tar payload (ustar, to be
more precise).

rpm2cpio works correctly for such files (but it produces tar archives,
not cpio ones).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Denis Silakov 2013-08-31 11:05:26 +04:00 committed by Andrew Borodin
parent 20f8f204c8
commit 53dce22933

View File

@ -23,6 +23,8 @@
# 2009: Totally rewritten. # 2009: Totally rewritten.
# Alexander Chumachenko <ledest@gmail.com> # Alexander Chumachenko <ledest@gmail.com>
# 2013: add dependency version output # 2013: add dependency version output
# Denis Silakov <denis.silakov@rosalab.ru>
# 2013: tar payload support.
# #
# This file is part of the Midnight Commander. # This file is part of the Midnight Commander.
# #
@ -197,6 +199,7 @@ mcrpmfs_list ()
exit 1 exit 1
} }
DATE=`mcrpmfs_getRawOneTag "%{BUILDTIME:date}\n" | cut -c 5-11,21-24` DATE=`mcrpmfs_getRawOneTag "%{BUILDTIME:date}\n" | cut -c 5-11,21-24`
PAYLOAD=`mcrpmfs_getRawOneTag "%{PAYLOADFORMAT}\n" | sed s/ustar/tar/`
HEADERSIZE=`echo "$DESC" | wc -c` HEADERSIZE=`echo "$DESC" | wc -c`
printf '%s %s %s HEADER\n' "${FILEPREF}" "${HEADERSIZE}" "${DATE}" printf '%s %s %s HEADER\n' "${FILEPREF}" "${HEADERSIZE}" "${DATE}"
@ -226,7 +229,7 @@ mcrpmfs_list ()
mcrpmfs_list_fastRPM mcrpmfs_list_fastRPM
fi fi
echo "$FILEPREF 0 $DATE CONTENTS.cpio" echo "$FILEPREF 0 $DATE CONTENTS.$PAYLOAD"
} }
mcrpmfs_copyout () mcrpmfs_copyout ()
@ -280,7 +283,7 @@ mcrpmfs_copyout ()
INFO/SIZE) mcrpmfs_getRawOneTag "%{SIZE} bytes\n" > "$2"; exit 0;; INFO/SIZE) mcrpmfs_getRawOneTag "%{SIZE} bytes\n" > "$2"; exit 0;;
INFO/OBSOLETES) mcrpmfs_getRawOneTag "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]" > "$2"; exit 0;; INFO/OBSOLETES) mcrpmfs_getRawOneTag "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]" > "$2"; exit 0;;
INFO/CONFLICTS) mcrpmfs_getRawOneTag "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]" >"$2"; exit 0;; INFO/CONFLICTS) mcrpmfs_getRawOneTag "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]" >"$2"; exit 0;;
CONTENTS.cpio) $RPM2CPIO "${rpm_filename}" > "$2"; exit 0;; CONTENTS.*) $RPM2CPIO "${rpm_filename}" > "$2"; exit 0;;
*) *)
;; ;;
esac esac