📄 bisect-builds
字号:
); print $fh "<meta http-equiv=\"refresh\" content=\"0; $url\">\n"; close($fh); return $tempFile;}sub downloadNightly($$$){ my ($filename, $urlBase, $directory) = @_; my $path = File::Spec->catfile($directory, $filename); if (! -f $path) { print "Downloading $filename to $directory...\n"; `curl -# -o '$path' '$urlBase/$filename'`; }}sub findMacOSXVersion(){ my $version; open(SW_VERS, "-|", "/usr/bin/sw_vers") || die; while (<SW_VERS>) { $version = $1 if /^ProductVersion:\s+([^\s]+)/; } close(SW_VERS); return $version;}sub findNearestNightlyIndex(\@$$){ my ($nightlies, $revision, $round) = @_; my $lowIndex = 0; my $highIndex = $#{$nightlies}; return $highIndex if uc($revision) eq 'HEAD' || $revision >= $nightlies->[$highIndex]->{rev}; return $lowIndex if $revision <= $nightlies->[$lowIndex]->{rev}; while (abs($highIndex - $lowIndex) > 1) { my $index = $lowIndex + int(($highIndex - $lowIndex) / 2); if ($revision < $nightlies->[$index]->{rev}) { $highIndex = $index; } elsif ($revision > $nightlies->[$index]->{rev}) { $lowIndex = $index; } else { return $index; } } return ($round eq "floor") ? $lowIndex : $highIndex;}sub findSafariVersion($){ my ($path) = @_; my $versionPlist = File::Spec->catdir(dirname(dirname($path)), "version.plist"); my $version; open(PLIST, "< $versionPlist") || die; while (<PLIST>) { if (m#^\s*<key>CFBundleShortVersionString</key>#) { $version = <PLIST>; $version =~ s#^\s*<string>(.+)</string>\s*[\r\n]*#$1#; } } close(PLIST); return $version;}sub loadSettings(){ package Settings; our $branch = "trunk"; our $nightlyDownloadDirectory = File::Spec->catdir($ENV{HOME}, "Library/Caches/WebKit-Nightlies"); our $safariPath = "/Applications/Safari.app"; my $rcfile = File::Spec->catdir($ENV{HOME}, ".bisect-buildsrc"); return if !-f $rcfile; my $result = do $rcfile; die "Could not parse $rcfile: $@" if $@;}sub makeNightlyList($$$$){ my ($useLocalFiles, $localDirectory, $macOSXVersion, $safariVersion) = @_; my @files; if ($useLocalFiles) { opendir(DIR, $localDirectory) || die "$!"; foreach my $file (readdir(DIR)) { if ($file =~ /^WebKit-SVN-r([0-9]+)\.dmg$/) { push(@files, +{ rev => $1, file => $file }); } } closedir(DIR); } else { open(NIGHTLIES, "curl -s $nightlyBuildsURLBase/all |") || die; while (my $line = <NIGHTLIES>) { chomp $line; my ($revision, $timestamp, $url) = split(/,/, $line); my $nightly = basename($url); push(@files, +{ rev => $revision, file => $nightly }); } close(NIGHTLIES); } if (eval "v$macOSXVersion" ge v10.5) { if (eval "v$safariVersion" ge v3.2) { @files = grep { $_->{rev} >= 37348 } @files; } elsif (eval "v$safariVersion" ge v3.1) { @files = grep { $_->{rev} >= 29711 } @files; } elsif (eval "v$safariVersion" ge v3.0) { @files = grep { $_->{rev} >= 25124 } @files; } elsif (eval "v$safariVersion" ge v2.0) { @files = grep { $_->{rev} >= 19594 } @files; } else { die "Requires Safari 2.0 or newer"; } } elsif (eval "v$macOSXVersion" ge v10.4) { if (eval "v$safariVersion" ge v3.2) { @files = grep { $_->{rev} >= 37348 } @files; } elsif (eval "v$safariVersion" ge v3.1) { @files = grep { $_->{rev} >= 29711 } @files; } elsif (eval "v$safariVersion" ge v3.0) { @files = grep { $_->{rev} >= 19992 } @files; } elsif (eval "v$safariVersion" ge v2.0) { @files = grep { $_->{rev} >= 11976 } @files; } else { die "Requires Safari 2.0 or newer"; } } else { die "Requires Mac OS X 10.4 (Tiger) or 10.5 (Leopard)"; } my $nightlycmp = sub { return $a->{rev} <=> $b->{rev}; }; return sort $nightlycmp @files;}sub mountAndRunNightly($$$$){ my ($filename, $directory, $safari, $tempFile) = @_; my $mountPath = "/Volumes/WebKit"; my $webkitApp = File::Spec->catfile($mountPath, "WebKit.app"); my $diskImage = File::Spec->catfile($directory, $filename); my $i = 0; while (-e $mountPath) { $i++; usleep 100 if $i > 1; `hdiutil detach '$mountPath' 2> /dev/null`; die "Could not unmount $diskImage at $mountPath" if $i > 100; } die "Can't mount $diskImage: $mountPath already exists!" if -e $mountPath; print "Mounting disk image and running WebKit...\n"; `hdiutil attach '$diskImage'`; $i = 0; while (! -e $webkitApp) { usleep 100; $i++; die "Could not mount $diskImage at $mountPath" if $i > 100; } my $frameworkPath; if (-d "/Volumes/WebKit/WebKit.app/Contents/Frameworks") { my $osXVersion = join('.', (split(/\./, findMacOSXVersion()))[0..1]); $frameworkPath = "/Volumes/WebKit/WebKit.app/Contents/Frameworks/$osXVersion"; } else { $frameworkPath = "/Volumes/WebKit/WebKit.app/Contents/Resources"; } $tempFile ||= ""; `DYLD_FRAMEWORK_PATH=$frameworkPath WEBKIT_UNSET_DYLD_FRAMEWORK_PATH=YES $safari $tempFile`; `hdiutil detach '$mountPath' 2> /dev/null`;}sub parseRevisions($$;$){ my ($optionName, $value, $ignored) = @_; if ($value =~ /^r?([0-9]+|HEAD):?$/i) { push(@revisions, $1); die "Too many revision arguments specified" if scalar @revisions > 2; } elsif ($value =~ /^r?([0-9]+):?r?([0-9]+|HEAD)$/i) { $revisions[0] = $1; $revisions[1] = $2; } else { die "Unknown revision '$value': expected 'M' or 'M:N'"; }}sub printStatus($$$){ my ($startRevision, $endRevision, $isProgression) = @_; printf "\n%s: r%s %s: r%s\n", $isProgression ? "Fails" : "Works", $startRevision, $isProgression ? "Works" : "Fails", $endRevision;}sub promptForTest($){ my ($revision) = @_; print "Did the bug reproduce in r$revision (yes/no/broken)? "; my $answer = <STDIN>; return 1 if $answer =~ /^(1|y.*)$/i; return -1 if $answer =~ /^(-1|b.*)$/i; # Broken return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -