From 49b3bc3fcf191e64f88407e777014af982f2dc87 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 27 Jun 2013 19:31:13 +0200 Subject: [PATCH] catch links --- findfileconflicts | 20 ++++++++++++++------ osc-check_repo.py | 8 +++++--- repo-checker.pl | 12 ++++++++++-- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/findfileconflicts b/findfileconflicts index 1ca4269e..cb3dfe98 100755 --- a/findfileconflicts +++ b/findfileconflicts @@ -77,6 +77,11 @@ while() { $fls = 0; next; } + my $lnk = ''; + if (/^(12.*)( -> .*?)$/) { + $_ = $1; + $lnk = $2; + } next unless /^(\d+ (\d+) \S+) (.*\/)(.*?)$/; my $n = $dirs{$3}; if (!defined($n)) { @@ -84,11 +89,13 @@ while() { $dirs{$3} = $n; $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)) { $m = @modes; - $modes{$1} = $m; - $modes[$m] = $1; + $modes{"$1$lnk"} = $m; + $modes[$m] = "$1$lnk"; $modes_type[$m] = oct($1) & 07770000; $modes_ghost[$m] = oct($2) & 0100; } @@ -155,6 +162,7 @@ while() { } close(FL) || die("close failed\n"); +print "currently have ".@dirs." dirs and ".@modes." modes\n"; # connect dirs and add all dirs as files print "connecting ".@dirs." directories\n"; @@ -324,14 +332,14 @@ for my $tc (sort keys %tocheck) { for my $f (@{$tocheck_files{$tc}}) { my @pp = grep {s/^(?:\Q$p1\E|\Q$p2\E)\///} map {$_} @{$filesc{$f}}; 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 $info = ''; if (keys(%allm) == 1) { my $m = (keys(%allm))[0]; # all modes/flags are the same - # no conflict if all dirs or all ghosts - next if $modes_type[$m] == 040000 || $modes_ghost[$m] == 0100; + # no conflict if all dirs or all ghosts or all links + next if $modes_type[$m] == 040000 || $modes_type[$m] == 120000 || $modes_ghost[$m] == 0100; } else { # don't report mode mismatches for files/symlinks that are not ghosts for my $m (keys %allm) { diff --git a/osc-check_repo.py b/osc-check_repo.py index ffb8a032..a577266b 100644 --- a/osc-check_repo.py +++ b/osc-check_repo.py @@ -329,7 +329,8 @@ def _check_repo_repo_list(self, prj, repo, arch, pkg, opts): continue files.append((fn, pname, result.group(4))) except urllib2.HTTPError: - print "error", url + pass + #print "error", url return files @@ -393,7 +394,7 @@ def _get_base_build_bin(self, opts): """Get Base:build pagacke list""" binaries = {} 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) root = ET.parse(f).getroot() 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): """Get Base:build pagacke list""" - url = makeurl(opts.apiurl, ['/source/Base:build',]) + url = makeurl(opts.apiurl, ['/source/openSUSE:Factory:Build',]) f = http_GET(url) root = ET.parse(f).getroot() 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] if outliers: print 'Outliers (%s)'%arch, outliers + p.updated = True for p in reqs: smissing = [] diff --git a/repo-checker.pl b/repo-checker.pl index dd5ee299..a8675348 100644 --- a/repo-checker.pl +++ b/repo-checker.pl @@ -10,6 +10,7 @@ use XML::Simple; use Data::Dumper; use Cwd; use Rpm; +use Fcntl; 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 - 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]; @@ -107,6 +108,7 @@ sub write_package($$) my @users = @{$qq{1039} || []}; my @groups = @{$qq{1040} || []}; my @flags = @{$qq{1037} || []}; + my @linktos = @{$qq{1036} || []}; my @xprvs; @@ -116,12 +118,18 @@ sub write_package($$) my $user = shift @users; my $group = shift @groups; my $flag = shift @flags; + my $linkto = shift @linktos; 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" ) { push @xprvs, $filename; } + } $out .= "-Flx:\n"; $out .= "+Prv:\n";