From a5a96cd7ae566bb1ee168cae14e1d1101bcd1797 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 24 Jun 2021 04:09:05 -0400 Subject: SBoTools: add maintainer info --- bin/sbodb.pl | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 9 deletions(-) (limited to 'bin') diff --git a/bin/sbodb.pl b/bin/sbodb.pl index bfd997e..06c8215 100755 --- a/bin/sbodb.pl +++ b/bin/sbodb.pl @@ -1,9 +1,15 @@ #!/usr/bin/perl -w -# create SBo.sqlite3 database for SBo limnoria plugin. -# requires SLACKBUILDS.txt and TAGS.txt from the SBo repo. -# https://slackware.uk/slackbuilds.org/14.2/SLACKBUILDS.TXT -# https://slackware.uk/slackbuilds.org/14.2/TAGS.txt +# create SBo.sqlite3 database for SBoTools limnoria plugin. +# run with one argument: the path to the SBo repo. This is +# the directory named after the version number, which contains +# SLACKBUILDS.TXT. A git clone will *not* do, needs to be a +# rsync or wget -r copy. + +# Actually only SLACKBUILDS.TXT, TAGS.txt, and the */*/*.info files +# are used. + +# database isn't fully normalized. *shrug*. print <) { + /^MAINTAINER="(.*?)"/m and $mname = $1; + /^EMAIL="(.*?)"/m and $ename = $1; + } + close $info; + + if(!$maintids{$mname}) { + $mname =~ s/'/''/g; + $lastmaint++; + print "insert into maintainers values($lastmaint, '$mname');\n"; + $maintids{$mname} = $lastmaint; + } + + if(!$emailids{$ename}) { + $ename =~ s/'/''/g; + $lastemail++; + print "insert into emails values($lastemail, '$ename');\n"; + $emailids{$ename} = $lastemail; + } + + return ($maintids{$mname}, $emailids{$ename}); +} + +open $sbtxt, "<" . $sbopath . "/SLACKBUILDS.TXT" or die $!; { local $/ = ''; while(<$sbtxt>) { - my ($name, $cat, $ver, $deps, $desc,); + my ($name, $cat, $ver, $deps, $desc, $maintid, $emailid); $deps = ""; chomp; /^SLACKBUILD NAME:\s+(\S+)$/m and $name = $1; @@ -70,6 +117,11 @@ open $sbtxt, "<" . ($ARGV[0] || "SLACKBUILDS.TXT") or die $!; $buildver{$name} = $ver; $builddeps{$name} = $deps; $builddesc{$name} = $desc; + + ($maintid, $emailid) = get_maint($cat, $name); + $buildmaint{$name} = $maintid; + $buildemail{$name} = $emailid; + push @builds, $name; } } @@ -87,7 +139,9 @@ insert into builds values( '$_', '$builddesc{$_}', $buildcat{$_}, - '$buildver{$_}'); + '$buildver{$_}', + $buildmaint{$_}, + $buildemail{$_}); EOF } @@ -104,7 +158,7 @@ EOF } } -open $tagstxt, "<" . ($ARGV[1] || "TAGS.txt") or die $!; +open $tagstxt, "<" . $sbopath . "/TAGS.txt" or die $!; while(<$tagstxt>) { my ($build, $t, @tags); chomp; -- cgit v1.2.3