aboutsummaryrefslogtreecommitdiff
path: root/update_sbtxt.pl
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-11-30 08:37:31 -0500
committerB. Watson <urchlay@slackware.uk>2026-11-30 08:37:31 -0500
commita2ae8b6a39f9a34b650e3b8a8bb21fdf4e1d14f8 (patch)
tree1b122fa13ffce357fd5c78382826a497934396ec /update_sbtxt.pl
parent1668477e319ab47701371d4632eadf9623d7112f (diff)
downloadsbo-maintainer-tools-a2ae8b6a39f9a34b650e3b8a8bb21fdf4e1d14f8.tar.gz
update_sbtxt.pl: replace tab indents with 2 spaces each.HEADmaster
Diffstat (limited to 'update_sbtxt.pl')
-rwxr-xr-xupdate_sbtxt.pl168
1 files changed, 84 insertions, 84 deletions
diff --git a/update_sbtxt.pl b/update_sbtxt.pl
index 9859935..64c0d1c 100755
--- a/update_sbtxt.pl
+++ b/update_sbtxt.pl
@@ -73,126 +73,126 @@ use File::Find;
# to the directory (relative to find()'s 2nd argument). See
# "perldoc File::Find" if you need more information.
sub found_file {
- # don't process directories at all.
- return if -d $_;
-
- # $dot is always "."
- # $cat is the category (audio, development, etc).
- # $prgnam is (guess what?) the build name.
- # @path is the rest. for e.g. slack-desc, it'll be just the name.
- # if there's a subdirectory, it'll be dir/filename.
- my ($dot, $cat, $prgnam, @path) = split /\//, $File::Find::dir;
-
- # if there aren't at least 2 dir components, ignore.
- return unless defined $cat;
- return unless defined $prgnam;
-
- # %files hash key.
- $dir = "$dot/$cat/$prgnam";
-
- # %files values are array references, holding the subdirs under the
- # SlackBuild dir, if any, and the basename.
- push @{$files{$dir}}, join("/", @path, $_);
-
- # 20260712 bkw: only look at the *correct* .info file. occasionally there
- # will be some other file named <something>.info in the SlackBuild dir.
- # libretro builds are notorious for this.
- $prgnam = quotemeta($prgnam); # handle e.g. TiMidity++
- return unless /^$prgnam\.info$/;
-
- # if we found an .info file, add it to the list.
- push @infos, "$dir/$_";
+ # don't process directories at all.
+ return if -d $_;
+
+ # $dot is always "."
+ # $cat is the category (audio, development, etc).
+ # $prgnam is (guess what?) the build name.
+ # @path is the rest. for e.g. slack-desc, it'll be just the name.
+ # if there's a subdirectory, it'll be dir/filename.
+ my ($dot, $cat, $prgnam, @path) = split /\//, $File::Find::dir;
+
+ # if there aren't at least 2 dir components, ignore.
+ return unless defined $cat;
+ return unless defined $prgnam;
+
+ # %files hash key.
+ $dir = "$dot/$cat/$prgnam";
+
+ # %files values are array references, holding the subdirs under the
+ # SlackBuild dir, if any, and the basename.
+ push @{$files{$dir}}, join("/", @path, $_);
+
+ # 20260712 bkw: only look at the *correct* .info file. occasionally there
+ # will be some other file named <something>.info in the SlackBuild dir.
+ # libretro builds are notorious for this.
+ $prgnam = quotemeta($prgnam); # handle e.g. TiMidity++
+ return unless /^$prgnam\.info$/;
+
+ # if we found an .info file, add it to the list.
+ push @infos, "$dir/$_";
}
# Join together lines in .info files that are split by
# backslashes. This is actually more forgiving of spacing errors
# than it needs to be (better not to be so picky).
sub fix_backslashes {
- for($_[0]) {
- s,
- \s* # optional spaces
- \\ # required: single backslash
- \s* # optional spaces
- \n # required: newline
- \s* # optional spaces
- , ,gx; # all the above gets replaced with a single space.
- return $_;
- }
+ for($_[0]) {
+ s,
+ \s* # optional spaces
+ \\ # required: single backslash
+ \s* # optional spaces
+ \n # required: newline
+ \s* # optional spaces
+ , ,gx; # all the above gets replaced with a single space.
+ return $_;
+ }
}
# Read an entire file, join any lines back together if they're split
# with a backslash, return entire file contents as a scalar.
sub slurp_file {
- my $file = shift;
+ my $file = shift;
- local $/ = undef;
- open my $fh, '<', $file || die $!;
- my $content = <$fh>;
- close $fh;
+ local $/ = undef;
+ open my $fh, '<', $file || die $!;
+ my $content = <$fh>;
+ close $fh;
- return fix_backslashes($content);
+ return fix_backslashes($content);
}
# Return just the value from the .info file contents, given the key.
# Assumes the content's already had fix_backslashes() called on it.
sub get_info_value {
- my $file = shift; # only needed for error message
- my $info = shift;
- my $key = shift;
+ my $file = shift; # only needed for error message
+ my $info = shift;
+ my $key = shift;
- $$info =~ m,^$key="(.*?)",m or die "no match for $key in $file\n";
- return $1;
+ $$info =~ m,^$key="(.*?)",m or die "no match for $key in $file\n";
+ return $1;
}
# get the first non-comment line of the slack-desc in $dir, remove
# the 'buildname: ' prefix, return the rest.
sub get_short_desc {
- my $buildname = quotemeta shift;
- my $dir = shift;
- my $file = $dir . "/slack-desc";
-
- open my $fh, '<', $file || die "$file: $!\n";
- my $line;
- while(<$fh>) {
- chomp;
- last if /^$buildname: /;
- }
- close $fh;
-
- die "$file: can't figure out short description\n" unless defined $_;
-
- s,^\S+:\s*,,;
- return $_;
+ my $buildname = quotemeta shift;
+ my $dir = shift;
+ my $file = $dir . "/slack-desc";
+
+ open my $fh, '<', $file || die "$file: $!\n";
+ my $line;
+ while(<$fh>) {
+ chomp;
+ last if /^$buildname: /;
+ }
+ close $fh;
+
+ die "$file: can't figure out short description\n" unless defined $_;
+
+ s,^\S+:\s*,,;
+ return $_;
}
# parse_info() actually prints the 'entry' in SLACKBUILDS.TXT for a
# given info file. Argument must be the path to the file, like
# ./category/progname/progname.info
sub parse_info {
- my $file = shift;
- my $loc;
- my $name;
+ my $file = shift;
+ my $loc;
+ my $name;
- ($loc, $name) = ($file =~ m,(^.*)/([^/]+)\.info$,);
+ ($loc, $name) = ($file =~ m,(^.*)/([^/]+)\.info$,);
- print "SLACKBUILD NAME: $name\n";
- print "SLACKBUILD LOCATION: $loc\n";
- print "SLACKBUILD FILES: " . join(" ", sort @{$files{$loc}}) . "\n";
+ print "SLACKBUILD NAME: $name\n";
+ print "SLACKBUILD LOCATION: $loc\n";
+ print "SLACKBUILD FILES: " . join(" ", sort @{$files{$loc}}) . "\n";
- my $content = slurp_file($file);
+ my $content = slurp_file($file);
- for (qw/VERSION DOWNLOAD DOWNLOAD_x86_64 MD5SUM MD5SUM_x86_64 REQUIRES/) {
- print "SLACKBUILD $_: " . get_info_value($file, \$content, $_) . "\n";
- }
+ for (qw/VERSION DOWNLOAD DOWNLOAD_x86_64 MD5SUM MD5SUM_x86_64 REQUIRES/) {
+ print "SLACKBUILD $_: " . get_info_value($file, \$content, $_) . "\n";
+ }
- # N.B. update_sbtxt.sh always puts 2 spaces after the : here, unless
- # the script name has a + in it (e.g. wmweather+, atari++), in which
- # case it puts one space, and duplicates the package name. I consider
- # this a bug in the original script; here, there's always one space
- # and no dup package names.
- print "SLACKBUILD SHORT DESCRIPTION: " . get_short_desc($name, $loc);
+ # N.B. update_sbtxt.sh always puts 2 spaces after the : here, unless
+ # the script name has a + in it (e.g. wmweather+, atari++), in which
+ # case it puts one space, and duplicates the package name. I consider
+ # this a bug in the original script; here, there's always one space
+ # and no dup package names.
+ print "SLACKBUILD SHORT DESCRIPTION: " . get_short_desc($name, $loc);
- print "\n\n";
+ print "\n\n";
}
# main()