FreeBSD Bugzilla – Attachment 212183 Details for
Bug 244549
ports-mgmt/pkg(-devel): repository FreeBSD contains packages with wrong ABI: FreeBSD:1x.0:amd64
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Build Status of Packages
BuildStatus (text/plain), 6.69 KB, created by
mfv
on 2020-03-06 12:19:31 UTC
(
hide
)
Description:
Build Status of Packages
Filename:
MIME Type:
Creator:
mfv
Created:
2020-03-06 12:19:31 UTC
Size:
6.69 KB
patch
obsolete
>#!/usr/local/bin/perl > ># $Author: mfv $ ># $Date: 2018/10/15 05:47:43 $ ># $Revision: 1.14 $ ># $Source: /home/mfv/bin/RCS/BuildStatus,v $ > ># Purpose: Ascertain current status of package building for amd64, r12.1 ># Usage: BuildStatus ># Requires: textproc/jq > >use v5.26; >use warnings; > >sub add_commas { > my $text = reverse $_[0]; > $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; > return scalar reverse $text; >} > >use POSIX qw(strftime); >use Term::ANSIColor qw(:constants); > ># Website is hard coded for r12.1 of amd64 ports. Change when necessary. ># List of websites for different builds can be found at http://beefy6. >my $input = "http://beefy6.nyi.freebsd.org/data/121amd64-default/.data.json"; >my $output = "/tmp/build_status.json"; > ># Fetch data from website. Error routine needed !!!! >system "fetch -q $input -o $output"; > >### Use jq to extract data from fetched file ># Identify reversion number using old method >#chomp (my $revision = `jq -r '.builds.latest' $output | tail -n1`); ># Identify revision number using new method ># Note: there maybe a method to isolate last build number using an index >chomp (my $revision = `jq '.builds[]|.buildname?' $output | tail -n1`); > ># Identify if build has ended. Needed for lines 2, 4, 5 and 6 >chomp (my $ended = `jq -r '.builds.$revision.ended' $output`); > >### Calculate right side of output ># Line R1: toal number of ports queued for building >chomp (my $queued = `jq -r '.builds.$revision.stats.queued' $output`); > >my ($R1number, $R1percent); ># Determine if input is null. Usually caused by build that crashed. >if ($queued eq "null") { > $queued = $R1number = $R1percent = 0; >} >else { > # Build is probably good. Use data for number in queue. > $R1number = add_commas($queued); > $R1percent = 100; >} > ># Line R2: number that were built >chomp(my $built = `jq -r '.builds.$revision.stats.built' $output`); >my $R2number = ($built eq "null") ? 0 : add_commas($built); >my $R2percent = ($queued == 0) ? 0 : ($built / $queued) * 100; > ># Line R3: number that failed >chomp(my $failed = `jq -r '.builds.$revision.stats.failed' $output`); >my $R3number = ($failed eq "null") ? 0 : add_commas($failed); >my $R3percent = ($queued == 0) ? 0 : ($failed / $queued) * 100; > ># Line R4: number that were skipped >chomp(my $skipped = `jq -r '.builds.$revision.stats.skipped' $output`); >my $R4number = ($skipped eq "null") ? 0 : add_commas($skipped); >my $R4percent = ($queued == 0) ? 0 : ($skipped / $queued) * 100; > ># Line R5: number that were ignored >chomp(my $ignored = `jq -r '.builds.$revision.stats.ignored' $output`); >my $R5number = ($ignored eq "null") ? 0 : add_commas($ignored); >my $R5percent = ($queued == 0) ? 0 : ($ignored / $queued) * 100; > ># Line R6: number that are pending >my $pending = $queued - $built - $failed - $skipped - $ignored; >my $R6number = add_commas($pending); >my $R6percent = ($queued == 0) ? 0 : ($pending / $queued) * 100; > >### Calculate left side of output ># Line L1: current status >chomp(my $status = `jq -r '.builds.$revision.status' $output`); ># remove trailing colon >$status =~ s/:$//; > ># Color code status. Magenta if building else red when ended. ># NB increase the format code by number of escape characters. ># In this case 11, that is, from %-17d to %-28d. >#my $L1data; >#if ($ended eq "null") { ># $L1data = "\e[0;32m$status\e[0m"; >#} >#else { ># $L1data = "\e[0;35m$status\e[0m"; >#} > ># Line L2: ># Remove quote marks at start and end of string >my $L2data = $revision =~ s/^\"([0-9]+)\"/$1/r; > ># Line L3: time when building started >chomp(my $started = `jq -r '.builds.$revision.started' $output`); >my $L3data = strftime "%F %R", localtime($started); > > ># Line L4: Calculate elapsed time from start >my $elapsed; >my $elapsed_seconds; >my $duration_seconds; >if ($ended eq "null") { > # While building > $elapsed_seconds = $elapsed = time() - $started; >} >else { > # When building has ended calculate final elapsed time > $duration_seconds = $elapsed = $ended - $started; > #$L4data = strftime "%Hh%Mm%Ss", gmtime($duration); >} >my $seconds = $elapsed % 60; >$elapsed = ($elapsed - $seconds) / 60; >my $mins = $elapsed % 60; >$elapsed = ($elapsed - $mins) / 60; >my $hrs = $elapsed % 24; >$elapsed = ($elapsed - $hrs) / 24; >my $days = $elapsed % 7; >my $L4data = $days . "d " . sprintf("%02dh ", $hrs) . sprintf("%02dm", $mins); > > ># Line L5: Calculate number of packges built per hour >my $L5data; >my $thruput; >my $PkgHr; >if ($ended eq "null") { > # While building > $thruput = (($built + $failed) / $elapsed_seconds) * 3600; > $L5data = sprintf("%.0f", $thruput); > $L5data = add_commas($L5data) >} >else { > # When building has ended calculate final Pkg/Hr > $PkgHr = (($built + $failed) / $duration_seconds) * 3600; > $L5data = sprintf("%.0f", $PkgHr); > $L5data = add_commas($L5data); >} > > ># Line L6: Estimate when building will end or specify when building ended >my $L6data; >my $L6label; >if ($ended eq "null") { > # During build process > # Estimated time to tranfer the packages is set at 3 hours > # my $transfer_seconds = 3 * 3600; > # Calculation of seconds to finish building > my $pending_seconds = ($pending / $thruput) * 3600; > # Estimated availability = current time + pending seconds + transfer > # my $EstAval = time() + $pending_seconds + $transfer_seconds; > my $EstAval = time() + $pending_seconds; > # Format estimated arrival time > $L6data = strftime "%F %R", localtime($EstAval); > # Specify label > $L6label = "EstEnd:"; >} >else { > # When building has ended > # Specify local time > $L6data = strftime "%F %R", localtime($ended); > # Specify label > $L6label = "Ended:"; >} > ># Specify local time for title >my $now = strftime "%a %F %R %Z", localtime(time()); > >## Print out results >my $x = 52; >print GREEN . "-" x $x . "\n" . RESET; >print " Build Status at $now\n"; >print GREEN . "-" x $x . "\n" . RESET; > ># Line 1 >#printf " %-8s %-29s", "Status:", $L1data; >printf " %-8s", "Status:"; >($ended eq "null") ? print BRIGHT_MAGENTA : print RED; >printf " %-18s", $status; >print RESET; >printf " %-8s %6s %5.0f%%\n", "Queued:", $R1number, $R1percent; > ># Line 2 >printf " %-8s %-18s", "BuildNo:", $L2data; >printf " %-8s %6s %5.0f%%\n", "Built:", $R2number, $R2percent; > ># Line 3 >printf " %-8s %-18s", "Started:", $L3data; >printf " %-8s %6s %5.0f%%\n", "Failed:", $R3number, $R3percent; > ># Line 4 >printf " %-8s %-18s", "Elapsed:", $L4data; >printf " %-8s %6s %5.0f%%\n", "Skipped:", $R4number, $R4percent; > ># Line 5 >printf " %-8s %-18s", "Pkgs/Hr:", $L5data; >printf " %-8s %6s %5.0f%%\n", "Ignored:", $R5number, $R5percent; > ># Line 6 >printf " %-8s %-18s", $L6label, $L6data; >printf " %-8s %6s %5.0f%%\n", "Pending:", $R6number, $R6percent; > >print GREEN . "-" x $x . "\n" . RESET; > >exit 0; > >### EoF ###
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 244549
: 212183