From dce38a94a71425112b85de6bf70267d2f7a918a5 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 2 Jul 2022 15:25:20 -0400 Subject: sbolint: only check junk files if checking tarball --- sbolint | 55 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/sbolint b/sbolint index 5934538..d743339 100755 --- a/sbolint +++ b/sbolint @@ -5,6 +5,8 @@ $VERSION="0.5.1"; # ChangeLog: +# 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. # 0.3 20200420 bkw: @@ -54,7 +56,7 @@ sbolint - check SlackBuild directories or tarballs for common errors. =head1 SYNOPSIS -B [-a] [-g] [-q] [-u] [-n] [build [build ...]] +B [-a] [-q] [-u] [-n] [build [build ...]] =head1 DESCRIPTION @@ -139,6 +141,24 @@ inside this directory. Archive must contain I. +=item - + +Any files other than the .SlackBuild, .info, slack-desc, and README are +checked for permissions (should be 0644) and excessive size. + +=item - + +The source archive(s) must not exist. Also sbolint attempts to detect +extracted source trees (but isn't all that good at it). + +=item - + +"Junk" files such as editor backups, core dumps, +=item - + +Files named 'build.log*' or 'strace.out*' must not exist. The B +tool creates these. + =back For all builds: @@ -152,7 +172,7 @@ DOS \r\n), and the last line of each must have a \n. =item - -The SlackBuild script must exist, with mode 0755 (or 0644, if in a git repo), +The SlackBuild script must exist, with mode 0644 or 0755 (or 0644 only, if in a git repo), and be a I<#!/bin/bash> script. =item - @@ -225,32 +245,6 @@ request (see the B<-u> option). =back -The following tests are only done when sbolint's starting directory -was NOT in a git repo: - -=over 4 - -=item - - -Any files other than the .SlackBuild, .info, slack-desc, and README are -checked for permissions (should be 0644) and excessive size. - -=item - - -The source archive(s) must not exist. Also sbolint attempts to detect -extracted source trees (but isn't all that good at it). - -=item - - -Files named 'build.log' or 'strace.out*' must not exist. The B -tool creates these. - -=back - -The rationale for skipping the above tests when in a git repo is that -maintainers will be using git to track files and push changes, so we -don't need to check them here. - =head1 EXIT STATUS Exit status from sbolint will normally be 0 (success) if there were no @@ -581,6 +575,7 @@ sub extract_tarball { # otherwise cd to its argument if it's a dir, otherwise error. sub run_checks { $build = shift; + my $checking_tarball = 0; my $oldcwd = getcwd(); $errcount = $warncount = 0; @@ -590,6 +585,7 @@ sub run_checks { $buildname =~ s,.*/,,; if(check_tarball($build)) { chdir_or_die(extract_tarball($build)); + $checking_tarball++; } else { return 0; } @@ -614,7 +610,7 @@ sub run_checks { # 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 unless $in_git_repo; + push @checks, \&check_junkfiles if $checking_tarball; for(@checks) { $_->($build); } @@ -1089,7 +1085,6 @@ sub curl_head_request { sub check_script { my $file = $buildname . ".SlackBuild"; - my $wantmode = $in_git_repo ? 0644 : 0755; if(-e $file) { my $gotmode = 07777 & ((stat($file))[2]); -- cgit v1.2.3