From: Alexey Tourbin <at@altlinux.ru>
To: devel@altlinux.ru
Subject: [devel] Re: sisyphus-daily?
Date: Wed, 19 Nov 2003 21:36:35 +0300
Message-ID: <20031119183635.GU1860@julia.office.altlinux.ru> (raw)
In-Reply-To: <20031119163645.GA14907@osdn.org.ua>
[-- Attachment #1.1: Type: text/plain, Size: 319 bytes --]
On Wed, Nov 19, 2003 at 06:36:45PM +0200, Michael Shigorin wrote:
> CVS или еще что? Диффы почтой -- несколько архаический подход,
> кажется.
>
> specfiles -- понятно, а вот исходники... это гораздо сложнее.
>
> PS: давайте-ка для начала просто спеки выложите, а?
Не знаю.
Правильный (но сырой) скрипт прилагается.
[-- Attachment #1.2: rpmcmp.pl --]
[-- Type: text/plain, Size: 2315 bytes --]
#!/usr/bin/perl
use Cwd qw(realpath);
use File::Temp qw(tempdir);
use Getopt::Long qw(GetOptions);
use strict;
GetOptions "deep" => \my $opt_deep;
sub tmp_unpack($) {
my $rpm = shift;
my $dir = tempdir(CLEANUP => 1);
chdir $dir;
system "rpm2cpio $rpm | cpio -idm 2>/dev/null";
return $dir;
}
sub uncompress($) {
my $dir = shift;
chdir $dir;
system "gunzip *.gz &>/dev/null";
system "bunzip *.bz2 &>/dev/null";
system "tar xf *.tar &>/dev/null && rm -f *.tar";
}
sub cmp_rm($$) {
my ($f1, $f2) = @_;
my $rv;
if (-e $f1 && -e $f2) {
$rv = `LC_ALL=C TZ=UTC0 diff -abBdpruw $f1 $f2`;
system "rm -rf $f1 $f2";
}
return $rv;
}
sub _cmp_eq($$) {
return $_[0] eq $_[1];
}
sub _cmp_az($$) {
(my $az1 = $_[0]) =~ s/[^a-z]//g;
(my $az2 = $_[1]) =~ s/[^a-z]//g;
return $az1 eq $az2;
}
sub same_type($$) {
my ($f1, $f2) = @_;
return "f" if -f $f1 && -f $f2;
return "d" if -d $f1 && -d $f2 && $opt_deep;
return;
}
sub supercmp($$$) {
my ($dir1, $dir2, $glob) = @_;
my $diff;
try: while (1) {
foreach my $cmp_func (\&_cmp_eq, \&_cmp_az) {
chdir $dir1; my @f1 = <*>;
foreach my $f1 (@f1) {
chdir $dir2; my @f2 = <*>;
foreach my $f2 (@f2) {
if ($cmp_func->($f1, $f2) && same_type("$dir1/$f1", "$dir2/$f2")) {
$diff .= cmp_rm "$dir1/$f1", "$dir2/$f2";
next try;
}
}
}
}
last;
}
return $diff;
}
sub rpmcmp ($$) {
my ($rpm1, $rpm2) = map { realpath($_) } @_;
my ($name1, $name2) = map { /.*\/(.+?)\.src\.rpm/ } ($rpm1, $rpm2);
-f $rpm1 or die "$rpm1: $!\n";
-f $rpm2 or die "$rpm2: $!\n";
my $dir1 = tmp_unpack $rpm1; uncompress $dir1;
my $dir2 = tmp_unpack $rpm2; uncompress $dir2;
my $diff = supercmp($dir1, $dir2, "*.spec");
$diff .= supercmp($dir1, $dir2, "*.patch");
$diff .= supercmp($dir1, $dir2, "*");
# see the rest
$diff .= "End of diff\n";
my $rest1 = `/bin/ls -AF $dir1`;
$diff .= "\nFiles not compared in $dir1\:\n$rest1\n" if $rest1 =~ /\S/;
my $rest2 = `/bin/ls -AF $dir2`;
$diff .= "\nFiles not compared in $dir2\:\n$rest2\n" if $rest2 =~ /\S/;
# filter out temporary dirs
$diff =~ s/\Q$dir1/$name1/g;
$diff =~ s/\Q$dir2/$name2/g;
return $diff;
}
@ARGV == 2 and -f $ARGV[0] and -f $ARGV[1] or print <<EOF and exit 1;
usage:
$0 [--deep] package1.src.rpm package2.src.rpm
EOF
print rpmcmp $ARGV[0], $ARGV[1];
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2003-11-19 18:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-19 15:23 [devel] sisyphus-daily? Alexey Tourbin
2003-11-19 15:28 ` Sergey V Turchin
2003-11-19 15:33 ` [devel] Re: [sisyphus] sisyphus-daily? Sergey Vlasov
2003-11-19 15:36 ` Sergey V Turchin
2003-11-19 15:37 ` [devel] sisyphus-daily? Alexey Tourbin
2003-11-19 16:36 ` Michael Shigorin
2003-11-19 16:56 ` Sergey Vlasov
2003-11-19 17:46 ` Michael Shigorin
2003-11-19 18:40 ` Yuri N. Sedunov
2003-11-20 7:29 ` Sviataslau Svirydau
2003-11-20 9:23 ` Alexander Bokovoy
2003-11-20 17:23 ` Sviataslau Svirydau
2003-11-19 18:36 ` Alexey Tourbin [this message]
2003-11-19 19:18 ` Alexey Tourbin
2003-11-19 19:25 ` Michael Shigorin
2003-11-19 19:37 ` Alexey Tourbin
2003-11-19 20:17 ` Michael Shigorin
2003-11-19 19:29 ` Alexey Tourbin
2003-11-20 1:20 ` [devel] Re: [sisyphus] " Alexey Morozov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031119183635.GU1860@julia.office.altlinux.ru \
--to=at@altlinux.ru \
--cc=devel@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git