Commit 9fecbb51 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

version up : LibreOffice 3.6.6, also fix rpm2cpio

that improves gzip header detection.
parent d944375e
......@@ -12,11 +12,11 @@ find-links =
[libreoffice-bin]
recipe = slapos.recipe.build
# here, two %s are used, first one is for directory name (eg. x86_64), and second one is for filename (eg. x86-64).
version = 3.6.5
version = 3.6.6
url = http://download.documentfoundation.org/libreoffice/stable/${:version}/rpm/%s/LibO_${:version}_Linux_%s_install-rpm_en-US.tar.gz
# supported architectures md5sums
md5sum_x86 = 9575c9a567d48a9feeaed2f915bfdf7f
md5sum_x86-64 = 302e326f2b2a524a78994705ea782770
md5sum_x86 = 922935201a350a7e0d3f83c08f739ee2
md5sum_x86-64 = fa41089ce29eb03cdfb34d06a1e786db
# where office code can be found?
officedir = libreoffice3.6
......
......@@ -6,4 +6,4 @@ parts =
# https://github.com/ruda/rpm2cpio
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_buildout_section_name_}
md5sum = c5bb6227d99e1ff5df880f997cbed2e3
md5sum = aa3a5920a1d8963592be0c2666ee05e2
......@@ -3,7 +3,33 @@
#
# Standalone RPM to CPIO converter
# Copyright (c) 2012 Rudá Moura
# https://github.com/ruda/rpm2cpio
#
# Impove gzip header detection thanks to
# http://afb.users.sourceforge.net/centos/rpm2cpio.py
#
# Copyright (C) 1997,1998,1999, Roger Espel Llima
# Copyright (C) 2000, Sergey Babkin
# Copyright (C) 2009, Alex Kozlov
# Copyright (C) 2010, Anders F Bjorklund
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and any associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# SOFTWARE'S COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE
'''Extract cpio archive from RPM package.
......@@ -21,6 +47,7 @@ rpm2cpio < adjtimex-1.20-2.1.i386.rpm | cpio -it
'''
import sys
import struct
import StringIO
import gzip
......@@ -31,15 +58,35 @@ def rpm2cpio(stream_in=sys.stdin, stream_out=sys.stdout):
lead = stream_in.read(96)
if lead[0:4] != RPM_MAGIC:
raise IOError, 'the input is not a RPM package'
data = stream_in.read()
idx = data.find(GZIP_MAGIC)
if idx == -1:
raise IOError, 'could not find compressed cpio archive'
gzstream = StringIO.StringIO(data[idx:])
gzipper = gzip.GzipFile(fileobj=gzstream)
lead = stream_in.read(16)
if not lead:
raise IOError, 'No header'
while True:
(magic, ignore, sections, bytes) = struct.unpack("!LLLL", lead)
(smagic, smagic2) = struct.unpack("!HL", lead[0:6])
if smagic == 0x1f8b:
break
# skip the headers
stream_in.seek(16 * sections + bytes, 1)
while True:
lead = stream_in.read(1)
if lead == "":
raise IOError, 'No header'
if (0,) == struct.unpack("B", lead):
continue
break
lead += stream_in.read(15)
if lead == "":
raise IOError, 'No header'
stream_in.seek(-len(lead), 1)
gzipper = gzip.GzipFile(fileobj=stream_in)
data = gzipper.read()
stream_out.write(data)
if __name__ == '__main__':
if sys.argv[1:]:
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment