From e1cdea1524dbfe6877e83b73578ea5be1b276c44 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 30 Oct 2026 06:36:06 -0400 Subject: ropeylog: generate 5 reports with different sort orders. --- ropeylog | 169 +++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 131 insertions(+), 38 deletions(-) diff --git a/ropeylog b/ropeylog index b48b7f3..481d83b 100755 --- a/ropeylog +++ b/ropeylog @@ -1,13 +1,47 @@ #!/usr/bin/perl -w -use JSON::XS; -use POSIX 'strftime'; +############### +# These 2 are configurable, change as needed: -($SELF = $0) =~ s,.*/,,; $user_agent = 'Mozilla/5.0 (compatible; ropeylog-repology-bot/1.0; +https://github.com/SlackBuildsOrg/slackbuilds)'; $git_root = $ENV{SBO_GITROOT} || "/slackbuilds/www/slackbuilds/15.0/"; +$outdir = "$ENV{HOME}/www"; + +############### + +use JSON::XS; # from SBo perl-JSON-XS +use POSIX qw/strftime getcwd/; # bundled with Slackware's perl + +($SELF = $0) =~ s,.*/,,; + +@reports = ( + [ "Maintainer", '', \&sort_abc ], + [ "Last Git (+)", '-bygit_up', \&sort_git_up ], + [ "Last Git (-)", '-bygit_down', \&sort_git_down ], + [ "Num Builds (+)", '-bynum_up', \&sort_num_up ], + [ "Num Builds (-)", '-bynum_down', \&sort_num_down ], +); + +############### + +sub usage { + print < scalar(@{$maintbuilds{$b}}); +} + +sub sort_num_down { + scalar(@{$maintbuilds{$b}}) <=> scalar(@{$maintbuilds{$a}}); +} + +############### + sub url_escape { my $s = shift; $s =~ s{[^-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz]}{sprintf("%%%x", ord($&))}ge; @@ -164,14 +230,34 @@ sub get_percent { return sprintf("%d (%.1f%%)", $a, ($a / $b) * 100); } +sub print_sort_links { + for my $r (@reports) { + my $page = get_page_name($r->[1]); + print <$r->[0]
+EOF + } +} + sub print_report { + my $title = shift; + my $sortfunc = shift; + my $stamp = strftime("%Y-%m-%d %H:%M:%S", gmtime); my $maintcount = @maintainers; + my $total_outdated = keys %outdated; + my $print_uptodate = get_percent($total_builds - $total_outdated, $total_builds); + my $print_outdated = get_percent($total_outdated, $total_builds); + + $total_orphans ||= 0; + my $print_orphaned = get_percent($total_orphans, $total_builds); + print < SBo maintainer status report +