From 12b0370e759ae76a903a17c8f582fb424f509a5e Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 9 Sep 2016 15:20:22 -0400 Subject: rename sbosubmit to sboul (to match sbodl) --- sbosubmit | 129 -------------------------------------------------------------- 1 file changed, 129 deletions(-) delete mode 100755 sbosubmit (limited to 'sbosubmit') diff --git a/sbosubmit b/sbosubmit deleted file mode 100755 index 95db5d9..0000000 --- a/sbosubmit +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/perl -w - -# automated submission client for slackbuilds.org web form. -# by B. Watson . -# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. -# run with no arguments for usage instructions. - -use LWP; -use Getopt::Std; - -@categories = qw/ -Academic -Accessibility -Audio -Business -Desktop -Development -Games -Graphics -Haskell -Libraries -Misc -Multimedia -Network -Office -Perl -Python -Ruby -System -/; - -sub usage { - my $cats = join("\n", @categories); - warn < [-e ] [-C ] [-k ] file - -If no -e option is given, the contents of ~/.sbo_email is used as the -email address (and it's a fatal error if the file's missing). - -The categories for -c are: - -$cats - -The -c argument is case-insensitive, and category names may be abbreviated -to the shortest unique prefix (e.g. "gr" for Graphics is OK, but "g" -is an error because it matches both Graphics and Games). - -No checking is done on the file before it's uploaded (other than its -existence). - -After the file is uploaded, the server's response is displayed via -"links -dump". $0's exit status does NOT reflect success/failure: it -will be zero if an upload was done, or non-zero if there's an error in -the arguments (in which case no upload is done). -EOF - exit($_[0] || 0); -} - -sub die_usage { - warn $_ . "\n" for @_; - usage(1); -} - -sub get_category { - my $in = shift; - my $orig = $in; - my @got; - - $in =~ s/[^A-Za-z]//g; - for(@categories) { - push @got, $_ if /^$in/i; - } - - if(!@got) { - die_usage("Invalid category '$orig'"); - } elsif(@got > 1) { - die_usage("Ambiguous category '$orig', matches: " . join(" ", @got)); - } else { - return $got[0]; - } -} - -if(!@ARGV || $ARGV[0] =~ /--?h(?:elp)?/i) { - usage; -} - -getopts('c:e:C:k:', \%opts); -($userfile, $junk) = @ARGV; - -die_usage("Unknown junk on command line: '$junk'") if $junk; -die_usage("No category (missing required -c arg)") unless $opts{c}; -$category = get_category($opts{c}); -chomp($submail = $opts{e} || `head -n1 ~/.sbo_email`); -die_usage("No email address (use -e or else create ~/.sbo_email)") unless $submail; -$comments = $opts{C} || ""; -$tags = $opts{k} || ""; - -if(! -e $userfile) { - die_usage("File not found: $userfile"); -} - -print STDERR "Uploading..."; - -$ua = LWP::UserAgent->new; -$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'); -$resp = $ua->post( - 'https://slackbuilds.org/process_submit/', - [ MAX_FILE_SIZE => '100000', - userfile => [ $userfile ], - category => $category, - tags => $tags, - submail => $submail, - comments => $comments, - submit => 'Upload File' ], - Content_Type => 'form-data', - Referer => 'https://slackbuilds.org/submit/', - ); - -print STDERR "\n"; - -$tmpfile = "/tmp/sbosubmit.$$." . int(rand(10 ** 10)) . ".html"; -open RESULT, ">$tmpfile" or die "$tmpfile: $!"; -print RESULT $resp->content; -close RESULT; -system("links -dump $tmpfile | sed -n '/Upload Results/,/Home.*Change Log/p'"); -unlink $tmpfile; - -warn "*** HTTP response code is " . $resp->code . "\n" unless $resp->code == 200; -- cgit v1.2.3