Added support for changed slpkg repo syntax

This commit is contained in:
Harald Hope 2024-05-06 14:15:20 -07:00
parent 586368826f
commit e6c6e13236
3 changed files with 162 additions and 30 deletions

View file

@ -0,0 +1,111 @@
# This is the general repositories configuration file of slpkg:
# /etc/slpkg/repositories.toml
# Updated: 18/04/2024, Version: 5.0.6
# Set 'true' or 'false' to enable or disable the repository you want.
# You can use a mirror not included in this file.
# Notes: Before using a repository, make sure you have read about it.
# Some repositories are for -current only. Change the mirror
# if it is necessary. The mirror or every part of the mirror
# should end with a slash '/'.
# Template to define a binary custom repository.
# At least are required [NAME], ENABLE, MIRROR and TAG options.
# The MIRROR should include the files ChangeLog.txt, PACKAGES.TXT,
# and CHECKSUMS.md5. If the file ChangeLog.txt is located in
# a different branch, it should be set a variable CHANGELOG.
# Example:
# [NAME]
# ENABLE = true
# MIRROR = "https://slackware.nl/people/alien/sbrepos/15.0/x86_64/"
# CHANGELOG = "https://slackware.nl/people/alien/sbrepos/"
# TAG = "alien"
# Salix OS Distribution:
# Replace the SLACK, SLACK_EXTRA and SLACK_PATCHES with the mirrors:
# https://repo.greeklug.gr/data/pub/linux/salix/x86_64/slackware-15.0/
# https://repo.greeklug.gr/data/pub/linux/salix/x86_64/slackware-15.0/extra/
# https://repo.greeklug.gr/data/pub/linux/salix/x86_64/slackware-15.0/patches/
# This is the DEFAULT REPOSITORY.
# You can change it with one that you see below.
# Make sure you have enabled it before.
[DEFAULT]
REPO = "slack"
[SBO]
ENABLE = false
MIRROR = "https://slackbuilds.org/slackbuilds/15.0/"
[PONCE]
ENABLE = true
MIRROR = "https://cgit.ponce.cc/slackbuilds/plain/"
[SLACK]
ENABLE = true
MIRROR = "http://slackware.uk/slackware/slackware64-current/"
[SLACK_EXTRA]
ENABLE = true
MIRROR = "http://slackware.uk/slackware/slackware64-current/extra/"
[SLACK_PATCHES]
ENABLE = false
MIRROR = "http://slackware.uk/slackware/slackware64-15.0/patches/"
[ALIEN]
ENABLE = true
MIRROR = "https://slackware.nl/people/alien/sbrepos/current/x86_64/"
[MULTILIB]
ENABLE = false
MIRROR = "https://slackware.nl/people/alien/multilib/15.0/"
[RESTRICTED]
ENABLE = false
MIRROR = "https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/"
[GNOME]
ENABLE = false
MIRROR = "https://reddoglinux.ddns.net/linux/gnome/41.x/x86_64/"
[MSB]
ENABLE = false
MIRROR = "https://slackware.uk/msb/15.0/1.28/x86_64/"
[CSB]
ENABLE = false
MIRROR = "https://slackware.uk/csb/15.0/x86_64/"
[CONRAID]
ENABLE = true
MIRROR = "https://slackers.it/repository/slackware64-current/"
[SLACKDCE]
ENABLE = false
MIRROR = "https://slackware.uk/slackdce/15.0/x86_64/"
[SLACKONLY]
ENABLE = false
MIRROR = "https://packages.slackonly.com/pub/packages/15.0-x86_64/"
[SALIX]
ENABLE = false
MIRROR = "https://repo.greeklug.gr/data/pub/linux/salix/x86_64/15.0/"
[SALIX_EXTRA]
ENABLE = false
MIRROR = "https://repo.greeklug.gr/data/pub/linux/salix/x86_64/extra-15.0/"
[SLACKEL]
ENABLE = false
MIRROR = "http://www.slackel.gr/repo/x86_64/current/"
[SLINT]
ENABLE = false
MIRROR = "https://slackware.uk/slint/x86_64/slint-15.0/"
[PPRKUT]
ENABLE = false
MIRROR = "https://repo.liwjatan.org/pprkut/15.0/x86_64/"

79
pinxi
View file

@ -50,8 +50,8 @@ use POSIX qw(ceil uname strftime ttyname);
## INXI INFO ##
my $self_name='pinxi';
my $self_version='3.3.34';
my $self_date='2024-05-01';
my $self_patch='03';
my $self_date='2024-05-06';
my $self_patch='04';
## END INXI INFO ##
my ($b_pledge,@pledges);
@ -25358,6 +25358,7 @@ sub get_repos_linux {
}
## sbopkg, sboui, slackpkg, slackpkg+, slapt_get, slpkg: Slackware + derived
# $slpkg = "$fake_data_dir/repo/slackware/slpkg-2.toml";
# $slpkg = "$fake_data_dir/repo/slackware/slpkg-new-format-1.toml";
# $sbopkg = "$fake_data_dir/repo/slackware/sbopkg-2.conf";
# $sboui_backend = "$fake_data_dir/repo/slackware/sboui-backend-1.conf";
if (-f $slackpkg || -f $slackpkg_plus || -d $slapt_get || -f $slpkg ||
@ -25477,38 +25478,56 @@ sub get_repos_linux {
@content = ();
}
if (-f $slpkg){
my ($active,$name,$repo);
my $holder = '';
@data2 = main::reader($slpkg);
# We can't rely on the presence of empty lines as block separator.
push(@data2,'-eof-') if @data2;
my ($b_legacy,$b_new,$key,$name,%repos,$value);
@data2 = main::reader($slpkg,'strip');
# print Data::Dumper::Dumper \@data2;
# old: "https://download.salixos.org/x86_64/slackware-15.0/"
# new: ["https://slac...nl/people/alien/sbrepos/", "15.0/", "x86_64/"]
# newer, old syntax: ["https://slac...nl/people/alien/sbrepos/", "15.0/", "x86_64/"]
foreach (@data2){
next if /^\s*([#\[]|$)/;
$_ = lc($_);
if (/^\s*(\S+?)_(repo(|_name|_mirror))\s*=\s*[\['"]{0,2}(.*?)[\]'"]{0,2}\s*$/ ||
$_ eq '-eof-'){
my ($key,$value) = ($2,$4);
if (($1 && $holder ne $1) || $_ eq '-eof-'){
$holder = $1;
if ($name && $repo){
if (!$active || $active =~ /^(true|1|yes)$/i){
push(@content,"$name ~ $repo");
}
($active,$name,$repo) = ();
}
}
if ($key){
if ($key eq 'repo'){
$active = $value;}
elsif ($key eq 'repo_name'){
$name = $value;}
elsif ($key eq 'repo_mirror'){
# map new form to a real url
$value =~ s/['"],\s*['"]//g;
$repo = $value;}
# first legacy line should be [REPO...]
if (!$b_legacy && !$b_new && /\[repositories\]/){
$b_legacy = 1;
next;
}
# otherwise [...] is repo name
if (!$b_legacy && /^\[(\S+)\]/){
$name = $1;
$b_new = 1;
next;
}
($key,$value) = split(/\s*=\s*/,$_);
next if !$key || !defined $value;
$value =~ s/^[\["']|["'\]]$//g;
if ($b_legacy){
next if $key !~ /^(\S+?)_(repo(|_name|_mirror))$/;
$name = $1;
$key = $2;
if ($key eq 'repo'){
$repos{$name}->{'active'} = $value;}
elsif ($key eq 'repo_mirror'){
# map new form to a real url
$value =~ s/['"],\s*['"]//g;
$repos{$name}->{'repo'} = $value;}
}
elsif ($b_new){
if ($key eq 'repo' && $name eq 'default'){
$repos{'default'} = $value;
$name = '';
next;}
elsif ($key eq 'enable'){
$repos{$name}{'active'} = $value;}
elsif ($key eq 'mirror'){
$repos{$name}{'repo'} = $value;}
}
}
if (%repos){
foreach my $item (sort keys %repos){
next if ref $repos{$item} ne 'HASH' || !$repos{$item}->{'repo'};
if (!$repos{$item}->{'active'} ||
$repos{$item}->{'active'} =~ /^(true|1|yes)$/i){
my $default = ($repos{'default'} && $item eq $repos{'default'}) ? ' (default)' : '';
push(@content,$item . $default . ' ~ ' . $repos{$item}->{'repo'});
}
}
}

View file

@ -24,6 +24,8 @@ BUGS:
--------------------------------------------------------------------------------
FIXES:
1. REPOS: For slpkg, adapted to new syntax for each repo. Retained support for
older syntaxes.
--------------------------------------------------------------------------------
ENHANCEMENTS: