# HG changeset patch # User Lukas Rovensky # Date 1308216444 25200 # Node ID c12c36cb534968ab3d36995e7bfb23f9bb0795d0 # Parent 9da68c8821e31cb075b0e140a1751eb43ee33646 7054536 move rpm2cpio to userland diff -r 9da68c8821e3 -r c12c36cb5349 components/meta-packages/history/SUNWrpm.p5m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/meta-packages/history/SUNWrpm.p5m Thu Jun 16 02:27:24 2011 -0700 @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# + +# +# Legacy package information for renamed SUNWpwgen ackage +# + +set name=pkg.fmri value=pkg:/SUNWrpm@0.5.11,5.11-0.133 +set name=pkg.renamed value=true + +set name=org.opensolaris.consolidation value=$(CONSOLIDATION) + +depend fmri=package/rpm@0.5.11-0.133 type=require diff -r 9da68c8821e3 -r c12c36cb5349 components/rpm2cpio/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/rpm2cpio/Makefile Thu Jun 16 02:27:24 2011 -0700 @@ -0,0 +1,61 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# + +include ../../make-rules/shared-macros.mk + +# The version of rpm2cpio.pl delivered in SFW does not seem to be +# available for download anymore, so it is exceptionally delivered in +# the Userland gate itself. +# +COMPONENT_NAME= rpm2cpio +COMPONENT_VERSION= 0.5.11 +COMPONENT_SRC= src + +include ../../make-rules/prep.mk + +# Do not clean the sources (set in prep.mk) +# +CLEAN_PATHS= + +include ../../make-rules/ips.mk + +CLEAN_PATHS+= $(BUILD_DIR) + +# Common targets +# +build: + # Just create the build directory, which is needed for publishing. + # There is nothing to actually build. + # + $(RM) -r $(BUILD_DIR) ; $(MKDIR) $(BUILD_DIR) + +install: + @echo "Nothing to install." + +test: $(NO_TESTS) + +BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS) + +include ../../make-rules/depend.mk diff -r 9da68c8821e3 -r c12c36cb5349 components/rpm2cpio/rpm2cpio.license --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/rpm2cpio/rpm2cpio.license Thu Jun 16 02:27:24 2011 -0700 @@ -0,0 +1,19 @@ +Copyright (C) 1997,1998,1999, Roger Espel Llima + +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 diff -r 9da68c8821e3 -r c12c36cb5349 components/rpm2cpio/rpm2cpio.p5m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/rpm2cpio/rpm2cpio.p5m Thu Jun 16 02:27:24 2011 -0700 @@ -0,0 +1,40 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# + +set name=pkg.fmri \ + value=pkg:/package/rpm@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION) +set name=pkg.description \ + value="Utilities for processing RPM archives" +set name=pkg.summary value="Utilities for processing RPM archives" +set name=info.classification \ + value="org.opensolaris.category.2008:System/Packaging" +set name=info.upstream_url value=www.iagora.com/~espel/rpm2cpio +set name=opensolaris.arc_url \ + value=http://arc.opensolaris.org/caselog/PSARC/1999/555 +set name=org.opensolaris.consolidation value=$(CONSOLIDATION) +dir path=usr +dir path=usr/bin +file rpm2cpio.pl path=usr/bin/rpm2cpio +legacy pkg=SUNWrpm desc="Utilities for processing RPM archives" \ + name="Utilities for processing RPM archives" +license rpm2cpio.license license=BSD diff -r 9da68c8821e3 -r c12c36cb5349 components/rpm2cpio/src/rpm2cpio.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/rpm2cpio/src/rpm2cpio.pl Thu Jun 16 02:27:24 2011 -0700 @@ -0,0 +1,90 @@ +#!/usr/perl5/bin/perl + +# Copyright (C) 1997,1998,1999, Roger Espel Llima +# +# 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 + +# (whew, that's done!) + +# why does the world need another rpm2cpio? because the existing one +# won't build unless you have half a ton of things that aren't really +# required for it, since it uses the same library used to extract RPM's. +# in particular, it won't build on the HPsUX box i'm on. + + +# add a path if desired +$gzip = "gzip"; + +sub printhelp { + print < +dumps the contents to stdout as a cpio archive + +use: rpm2cpio [file.rpm] > file.cpio + +Here's how to use cpio: + list of contents: cpio -t -i < /file/name + extract files: cpio -d -i < /file/name +HERE + + exit 0; +} + +if ($#ARGV == -1) { + printhelp if -t STDIN; + $f = "STDIN"; +} elsif ($#ARGV == 0) { + open(F, "< $ARGV[0]") or die "Can't read file $ARGV[0]\n"; + $f = 'F'; +} else { + printhelp; +} + +printhelp if -t STDOUT; + +# gobble the file up +undef $/; +$|=1; +$rpm = <$f>; +close ($f); + +($magic, $major, $minor, $crap) = unpack("NCC C90", $rpm); + +die "Not an RPM\n" if $magic != 0xedabeedb; +die "Not a version 3 or 4 RPM\n" if $major != 3 && $major != 4; + +$rpm = substr($rpm, 96); + +while ($rpm ne '') { + $rpm =~ s/^\c@*//s; + ($magic, $crap, $sections, $bytes) = unpack("N4", $rpm); + $smagic = unpack("n", $rpm); + last if $smagic eq 0x1f8b; + die "Error: header not recognized\n" if $magic != 0x8eade801; + $rpm = substr($rpm, 16*(1+$sections) + $bytes); +} + +die "bogus RPM\n" if $rpm eq ''; + +open(ZCAT, "|gzip -cd") || die "can't pipe to gzip\n"; +print STDERR "CPIO archive found!\n"; + +print ZCAT $rpm; +close ZCAT; +