catch links

This commit is contained in:
Stephan Kulow 2013-06-27 19:31:13 +02:00
parent 459b45d323
commit 49b3bc3fcf
3 changed files with 29 additions and 11 deletions

View File

@ -77,6 +77,11 @@ while(<FL>) {
$fls = 0; $fls = 0;
next; next;
} }
my $lnk = '';
if (/^(12.*)( -> .*?)$/) {
$_ = $1;
$lnk = $2;
}
next unless /^(\d+ (\d+) \S+) (.*\/)(.*?)$/; next unless /^(\d+ (\d+) \S+) (.*\/)(.*?)$/;
my $n = $dirs{$3}; my $n = $dirs{$3};
if (!defined($n)) { if (!defined($n)) {
@ -84,11 +89,13 @@ while(<FL>) {
$dirs{$3} = $n; $dirs{$3} = $n;
$dirs[$n] = $3; $dirs[$n] = $3;
} }
my $m = $modes{$1}; # ignore link targets of ghosts
$lnk = '' if $lnk && (oct($2) & 0100) != 0;
my $m = $modes{"$1$lnk"};
if (!defined($m)) { if (!defined($m)) {
$m = @modes; $m = @modes;
$modes{$1} = $m; $modes{"$1$lnk"} = $m;
$modes[$m] = $1; $modes[$m] = "$1$lnk";
$modes_type[$m] = oct($1) & 07770000; $modes_type[$m] = oct($1) & 07770000;
$modes_ghost[$m] = oct($2) & 0100; $modes_ghost[$m] = oct($2) & 0100;
} }
@ -155,6 +162,7 @@ while(<FL>) {
} }
close(FL) || die("close failed\n"); close(FL) || die("close failed\n");
print "currently have ".@dirs." dirs and ".@modes." modes\n";
# connect dirs and add all dirs as files # connect dirs and add all dirs as files
print "connecting ".@dirs." directories\n"; print "connecting ".@dirs." directories\n";
@ -324,14 +332,14 @@ for my $tc (sort keys %tocheck) {
for my $f (@{$tocheck_files{$tc}}) { for my $f (@{$tocheck_files{$tc}}) {
my @pp = grep {s/^(?:\Q$p1\E|\Q$p2\E)\///} map {$_} @{$filesc{$f}}; my @pp = grep {s/^(?:\Q$p1\E|\Q$p2\E)\///} map {$_} @{$filesc{$f}};
next unless @pp; next unless @pp;
# ignore if (all directories or all ghosts) and all same mode; # ignore if (all directories or all ghosts or all links) and all same mode;
my %allm = map {$_ => 1} @pp; my %allm = map {$_ => 1} @pp;
my $info = ''; my $info = '';
if (keys(%allm) == 1) { if (keys(%allm) == 1) {
my $m = (keys(%allm))[0]; my $m = (keys(%allm))[0];
# all modes/flags are the same # all modes/flags are the same
# no conflict if all dirs or all ghosts # no conflict if all dirs or all ghosts or all links
next if $modes_type[$m] == 040000 || $modes_ghost[$m] == 0100; next if $modes_type[$m] == 040000 || $modes_type[$m] == 120000 || $modes_ghost[$m] == 0100;
} else { } else {
# don't report mode mismatches for files/symlinks that are not ghosts # don't report mode mismatches for files/symlinks that are not ghosts
for my $m (keys %allm) { for my $m (keys %allm) {

View File

@ -329,7 +329,8 @@ def _check_repo_repo_list(self, prj, repo, arch, pkg, opts):
continue continue
files.append((fn, pname, result.group(4))) files.append((fn, pname, result.group(4)))
except urllib2.HTTPError: except urllib2.HTTPError:
print "error", url pass
#print "error", url
return files return files
@ -393,7 +394,7 @@ def _get_base_build_bin(self, opts):
"""Get Base:build pagacke list""" """Get Base:build pagacke list"""
binaries = {} binaries = {}
for arch in ('x86_64', 'i586'): for arch in ('x86_64', 'i586'):
url = makeurl(opts.apiurl, ['/build/Base:build/standard/%s/_repository'%arch,]) url = makeurl(opts.apiurl, ['/build/openSUSE:Factory:Build/standard/%s/_repository'%arch,])
f = http_GET(url) f = http_GET(url)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
binaries[arch] = set([e.attrib['filename'][:-4] for e in root.findall('binary')]) binaries[arch] = set([e.attrib['filename'][:-4] for e in root.findall('binary')])
@ -402,7 +403,7 @@ def _get_base_build_bin(self, opts):
def _get_base_build_src(self, opts): def _get_base_build_src(self, opts):
"""Get Base:build pagacke list""" """Get Base:build pagacke list"""
url = makeurl(opts.apiurl, ['/source/Base:build',]) url = makeurl(opts.apiurl, ['/source/openSUSE:Factory:Build',])
f = http_GET(url) f = http_GET(url)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
return set([e.attrib['name'] for e in root.findall('entry')]) return set([e.attrib['name'] for e in root.findall('entry')])
@ -460,6 +461,7 @@ def _check_repo_group(self, id, reqs, opts):
outliers = build_deps - base_build_bin[arch] outliers = build_deps - base_build_bin[arch]
if outliers: if outliers:
print 'Outliers (%s)'%arch, outliers print 'Outliers (%s)'%arch, outliers
p.updated = True
for p in reqs: for p in reqs:
smissing = [] smissing = []

View File

@ -10,6 +10,7 @@ use XML::Simple;
use Data::Dumper; use Data::Dumper;
use Cwd; use Cwd;
use Rpm; use Rpm;
use Fcntl;
use strict; use strict;
@ -80,7 +81,7 @@ sub write_package($$)
} }
my %qq = Build::Rpm::rpmq("$package", qw{NAME VERSION RELEASE ARCH OLDFILENAMES DIRNAMES BASENAMES DIRINDEXES 1030 1037 1039 1040 my %qq = Build::Rpm::rpmq("$package", qw{NAME VERSION RELEASE ARCH OLDFILENAMES DIRNAMES BASENAMES DIRINDEXES 1030 1037 1039 1040
1047 1112 1113 1049 1048 1050 1090 1114 1115 1054 1053 1055 1047 1112 1113 1049 1048 1050 1090 1114 1115 1054 1053 1055 1036
}); });
my $name = $qq{'NAME'}[0]; my $name = $qq{'NAME'}[0];
@ -107,6 +108,7 @@ sub write_package($$)
my @users = @{$qq{1039} || []}; my @users = @{$qq{1039} || []};
my @groups = @{$qq{1040} || []}; my @groups = @{$qq{1040} || []};
my @flags = @{$qq{1037} || []}; my @flags = @{$qq{1037} || []};
my @linktos = @{$qq{1036} || []};
my @xprvs; my @xprvs;
@ -116,12 +118,18 @@ sub write_package($$)
my $user = shift @users; my $user = shift @users;
my $group = shift @groups; my $group = shift @groups;
my $flag = shift @flags; my $flag = shift @flags;
my $linkto = shift @linktos;
my $filename = $dirs[$di] . $bname; my $filename = $dirs[$di] . $bname;
$out .= sprintf "%o %o %s:%s %s\n", $mode, $flag, $user, $group, $filename; my $fs = $filename;
if (Fcntl::S_ISLNK($mode)) {
$fs = "$filename -> $linkto";
}
$out .= sprintf "%o %o %s:%s %s\n", $mode, $flag, $user, $group, $fs;
if ( $filename =~ /^\/etc\// || $filename =~ /bin\// || $filename eq "/usr/lib/sendmail" ) { if ( $filename =~ /^\/etc\// || $filename =~ /bin\// || $filename eq "/usr/lib/sendmail" ) {
push @xprvs, $filename; push @xprvs, $filename;
} }
} }
$out .= "-Flx:\n"; $out .= "-Flx:\n";
$out .= "+Prv:\n"; $out .= "+Prv:\n";