diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2010-05-19 08:58:23 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-05-31 22:43:05 +0200 |
commit | b76270bf9e6dd375e495fec92140a79a79415d27 (patch) | |
tree | 3dbed78b2279bf9f14207a16dc634b90995cbd40 /source/a/rpm2tgz | |
parent | 5a12e7c134274dba706667107d10d231517d3e05 (diff) | |
download | current-b76270bf9e6dd375e495fec92140a79a79415d27.tar.gz current-b76270bf9e6dd375e495fec92140a79a79415d27.tar.xz |
Slackware 13.1slackware-13.1
Wed May 19 08:58:23 UTC 2010
Slackware 13.1 x86_64 stable is released!
Lots of thanks are due -- see the RELEASE_NOTES and the rest of the
ChangeLog for credits. The ISOs are on their way to replication,
a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD.
We are taking pre-orders now at store.slackware.com, and offering
a discount if you sign up for a subscription. Consider picking up
a copy to help support the project. Thanks again to the Slackware
community for testing, contributing, and generally holding us to a
high level of quality. :-)
Enjoy!
Diffstat (limited to 'source/a/rpm2tgz')
9 files changed, 353 insertions, 12 deletions
diff --git a/source/a/rpm2tgz/patches/0001-fix-d-handling.patch b/source/a/rpm2tgz/patches/0001-fix-d-handling.patch new file mode 100644 index 000000000..ca15a98fd --- /dev/null +++ b/source/a/rpm2tgz/patches/0001-fix-d-handling.patch @@ -0,0 +1,26 @@ +From 976ac157b878ecc260d54e3b5a1f3cd4403259df Mon Sep 17 00:00:00 2001 +From: Igor Murzov <igor@gplsoft.org> +Date: Sun, 18 Apr 2010 21:13:02 +0400 +Subject: [PATCH 1/6] fix -d handling + +this option also requires get_meta_data() call +to set $PRGNAM properly +--- + rpm2tgz | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/rpm2tgz b/rpm2tgz +index 5c91c64..f5f206c 100755 +--- a/rpm2tgz ++++ b/rpm2tgz +@@ -202,6 +202,7 @@ for i in $* ; do + + # Save the rpm's summary and description as the slack-desc + if [ "$DESC" = "true" ]; then ++ get_meta_data $i + mkdir -p $TMPDIR/install + rpm -qp --qf %{SUMMARY} $i | sed -l 70 -r "s/^(.*)/$PRGNAM: $PRGNAM - \1\n/" > $TMPDIR/install/slack-desc + rpm -qp --qf %{DESCRIPTION} $i | sed -l 70 -r "s/^/$PRGNAM: /" >> $TMPDIR/install/slack-desc +-- +1.7.0.2 + diff --git a/source/a/rpm2tgz/patches/0002-fix-spurious-path-to-rpm-file-with-n-option.patch b/source/a/rpm2tgz/patches/0002-fix-spurious-path-to-rpm-file-with-n-option.patch new file mode 100644 index 000000000..92a9cb259 --- /dev/null +++ b/source/a/rpm2tgz/patches/0002-fix-spurious-path-to-rpm-file-with-n-option.patch @@ -0,0 +1,34 @@ +From e2a9bf836465dbb138ee83ccbe41b385e4648014 Mon Sep 17 00:00:00 2001 +From: Igor Murzov <igor@gplsoft.org> +Date: Sun, 18 Apr 2010 22:02:45 +0400 +Subject: [PATCH 2/6] fix spurious path to rpm file with -n option + +there is no need to prepend $CWD to the path to file, +as it produce wrong path in the case, when path to file +is not relative to the current working directory +--- + rpm2tgz | 5 +++-- + 1 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/rpm2tgz b/rpm2tgz +index f5f206c..c41f456 100755 +--- a/rpm2tgz ++++ b/rpm2tgz +@@ -213,11 +213,12 @@ for i in $* ; do + # makepkg to produce the .tgz: + if [ "$(basename $0)" = "rpm2tgz" ]; then + ( +- cd $TMPDIR + if [ "$META_NAME" = "true" ]; then +- get_meta_data $CWD/$i ++ get_meta_data $i ++ cd $TMPDIR + makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.tgz + else ++ cd $TMPDIR + makepkg -l y -c n $CWD/$(basename $i .rpm).tgz + fi + ) +-- +1.7.0.2 + diff --git a/source/a/rpm2tgz/patches/0003-allow-every-user-to-use-rpm2tgz.patch b/source/a/rpm2tgz/patches/0003-allow-every-user-to-use-rpm2tgz.patch new file mode 100644 index 000000000..07d20286a --- /dev/null +++ b/source/a/rpm2tgz/patches/0003-allow-every-user-to-use-rpm2tgz.patch @@ -0,0 +1,29 @@ +From c57c0a39b6745203ebec36f37318ea3b0b4820f9 Mon Sep 17 00:00:00 2001 +From: Igor Murzov <igor@gplsoft.org> +Date: Sun, 18 Apr 2010 22:06:56 +0400 +Subject: [PATCH 3/6] allow every user to use rpm2tgz + +--- + rpm2tgz | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/rpm2tgz b/rpm2tgz +index c41f456..4818b74 100755 +--- a/rpm2tgz ++++ b/rpm2tgz +@@ -216,10 +216,10 @@ for i in $* ; do + if [ "$META_NAME" = "true" ]; then + get_meta_data $i + cd $TMPDIR +- makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.tgz ++ /sbin/makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.tgz + else + cd $TMPDIR +- makepkg -l y -c n $CWD/$(basename $i .rpm).tgz ++ /sbin/makepkg -l y -c n $CWD/$(basename $i .rpm).tgz + fi + ) + else +-- +1.7.0.2 + diff --git a/source/a/rpm2tgz/patches/0004-produce-more-compliant-slack-desc.patch b/source/a/rpm2tgz/patches/0004-produce-more-compliant-slack-desc.patch new file mode 100644 index 000000000..836b36e5a --- /dev/null +++ b/source/a/rpm2tgz/patches/0004-produce-more-compliant-slack-desc.patch @@ -0,0 +1,29 @@ +From 531b6f6c429678f69f2c90280a1e706eed6dcfbc Mon Sep 17 00:00:00 2001 +From: Igor Murzov <igor@gplsoft.org> +Date: Sun, 18 Apr 2010 22:56:56 +0400 +Subject: [PATCH 4/6] produce more compliant slack-desc + +slackware uses slightly different format for slack-desc files +from that which is used by rpm2tgz; +also remove all -l 70 options as it is only usable with l command +--- + rpm2tgz | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +diff --git a/rpm2tgz b/rpm2tgz +index 4818b74..cc25407 100755 +--- a/rpm2tgz ++++ b/rpm2tgz +@@ -204,8 +204,7 @@ for i in $* ; do + if [ "$DESC" = "true" ]; then + get_meta_data $i + mkdir -p $TMPDIR/install +- rpm -qp --qf %{SUMMARY} $i | sed -l 70 -r "s/^(.*)/$PRGNAM: $PRGNAM - \1\n/" > $TMPDIR/install/slack-desc +- rpm -qp --qf %{DESCRIPTION} $i | sed -l 70 -r "s/^/$PRGNAM: /" >> $TMPDIR/install/slack-desc ++ rpm -qp --qf '%{NAME} (%{SUMMARY})\n\n%{DESCRIPTION}\n\n %{URL}\n' $i | head -n 11 | sed -r "s/^/$PRGNAM: /" > $TMPDIR/install/slack-desc + fi + + # If this program was called as "rpm2targz", then repack as a plain +-- +1.7.0.2 + diff --git a/source/a/rpm2tgz/patches/0005-gzip-man-info-pages.patch b/source/a/rpm2tgz/patches/0005-gzip-man-info-pages.patch new file mode 100644 index 000000000..b4849c298 --- /dev/null +++ b/source/a/rpm2tgz/patches/0005-gzip-man-info-pages.patch @@ -0,0 +1,47 @@ +From 49c80142bf0f0ead2bcff8b03a39aa98e38f2dd9 Mon Sep 17 00:00:00 2001 +From: Igor Murzov <igor@gplsoft.org> +Date: Sun, 18 Apr 2010 23:11:55 +0400 +Subject: [PATCH 5/6] gzip man & info pages + +we don't want to repack package just to fix not gzipped man pages +--- + rpm2tgz | 23 +++++++++++++++++++++++ + 1 files changed, 23 insertions(+), 0 deletions(-) + +diff --git a/rpm2tgz b/rpm2tgz +index cc25407..32c450b 100755 +--- a/rpm2tgz ++++ b/rpm2tgz +@@ -206,6 +206,29 @@ for i in $* ; do + mkdir -p $TMPDIR/install + rpm -qp --qf '%{NAME} (%{SUMMARY})\n\n%{DESCRIPTION}\n\n %{URL}\n' $i | head -n 11 | sed -r "s/^/$PRGNAM: /" > $TMPDIR/install/slack-desc + fi ++ ++ # Compress and link manpages, if any: ++ if [ -d $TMPDIR/usr/man ]; then ++ ( cd $TMPDIR/usr/man ++ for manpagedir in $(find . -type d -name "man*") ; do ++ ( cd $manpagedir ++ for eachpage in $(find . -type l -maxdepth 1) ; do ++ ln -s $( readlink $eachpage ).gz $eachpage.gz ++ rm $eachpage ++ done ++ gzip -9 *.? ++ ) ++ done ++ ) ++ fi ++ ++ # Compress info files, if any: ++ if [ -d $TMPDIR/usr/info ]; then ++ ( cd $TMPDIR/usr/info ++ rm -f dir ++ gzip -9 * ++ ) ++ fi + + # If this program was called as "rpm2targz", then repack as a plain + # tar+gz archive. If it was called as "rpm2tgz", use Slackware's +-- +1.7.0.2 + diff --git a/source/a/rpm2tgz/patches/0006-should-we-use-.txz-format-in-slackware-current.patch b/source/a/rpm2tgz/patches/0006-should-we-use-.txz-format-in-slackware-current.patch new file mode 100644 index 000000000..5d86972f0 --- /dev/null +++ b/source/a/rpm2tgz/patches/0006-should-we-use-.txz-format-in-slackware-current.patch @@ -0,0 +1,45 @@ +From 60b1b269e13d6ac5f167c898f92d1c33a4caf779 Mon Sep 17 00:00:00 2001 +From: Igor Murzov <igor@gplsoft.org> +Date: Sun, 18 Apr 2010 23:19:05 +0400 +Subject: [PATCH 6/6] should we use .txz format in slackware-current? + +yes, everyone loves xz +--- + rpm2tgz | 10 +++++----- + 1 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/rpm2tgz b/rpm2tgz +index 32c450b..4dd3756 100755 +--- a/rpm2tgz ++++ b/rpm2tgz +@@ -231,22 +231,22 @@ for i in $* ; do + fi + + # If this program was called as "rpm2targz", then repack as a plain +- # tar+gz archive. If it was called as "rpm2tgz", use Slackware's +- # makepkg to produce the .tgz: ++ # tar+xz archive. If it was called as "rpm2tgz", use Slackware's ++ # makepkg to produce the .txz: + if [ "$(basename $0)" = "rpm2tgz" ]; then + ( + if [ "$META_NAME" = "true" ]; then + get_meta_data $i + cd $TMPDIR +- /sbin/makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.tgz ++ /sbin/makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.txz + else + cd $TMPDIR +- /sbin/makepkg -l y -c n $CWD/$(basename $i .rpm).tgz ++ /sbin/makepkg -l y -c n $CWD/$(basename $i .rpm).txz + fi + ) + else + ( cd $TMPDIR ; tar cf - . ) > $(basename $i .rpm).tar +- gzip -9 $(basename $i .rpm).tar ++ xz -9 $(basename $i .rpm).tar + fi + + # Remove temporary directory: +-- +1.7.0.2 + diff --git a/source/a/rpm2tgz/rpm2targz b/source/a/rpm2tgz/rpm2targz index 484e5ad05..5c91c64a4 100644 --- a/source/a/rpm2tgz/rpm2targz +++ b/source/a/rpm2tgz/rpm2targz @@ -22,22 +22,35 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -if [ "$1" = "" ]; then +CWD=$(pwd) + +# Breaking the help out into it's own deal +usage() { echo "$0: Converts RPM format to standard GNU tar + GNU zip format." echo " (view converted packages with \"less\", install and remove" echo " with \"installpkg\", \"removepkg\", \"pkgtool\", or manually" echo " with \"tar\")" echo - echo "Usage: $0 <file.rpm>" if [ "$(basename $0)" = "rpm2tgz" ]; then + echo "Usage: $0 [OPTION] <file.rpm>" echo " (Outputs \"file.tgz\")" + echo + echo " -s extract the install scripts to /usr/doc/\$PRGNAM-\$VERSION/" + echo " for review." + echo " -S extracts the install scripts to be executed on package installation" + echo " (only pre-install and post-install scripts used)" + echo " USE WITH CAUTION! " + echo " -n name the output package using the rpm's metadata" + echo " -r extract what the rpm's \"requires\" (dependencies)" + echo " as documention to /usr/doc/\$PRGNAM-\$VERSION/" + echo " -d attempt a wellformed slack-desc from the rpm meta data" + echo else + echo "Usage: $0 <file.rpm>" echo " (Outputs \"file.tar.gz\")" fi exit 1; -fi - -CWD=$(pwd) +} # Create a new temporary directory with a secure filename: make_temp_dir() { @@ -67,6 +80,51 @@ make_temp_dir() { fi } +# Get the meta data off of the rpm +get_meta_data() { + RPM=$1 + PRGNAM=$(rpm -qp --qf %{NAME} $RPM ) + ARCH=$(rpm -qp --qf %{ARCH} $RPM ) + VERSION=$(rpm -qp --qf %{VERSION} $RPM ) + BUILD=$(rpm -qp --qf %{RELEASE} $RPM ) +} + +if [ "$1" = "" ]; then + usage +fi + +ARGS=$(getopt "hsSndr" $* ) +set -- ${ARGS} +for i; do + case "$1" in + -s) + DOC_SCRIPTS="true" + shift + ;; + -S) + INSTALL_SCRIPTS="true" + shift + ;; + -r) + DOC_REQUIRES="true" + shift + ;; + -d) + DESC="true" + shift + ;; + -n) + META_NAME="true" + shift + ;; + --) + shift + break + ;; + esac +done + + for i in $* ; do # Determine if this is a source or binary RPM. @@ -78,7 +136,7 @@ for i in $* ; do isSource=0 fi else # use file. This works fine on Slackware, and is the default. - if file $i | grep RPM | grep " src " 1> /dev/null 2> /dev/null ; then + if file $i | grep RPM | grep -w src 1> /dev/null 2> /dev/null ; then isSource=1 else isSource=0 @@ -112,11 +170,56 @@ for i in $* ; do find . -type d -perm 700 -exec chmod 755 {} \; ) + # Save the scripts in the rpm as documentation + if [ "$DOC_SCRIPTS" = "true" ]; then + get_meta_data $i + mkdir -p $TMPDIR/usr/doc/$PRGNAM-$VERSION/ + for state in PREIN POSTIN PREUN POSTUN ; do + if [ "$(rpm -qp --qf %{$state} $i )" != '(none)' ] ; then + rpm -qp --qf %{$state} $i > $TMPDIR/usr/doc/$PRGNAM-$VERSION/$state.script + fi + done + fi + + # Save the scripts in the rpm to be installed + if [ "$INSTALL_SCRIPTS" = "true" ]; then + mkdir -p $TMPDIR/install + echo '#!/bin/sh' > $TMPDIR/install/doinst.sh + for state in PREIN POSTIN ; do + if [ "$(rpm -qp --qf %{$state} $i )" != '(none)' ] ; then + rpm -qp --qf %{$state} $i > $TMPDIR/install/doinst.sh + echo "" >> $TMPDIR/install/doinst.sh + fi + done + fi + + # Save the rpm's requires (dependencies) as documentation + if [ "$DOC_REQUIRES" = "true" ]; then + get_meta_data $i + mkdir -p $TMPDIR/usr/doc/$PRGNAM-$VERSION/ + rpm -qp --qf %{REQUIRES} $i > $TMPDIR/usr/doc/$PRGNAM-$VERSION/README-$PRGNAM-rpm-dependencies.txt + fi + + # Save the rpm's summary and description as the slack-desc + if [ "$DESC" = "true" ]; then + mkdir -p $TMPDIR/install + rpm -qp --qf %{SUMMARY} $i | sed -l 70 -r "s/^(.*)/$PRGNAM: $PRGNAM - \1\n/" > $TMPDIR/install/slack-desc + rpm -qp --qf %{DESCRIPTION} $i | sed -l 70 -r "s/^/$PRGNAM: /" >> $TMPDIR/install/slack-desc + fi + # If this program was called as "rpm2targz", then repack as a plain # tar+gz archive. If it was called as "rpm2tgz", use Slackware's # makepkg to produce the .tgz: if [ "$(basename $0)" = "rpm2tgz" ]; then - ( cd $TMPDIR ; makepkg -l y -c n $CWD/$(basename $i .rpm).tgz ) + ( + cd $TMPDIR + if [ "$META_NAME" = "true" ]; then + get_meta_data $CWD/$i + makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-${BUILD}.tgz + else + makepkg -l y -c n $CWD/$(basename $i .rpm).tgz + fi + ) else ( cd $TMPDIR ; tar cf - . ) > $(basename $i .rpm).tar gzip -9 $(basename $i .rpm).tar diff --git a/source/a/rpm2tgz/rpm2tgz.SlackBuild b/source/a/rpm2tgz/rpm2tgz.SlackBuild index abfe3298a..c6d766093 100755 --- a/source/a/rpm2tgz/rpm2tgz.SlackBuild +++ b/source/a/rpm2tgz/rpm2tgz.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA +# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, Minnesota, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -20,13 +20,22 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -VERSION=1.1 -ARCH=${ARCH:-x86_64} +VERSION=1.2.1 BUILD=${BUILD:-1} +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + CWD=$(pwd) TMP=${TMP:-/tmp} -PKG=$TMP/package-bin +PKG=$TMP/package-rpm2tgz rm -rf $PKG mkdir -p $TMP $PKG @@ -38,8 +47,26 @@ cd $TMP mkdir -p $PKG/usr/bin cc -o $PKG/usr/bin/rpmoffset $CWD/rpmoffset.c cat $CWD/rpm2targz > $PKG/usr/bin/rpm2targz -chmod 755 $PKG/usr/bin/{rpmoffset,rpm2targz} + +# Apply some patches: +( cd $PKG/usr/bin + # These are all against "rpm2tgz", so mv it until we are done patching: + mv rpm2targz rpm2tgz + zcat $CWD/patches/0001-fix-d-handling.patch.gz | patch -p1 || exit 1 + zcat $CWD/patches/0002-fix-spurious-path-to-rpm-file-with-n-option.patch.gz | patch -p1 || exit 1 + zcat $CWD/patches/0003-allow-every-user-to-use-rpm2tgz.patch.gz | patch -p1 || exit 1 + zcat $CWD/patches/0004-produce-more-compliant-slack-desc.patch.gz | patch -p1 || exit 1 + # Not applied. Rationale: We do not want to alter the files in the RPM. + #zcat $CWD/patches/0005-gzip-man-info-pages.patch.gz | patch -p1 || exit 1 + # Not applied. Rationale: .tgz works with all versions of Slackware. + # Translated RPMs may be targeting systems with no .txz support. + #zcat $CWD/patches/0006-should-we-use-.txz-format-in-slackware-current.patch.gz | patch -p1 || exit 1 + # mv the script back: + mv rpm2tgz rpm2targz +) || exit 1 + ( cd $PKG/usr/bin ; ln -sf rpm2targz rpm2tgz ) +chmod 755 $PKG/usr/bin/{rpmoffset,rpm2targz} mkdir -p $PKG/usr/doc/rpm2targz cp -a $CWD/rpm2targz.README $PKG/usr/doc/rpm2targz/rpm2targz.README chown root:root $PKG/usr/doc/rpm2targz/rpm2targz.README diff --git a/source/a/rpm2tgz/rpmoffset.c b/source/a/rpm2tgz/rpmoffset.c index 57af397c6..fd09e623b 100644 --- a/source/a/rpm2tgz/rpmoffset.c +++ b/source/a/rpm2tgz/rpmoffset.c @@ -5,6 +5,7 @@ /* Wouldn't it be a lot more sane if we could just untar these things? */ #include <stdlib.h> +#include <stdio.h> /* These offsets keep getting bigger, so we're going to just bite a 2MB */ /* chunk of RAM right away so that we have enough. Yeah, horrible */ |