From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sun, 11 Sep 2005 21:06:44 +0400 From: Alexey Tourbin To: ALT Devel discussion list Message-ID: <20050911170644.GE3290@solemn.turbinal.org> Mail-Followup-To: ALT Devel discussion list References: <20050902201456.GF7033@solemn.turbinal.org> <20050902210007.GA32163@basalt.office.altlinux.org> <20050905034357.GM3539@solemn.turbinal.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UBnjLfzoMQYIXCvq" Content-Disposition: inline In-Reply-To: <20050905034357.GM3539@solemn.turbinal.org> Cc: Subject: [devel] Re: librpm payload X-BeenThere: devel@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2005 17:08:10 -0000 Archived-At: List-Archive: List-Post: --UBnjLfzoMQYIXCvq Content-Type: multipart/mixed; boundary="RpqchZ26BWispMcB" Content-Disposition: inline --RpqchZ26BWispMcB Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 05, 2005 at 07:43:57AM +0400, Alexey Tourbin wrote: > =EB=C1=CB =DE=C9=D4=C1=D4=D8 =D0=CF=D4=CF=CB cpio, =D1 =D2=C1=DA=CF=C2=D2= =C1=CC=D3=D1. =F4=C5=D0=C5=D2=D8 =C4=C1=CC=D8=DB=C5, =CB=C1=CB =D0=C1=D2= =D3=C9=D4=D8 cpio? > =F5 =CE=C5=C7=CF =CB=C1=CB=CF=CA-=D4=CF =C8=C9=D4=D2=D9=CA padding (=D3= =CD. TODO). =EB=C1=CB libmagic =D0=CF=C4=CB=CC=C0=DE=C9=D4=D8 -- > =D7=D2=CF=C4=C5 =D1=D3=CE=CF, magic_buffer(). >=20 > =FE=D4=CF-=D4=CF =D4=C1=CB=CF=C5 =C5=D3=D4=D8 =D7 rpm-4_0-4.0.4/lib/{cpio= ,fsm}.{c,h}, =CE=CF =C9=CD > =D7=CF=D3=D0=CF=CC=D8=DA=CF=D7=C1=D4=D8=D3=D1 =CF=DE=C5=CE=D8 =D0=D2=CF= =C2=CC=C5=CD=CE=CF. =EE=C5=D4, =DA=C1=C4=CF=CC=C2=C1=CC=CF =CE=C1 =F3=C9 =D0=C9=D3=C1=D4=D8. = =FC=D4=CF =CB=CF=CE=D4=D2=D0=D2=CF=C4=D5=CB=D4=C9=D7=CE=CF. =ED=CF=D6=CE= =CF =DE=D4=CF-=CE=C9=C2=D5=C4=D8 =D3=C4=C5=CC=C1=D4=D8, =C1 =CD=CF=D6=CE=CF =D3=C9=C4=C5=D4=D8 =C9 =D0=C5=CA= =D3=C1=D4=D8 =CE=C1 =F3=C9. =EE=D5 =C5=C7=CF =D7 =C2=C1=CE=C0. =EE=C1=D0=C9=D3=C1=CC =CE=C1 =DB=C5=CC=CC=C5, =D3 =CB=C5=DB=C9=D2=CF=D7=C1= =CE=C9=C5=CD =C4=CC=D1 =CB=C1=D4=C1=CC=CF=C7=CF=D7. =E4=CC=D1 =D2=CF=C2=CF= =D4=C1 =DC=D4=CF =D7=C1=D6=CE=CF -- =CF=DE=C5=CE=D8 =C4=CF=CC=C7=CF (=D3 =D2=C1=D3=D0=C1=CB=CF=D7=CB=CF=CA =D7= =D3=C5=C8 rpm'=CF=D7) =D4=CF=CC=D8=CB=CF =CF=C4=C9=CE =D2=C1=DA =C2=D5=C4= =C5=D4 =D2=C1=C2=CF=D4=C1=D4=D8. $ ./rpmfile -h Usage: rpmfile [-h] [*FILE*...] [*DIR*...] $ ./rpmfile ~/build/repo/i586/RPMS.hasher/qa-robot-0.2-alt1.noarch.rpm /usr/bin/bugs 100755 Bourne shell script text executable /usr/bin/csv2tab 100755 perl script text executable =2E.. $ ./rpmfile ~/build/repo/i586/RPMS.hasher |sort -t$'\t' -k1,1 -u libsqlite3 /usr/lib/libsqlite3.so.0 120777 symbolic link to `libsqlite3.so.= 0.8.6' libsqlite3-devel /usr/include/sqlite3.h 100644 ASCII C program text =2E.. $ =F4=CF =C5=D3=D4=D8 =C5=D3=CC=C9 "=C4=C1=CD=D0=C9=D4=D8" =CB=C1=D4=C1=CC=CF= =C7, =D4=CF =D7=D0=C5=D2=C5=C4=C9 =C4=CF=C2=C1=D7=CC=D1=C5=D4=D3=D1 =C5=DD= =A3 =D0=CF=C4=CE=CF =D0=CF=CC=C5 -- =C9=CD=D1 =D0=C1=CB=C5=D4=C1. =F0=D2=C1=D7=C9=CC=D8=CE=C5=C5 =C2=D9=CC=CF = =C2=D9 =C4=CF=C2=C1=D7=CC=D1=D4=D8 =CE=C5 =C9=CD=D1 =D0=C1=CB=C5=D4=C1, =C1= =D3=CF=C2=D3=D4=D7=C5=CE=CE=CF =C9=CD=D1 =C6=C1=CA=CC=C1, =CE=CF =CD=CE=C5 =D3=C5=CA=DE=C1=D3 =CE=D5=D6=CE= =C5=C5 =C9=CD=D1 =D0=C1=CB=C5=D4=C1. =E1 =CB=C5=DB=C9=D2=CF=D7=C1=CE=C9=C5 =D2=C1=C2=CF=D4=C1=C5=D4 =D4=C1=CB: $ rm -rf ~/tmp/tmp $ mkdir -p ~/tmp/tmp $ time workdir=3D~/tmp/tmp ./rpmfile ~/build/repo/i586/RPMS.hasher >/dev/nu= ll workdir=3D~/tmp/tmp ./rpmfile ~/build/repo/i586/RPMS.hasher > /dev/null 16= ,70s user 4,81s system 95% cpu 22,606 total $ time workdir=3D~/tmp/tmp ./rpmfile ~/build/repo/i586/RPMS.hasher >/dev/nu= ll workdir=3D~/tmp/tmp ./rpmfile ~/build/repo/i586/RPMS.hasher > /dev/null 1,= 46s user 0,22s system 99% cpu 1,685 total $ =F4=D2=C0=CB =D3 paste(1) -- =D0=CF =CD=CF=C5=CD=D5, =CB=D2=C1=D3=C9=D7=CF.= :) --RpqchZ26BWispMcB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=rpmfile #!/bin/sh -ef export LC_ALL=C dump_file() { rpm -qp --qf '[%{FILENAMES}\t%{FILEMODES:octal}\n]' "$@" >files if [ -d d ]; then chmod -Rf u+rwX d; rm -rf d; fi rpm2cpio "$@" |(mkdir d; cd d; cpio -idmu --quiet) awk -F'\t' '{printf"d/%s\0",$1}' files |xargs -r0 file -b >types paste files types } dump_dir() { local d="$1"; shift packages "$d" >packages sort -t$'\t' -o packages -u -k1,1 packages mkdir -p c while IFS=$'\t' read p v f _; do b="${f%%.rpm}" [ -f c/"$b" ] || dump_file "$d/$f" >c/"$b" awk -v p="$p" '{print p"\t"$0}' c/"$b" done [B<-h>] [I...] [I...] =head1 AUTHOR Written by Alexey Tourbin . =head1 COPYING Copyright (c) 2005 Alexey Tourbin, ALT Linux Team. This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. =head1 SEE ALSO rpm(8), rpm2cpio(8), file(1) =cut __EOF__ --RpqchZ26BWispMcB-- --UBnjLfzoMQYIXCvq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFDJGQkfBKgtDjnu0YRAvOJAKDeTkMnMnwIYlewyvKhxQJwIj0ooACgx2Cb SPPWn85XHY1gil14f7z4qPc= =NXj/ -----END PGP SIGNATURE----- --UBnjLfzoMQYIXCvq--