Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tom Niget
slapos
Commits
cedb700a
Commit
cedb700a
authored
Mar 04, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
component/rpm2cpio: update to current version
parent
9134c976
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
104 deletions
+2
-104
component/rpm2cpio/buildout.cfg
component/rpm2cpio/buildout.cfg
+2
-2
component/rpm2cpio/rpm2cpio
component/rpm2cpio/rpm2cpio
+0
-102
No files found.
component/rpm2cpio/buildout.cfg
View file @
cedb700a
...
...
@@ -6,5 +6,5 @@ parts =
# https://github.com/ruda/rpm2cpio
recipe = slapos.recipe.build:download
shared = true
url =
${:_profile_base_location_}/${:_buildout_section_name_}
md5sum =
aa3a5920a1d8963592be0c2666ee05e2
url =
https://raw.githubusercontent.com/ruda/rpm2cpio/5afad4b65e4661a771db6f728abefe2c1e84b9ae/rpm2cpio.py
md5sum =
1cb52f9030304c2b7625657b2ef2379e
component/rpm2cpio/rpm2cpio
deleted
100644 → 0
View file @
9134c976
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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.
rpm2cpio converts the RPM on standard input or first parameter to a CPIO archive on standard output.
Usage:
rpm2cpio < adjtimex-1.20-2.1.i386.rpm | cpio -it
./sbin/adjtimex
./usr/share/doc/adjtimex-1.20
./usr/share/doc/adjtimex-1.20/COPYING
./usr/share/doc/adjtimex-1.20/COPYRIGHT
./usr/share/doc/adjtimex-1.20/README
./usr/share/man/man8/adjtimex.8.gz
133 blocks
'''
import
sys
import
struct
import
StringIO
import
gzip
RPM_MAGIC
=
'
\
xed
\
xab
\
xee
\
xdb
'
GZIP_MAGIC
=
'
\
x1f
\
x8b
'
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'
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
:
fin
=
open
(
sys
.
argv
[
1
])
rpm2cpio
(
fin
)
fin
.
close
()
except
IOError
,
e
:
print
'Error:'
,
sys
.
argv
[
1
],
e
else
:
try
:
rpm2cpio
()
except
IOError
,
e
:
print
'Error:'
,
e
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment