From 357902a96c1d0df69f5580d961cbff7d146b800d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 2 Jul 2022 16:28:12 -0400 Subject: sbolint: skip other checks if SlackBuild doesnt exist --- Makefile | 2 +- sbolint | 59 ++++++++++++++++++++++++++++++++++++----------------------- sbopkglint | 2 +- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 5ec2a1a..9f43d27 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PROJ=sbo-maintainer-tools # for now, VERSION has to be updated here and also in both scripts. -VERSION=0.5.1 +VERSION=0.5.2 PREFIX=/usr/local DESTDIR= diff --git a/sbolint b/sbolint index d743339..6209f84 100755 --- a/sbolint +++ b/sbolint @@ -1,10 +1,14 @@ #!/usr/bin/perl -w # note to self: keep this in sync with VER in sbopkglint and VERSION in Makefile. -$VERSION="0.5.1"; +$VERSION="0.5.2"; # ChangeLog: +# 0.5.2 20220702 bkw: if SlackBuild doesn't exist, skip other checks. + +# 0.5.1 20220702 bkw: only check junk files if checking a tarball. + # 20220513 bkw: starting with 0.5, moved to sbo-maintainer-tools repo. # 0.4 20220314 bkw: add -a option to check all builds in the git repo. @@ -79,8 +83,8 @@ with the upload form's submission checker. Lack of errors/warnings from sbolint does not guarantee that your build will be accepted! sbolint doesn't check built packages, and never executes the build -script. If you want a lint tool for binary Slackware packages, try -pprkut's B. +script. If you want a lint tool for binary Slackware packages, use +B. =head1 OPTIONS @@ -267,7 +271,7 @@ B. Watson , aka Urchlay on Libera IRC. =head1 SEE ALSO -B(1), B(1) +B(1), B(1), B(1) =cut @@ -599,20 +603,22 @@ sub run_checks { $buildname = `readlink -n -e .`; $buildname =~ s,.*/,,; - my @checks = ( - \&check_readme, - \&check_slackdesc, - \&check_info, - \&check_script, - \&check_images, - ); - - # if we're in a git repo, it's assumed we're going to track extra - # files with git, and use git to update the build, not tar it up - # and use the web form. - push @checks, \&check_junkfiles if $checking_tarball; - for(@checks) { - $_->($build); + if(script_exists()) { + my @checks = ( + \&check_readme, + \&check_slackdesc, + \&check_info, + \&check_script, + \&check_images, + ); + + # we only care about the junkfiles check for tarballs; don't + # try to second-guess the user otherwise. + push @checks, \&check_junkfiles if $checking_tarball; + + for(@checks) { + $_->($build); + } } chdir_or_die($oldcwd); @@ -1067,6 +1073,15 @@ sub curl_head_request { ## # and sometimes it's a different letter (r, or g, or capital V, etc). ## } +sub script_exists { + my $file = $buildname . ".SlackBuild"; + unless(-e $file) { + log_error("$file does not exist, this is not a valid SlackBuild dir"); + return 0; + } + return 1; +} + # NOT going to police the script too much. Would end up rewriting most of # the shell, in perl. Plus, it'd become a straitjacket. Here's what I'll # implement: @@ -1086,11 +1101,9 @@ sub curl_head_request { sub check_script { my $file = $buildname . ".SlackBuild"; - if(-e $file) { - my $gotmode = 07777 & ((stat($file))[2]); - unless($gotmode == 0644 || (!$in_git_repo && $gotmode == 0755)) { - log_error("$file must have mode 644" . ($in_git_repo ? "" : " (or 0755)") . ", not %04o", $gotmode); - } + my $gotmode = 07777 & ((stat($file))[2]); + unless($gotmode == 0644 || (!$in_git_repo && $gotmode == 0755)) { + log_error("$file must have mode 644" . ($in_git_repo ? "" : " (or 0755)") . ", not %04o", $gotmode); } my @lines = check_and_read($file); diff --git a/sbopkglint b/sbopkglint index d903dfb..d234e39 100755 --- a/sbopkglint +++ b/sbopkglint @@ -3,7 +3,7 @@ # 20220408 bkw: note to self: VER must be in sync with VERSION in sbolint # and the Makefile. -VER=0.5.1 +VER=0.5.2 : <