LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-05-2024, 12:29 PM   #46
h2-1
Member
 
Registered: Mar 2018
Distribution: Debian Testing
Posts: 562

Original Poster
Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320

This will take a bit, it's one of those cases where old syntax has to keep working and new also, which is a tricky but not super hard puzzle.

Should be running later today.
 
Old 05-05-2024, 01:24 PM   #47
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 676
Blog Entries: 1

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by h2-1 View Post
This will take a bit, it's one of those cases where old syntax has to keep working and new also, which is a tricky but not super hard puzzle.

Should be running later today.
Code:
my $slpkg = '/etc/slpkg/repositories.toml';


open my $fh, '<', $slpkg or die "Could not open '$slpkg': $!";

my @enabled_repos;  
my $current_repo;  
my $repo_enabled = 0;  
my $section_name;   


while (my $line = <$fh>) {
    # Ignore comment and empty lines ;)
    next if $line =~ /^\s*#/ || $line =~ /^\s*$/;

    if ($line =~ /^\[(.+)\]$/) {
        if ($repo_enabled && defined $current_repo) {
            push @enabled_repos, $current_repo;
            print "Adding enabled repo: $current_repo in section $section_name\n";  
        }


        $section_name = $1;
        $repo_enabled = 0;  
        $current_repo = undef;  
    }


    if ($line =~ /ENABLE\s*=\s*true/) {
        $repo_enabled = 1;  
        print "'$section_name' is enabled\n"; 
    }

    if ($line =~ /^REPO\s*=\s*"([^"]+)"/) {
        $current_repo = $1;
        print "$section_name repo: $current_repo\n";
    }
}


if ($repo_enabled && defined $current_repo) {
    push @enabled_repos, $current_repo;
    print "Adding enabled last section repo: $current_repo\n";
}

close $fh;
Just trying to safe some of your time... Something like this is working and skip # or empty lines.... But ofcource you know better
 
1 members found this post helpful.
Old 05-05-2024, 10:54 PM   #48
h2-1
Member
 
Registered: Mar 2018
Distribution: Debian Testing
Posts: 562

Original Poster
Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Ideally this will handle the old syntax as well as the new.

I'll do that by adding a switch to detect the new, then do things based on that switch.

Trying to create data objects out of stacked lines when looping through them is always tricky, but a lot of the repos do that style, but this one will have to be slightly more clever to do both transparently.

Luckily this is very easy to test using fake repo data files, for old and new.

I'm a little behind, so this will probably be working tomorrow.

Most of the logic was in place, it just has to be fine tuned, and also, I'd like to add in the (default) to the repo that is default since that's useful information.

It just takes a little patience to do it with this type of slightly complicated data that can be one of two things.
 
2 members found this post helpful.
Old 05-06-2024, 04:30 PM   #49
h2-1
Member
 
Registered: Mar 2018
Distribution: Debian Testing
Posts: 562

Original Poster
Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
This is now in pinxi 3.3.34-04.

You can update if you have pinxi installed with: pinxi -U
or install pinxi to check: wget smxi.org/pinxi etc.

I had to refactor slpkg stuff otherwise it got too convoluted.

old syntax (both old syntaxes, there is old old, and newer old]:

Code:
Repos:
  Active slpkg repos in: slpkg-old-2.toml
    1: alien ~ https://slackware.nl/people/alien/sbrepos/15.0/x86_64/
    2: conraid ~ https://slack.conraid.net/repository/slackware64-current/
    3: csb ~ https://slackware.uk/csb/15.0/x86_64/
    4: gnome ~ https://reddoglinux.ddns.net/linux/gnome/41.x/x86_64/
    5: ponce ~ https://cgit.ponce.cc/slackbuilds/plain/
    6: restricted ~ https://slackware.nl/people/alien/restricted_sbrepos/15.0/x86_64/
    7: slack_extra ~ https://slackware.uk/slackware/slackware64-15.0/extra/
    8: slack_patches ~ https://slackware.uk/slackware/slackware64-15.0/patches/
    9: slint ~ https://slackware.uk/slint/x86_64/slint-15.0/
New style [notice the default is retained and applied to the proper repo name]:

Code:
Repos:
  Active slpkg repos in: slpkg-new-format-1.toml
    1: alien ~ https://slackware.nl/people/alien/sbrepos/current/x86_64/
    2: conraid ~ https://slackers.it/repository/slackware64-current/
    3: ponce ~ https://cgit.ponce.cc/slackbuilds/plain/
    4: slack (default) ~ http://slackware.uk/slackware/slackware64-current/
    5: slack_extra ~ http://slackware.uk/slackware/slackware64-current/extra/
This required using hashes, which in perl don't retain the creation order, so I can't make the list of repos match the actual order they occur in the repo file, but it was too hard to do it otherwise due to having to handle 2 unrelated syntaxes in the formatting.

It will probably a while before this becomes next inxi because I just did one, so will wait a bit to see if more fixes show up, which they usually do.

Last edited by h2-1; 05-06-2024 at 08:12 PM.
 
1 members found this post helpful.
Old 05-06-2024, 06:00 PM   #50
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 676
Blog Entries: 1

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Code:
./pinxi.1 -r
Repos:
  Active sbopkg repo (confirm with root): /etc/sbopkg/sbopkg.conf
    1: SBo ~ 15.0
  slackpkg mirror in: /etc/slackpkg/mirrors
    1: http://ftp.cc.uoc.gr/mirrors/linux/slackware/slackware64-current/
  slapt-get repos in: /etc/slapt-get/slapt-getrc
    1: file:///home/omen/GNOME/gfs46/:CUSTOM
  slapt-get repos in: /etc/slapt-get/slapt-srcrc
    1: file:///home/omen/GITHUB/slackbuilds-current
  slackpkg+ repos in: /etc/slackpkg/slackpkgplus.conf
    1: slackpkgplus ~ http://slakfinder.org/slackpkg+/
    2: gnome ~ https://reddoglinux.ddns.net/linux/gnome/45.x/x86_64/
  Active slpkg repos in: /etc/slpkg/repositories.toml
    1: alien ~ https://slackware.nl/people/alien/sbrepos/current/x86_64/
    2: conraid ~ https://slackers.it/repository/slackware64-current/
    3: gnome46 ~ https://slackware.lngn.net/pub/x86_64/slackware64-current/gfs46/
    4: ponce (default) ~ https://cgit.ponce.cc/slackbuilds/plain/
    5: restricted ~ https://slackware.nl/people/alien/restricted_sbrepos/current/x86_64/
  Active xbps repos in: /etc/xbps.d/repod-main.conf
    1: https://a-hel-fi.m.voidlinux.org/current
  No active xbps repos in: /etc/xbps.d/xbps.conf
  Active xbps repos in: /usr/share/xbps.d/00-repository-main.conf
    1: https://slackware.lngn.net/pub/x86_64/slackware64-current/gfs46/current
  No active xbps repos in: /usr/share/xbps.d/xbps.conf
Code:
sudo ./pinxi.1 -r
Password: 
Repos:
  Active sbopkg repo: /etc/sbopkg/sbopkg.conf, /root/.sbopkg.conf
    1: SBo-git ~ current
thank you master h2-1

Last edited by rizitis; 05-06-2024 at 06:04 PM.
 
1 members found this post helpful.
Old 05-06-2024, 07:47 PM   #51
h2-1
Member
 
Registered: Mar 2018
Distribution: Debian Testing
Posts: 562

Original Poster
Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Thank you rizitis for confirming fix, and that all the other slackware repo types are working too, which is appreciated.

And thanks to marav for noticing that slpkg had broken due to syntax change.

Stuff like this I just can't track myself consistently.

I'm glad I waited until today, my first two ideas on how to do it were bad, and were kind of ugly hacks, the new logic is quite robust and future proof I think. That's the kind of fix where part of me goes: why didn't I do all the complex repos like this?! In this case it's because I didn't need to since I only had to handle one syntax per type. I do wish I hadn't lost the ordering of the repos in the actual file, but can't have everything. This was a brain-twister though. Solution maybe not elegant, but it's solid and I think will work, unless there's an unknown syntax type for these files, I'm hoping there isn't. It basically runs pretests to look for [REPOSITORIES] or [SOMETHING_ELSE] to set the switches if new or legacy then just treats each separately, but puts the data into a hash which is then predictable and easy to work with.
 
1 members found this post helpful.
Old 05-06-2024, 08:23 PM   #52
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,144
Blog Entries: 21

Rep: Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481Reputation: 3481
Old City Hall Server I use in the motorcycle shop.

Code:
harry@shop:~
$ pinxi -SImaz
System:
  Kernel: 6.1.60-antix.1-amd64-smp arch: x86_64 bits: 64 compiler: gcc
    v: 12.2.0 clocksource: tsc avail: hpet,acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1.60-antix.1-amd64-smp
    root=UUID=d136a2f2-d7ce-4364-a42d-ff13aee70028 ro quiet selinux=0
  Desktop: IceWM v: 3.4.7 tools: avail: slock,xlock dm: slimski v: 1.5.0
    Distro: antiX-23.1-runit_x64-full Arditi del Popolo 6 November 2023
    base: Debian GNU/Linux 12 (bookworm)
Memory:
  System RAM: total: 6 GiB available: 5.73 GiB used: 1.09 GiB (19.0%)
  Message: For most reliable report, use superuser + dmidecode.
  Array-1: capacity: 8 GiB slots: 4 modules: 3 EC: None
    max-module-size: 2 GiB note: est.
  Device-1: DIMM_1 type: DDR2 detail: synchronous size: 2 GiB
    speed: 800 MT/s volts: N/A width (bits): data: 64 total: 64
    manufacturer: 7F7F7F0B00000000 part-no: NT2GT64U8HD0BY-AD serial: <filter>
  Device-2: DIMM_3 type: DDR2 detail: synchronous size: 2 GiB
    speed: 800 MT/s volts: N/A width (bits): data: 64 total: 64
    manufacturer: 7F7F7F0B00000000 part-no: NT2GT64U8HD0BY-AD serial: <filter>
  Device-3: DIMM_2 type: no module installed
  Device-4: DIMM_4 type: DDR2 detail: synchronous size: 2 GiB
    speed: 800 MT/s volts: N/A width (bits): data: 64 total: 64
    manufacturer: 7F7F7F0B00000000 part-no: NT2GT64U8HD0BY-AD serial: <filter>
Info:
  Processes: 138 Power: uptime: 8m states: freeze,standby,mem,disk
    suspend: deep avail: s2idle,shallow wakeups: 0 hibernate: platform
    avail: shutdown, reboot, suspend, test_resume image: 2.27 GiB Init: runit
    v: N/A runlevel: 2 tool: service
  Packages: pm: dpkg pkgs: 1750 libs: 817
    tools: apt,apt-get,aptitude,synaptic Compilers: gcc: 12.2.0 Shell: Bash
    v: 5.2.15 running-in: roxterm pinxi: 3.3.34-1
harry@shop:~
$ sudo ps_mem.py ; pinxi -v4opxz
 Private  +   Shared  =  RAM used	Program

116.0 KiB +  16.5 KiB = 132.5 KiB	runit
132.0 KiB +  20.5 KiB = 152.5 KiB	runsvdir
152.0 KiB +  34.5 KiB = 186.5 KiB	seatd
364.0 KiB + 106.5 KiB = 470.5 KiB	icewm-session
388.0 KiB +  87.5 KiB = 475.5 KiB	dbus-launch
352.0 KiB + 149.5 KiB = 501.5 KiB	udevil
412.0 KiB + 315.5 KiB = 727.5 KiB	getty (3)
640.0 KiB + 329.5 KiB = 969.5 KiB	dconf-service
652.0 KiB + 381.5 KiB =   1.0 MiB	devmon
820.0 KiB + 238.5 KiB =   1.0 MiB	runsv (9)
824.0 KiB + 386.5 KiB =   1.2 MiB	desktop-session
  1.1 MiB + 519.5 KiB =   1.6 MiB	dbus-daemon (3)
896.0 KiB + 803.0 KiB =   1.7 MiB	sudo (2)
  1.5 MiB + 439.5 KiB =   2.0 MiB	bash
  1.8 MiB + 423.5 KiB =   2.2 MiB	udevd
  2.0 MiB + 197.5 KiB =   2.2 MiB	bluetoothd
  1.5 MiB + 748.5 KiB =   2.3 MiB	pipewire-pulse
  2.9 MiB + 433.5 KiB =   3.3 MiB	at-spi2-registryd
  2.8 MiB + 523.5 KiB =   3.4 MiB	at-spi-bus-launcher
  2.9 MiB + 676.5 KiB =   3.6 MiB	slimski
  3.5 MiB + 136.5 KiB =   3.7 MiB	connmand
  4.4 MiB + 539.5 KiB =   4.9 MiB	conky
  4.7 MiB +   1.3 MiB =   6.0 MiB	pipewire
  5.0 MiB +   1.3 MiB =   6.3 MiB	wpa_supplicant
  5.5 MiB +   1.3 MiB =   6.8 MiB	icewm
  9.9 MiB +   1.7 MiB =  11.6 MiB	wireplumber
 11.8 MiB +   3.3 MiB =  15.1 MiB	roxterm
 16.2 MiB +  10.2 MiB =  26.4 MiB	cmst
 48.5 MiB +  12.9 MiB =  61.4 MiB	python3.11
 43.8 MiB +  22.0 MiB =  65.8 MiB	Xorg
586.3 MiB + 125.0 MiB = 711.3 MiB	firefox-esr (11)
---------------------------------
                        948.0 MiB
=================================
System:
  Kernel: 6.1.60-antix.1-amd64-smp arch: x86_64 bits: 64 compiler: gcc
    v: 12.2.0
  Desktop: IceWM v: 3.4.7 dm: slimski Distro: antiX-23.1-runit_x64-full
    Arditi del Popolo 6 November 2023 base: Debian GNU/Linux 12 (bookworm)
Machine:
  Type: Desktop System: Dell product: Precision WorkStation T3400 v: N/A
    serial: <superuser required> Chassis: type: 7 serial: <superuser required>
  Mobo: Dell model: 0TP412 serial: <superuser required> BIOS: Dell v: A09
    date: 06/04/2009
CPU:
  Info: dual core model: Intel Core2 Duo E7400 bits: 64 type: MCP arch: Penryn
    rev: A cache: L1: 128 KiB L2: 3 MiB
  Speed (MHz): avg: 2791 min/max: N/A cores: 1: 2791 2: 2791 bogomips: 11163
  Flags: ht lm nx pae sse sse2 sse3 sse4_1 ssse3
Graphics:
  Device-1: NVIDIA GF119 [GeForce GT 520] vendor: eVga.com. driver: nouveau
    v: kernel arch: Fermi pcie: speed: 2.5 GT/s lanes: 16 ports:
    active: HDMI-A-1 empty: DVI-I-1,DVI-I-2 bus-ID: 01:00.0 chip-ID: 10de:1040
    temp: 49.0 C
  Display: server: X.Org v: 1.21.1.7 driver: X: loaded: modesetting
    unloaded: fbdev,vesa dri: nouveau gpu: nouveau resolution: 1920x1080~60Hz
  API: OpenGL v: 4.3 vendor: nouveau mesa v: 22.3.6 glx-v: 1.4 es-v: 3.1
    direct-render: yes renderer: NVD9 device-ID: 10de:1040
Network:
  Device-1: Broadcom NetXtreme BCM5754 Gigabit Ethernet PCI Express
    vendor: Dell Precision T3400 driver: tg3 v: kernel pcie: speed: 2.5 GT/s
    lanes: 1 port: N/A bus-ID: 04:00.0 chip-ID: 14e4:167a
  IF: eth0 state: down mac: <filter>
  Device-2: Realtek RTL8187B Wireless 802.11g 54Mbps Network Adapter
    driver: rtl8187 type: USB rev: 2.0 speed: 480 Mb/s lanes: 1
    bus-ID: 2-5.2.4:6 chip-ID: 0bda:8189
  IF: wlan1 state: up mac: <filter>
Drives:
  Local Storage: total: 465.26 GiB used: 9.22 GiB (2.0%)
  ID-1: /dev/sda vendor: Seagate model: ST3500312CS size: 465.26 GiB
    speed: 3.0 Gb/s serial: <filter>
Partition:
  ID-1: / size: 38.07 GiB used: 9.22 GiB (24.2%) fs: ext4 dev: /dev/sda4
  ID-2: swap-1 size: 4.33 GiB used: 0 KiB (0.0%) fs: swap priority: -2
    dev: /dev/sda3
Unmounted:
  ID-1: /dev/sda1 size: 64.21 GiB fs: ext4
  ID-2: /dev/sda2 size: 357.74 GiB fs: ext4
Info:
  Memory: total: 6 GiB available: 5.73 GiB used: 1.09 GiB (19.1%)
  Processes: 138 Power: uptime: 9m wakeups: 0 Init: runit v: N/A runlevel: 2
  Packages: pm: dpkg pkgs: 1750 Compilers: gcc: 12.2.0 Shell: Bash v: 5.2.15
    running-in: roxterm pinxi: 3.3.34-1
harry@shop:~
 
1 members found this post helpful.
Old 05-07-2024, 05:32 AM   #53
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Looks good here too.
Code:
$ ./pinxi -r --vs
pinxi 3.3.34-04 (2024-05-06)
Repos:
  Active sbopkg repo (confirm with root): /etc/sbopkg/sbopkg.conf
    1: SBo-git ~ current
  slackpkg mirror in: /etc/slackpkg/mirrors
    1: file://home/slackware/slackware64-current/
  slackpkg+ repos in: /etc/slackpkg/slackpkgplus.conf
    1: alienbob ~ file://home/non-slack/alienbob/
    2: justpkgs ~ dir://home/non-slack/justpkgs/
    3: multilib ~ file://home/non-slack/multilib/current/
    4: nonslack ~ file://home/non-slack/slackbuilds/
    5: restricted ~ file://home/non-slack/alienbob_restricted/
  Active slpkg repos in: /etc/slpkg/repositories.toml
    1: alien ~ https://slackware.nl/people/alien/sbrepos/current/x86_64/
    2: conraid ~ https://slackers.it/repository/slackware64-current/
    3: ponce (default) ~ https://cgit.ponce.cc/slackbuilds/plain/
    4: restricted ~ https://slackware.nl/people/alien/restricted_sbrepos/current/x86_64/
    5: slackel ~ http://www.slackel.gr/repo/x86_64/current/
 
1 members found this post helpful.
Old 05-07-2024, 01:58 PM   #54
h2-1
Member
 
Registered: Mar 2018
Distribution: Debian Testing
Posts: 562

Original Poster
Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Just for my notes, when did this slpkg config file syntax change happen?

rokytnji, good to see RAM as user feature working, that seems to be at least so far it either works or doesn't.

I'll keep an eye on that output for future releases of udevadm in case it alters, I'm hoping it doesn't.
 
Old 05-07-2024, 03:34 PM   #55
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 676
Blog Entries: 1

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by h2-1 View Post
Just for my notes, when did this slpkg config file syntax change happen?
19/04/2024
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Testers for inxi/pinxi redone -C CPU logic... huge internal changes h2-1 Slackware 353 02-24-2022 08:51 PM
pinxi/inxi huge BSD updates, testers? h2-1 *BSD 0 03-08-2021 11:54 PM
Huge inxi/pinxi upgrade, new features, Logical volumes, raid rewrite, beta testers? h2-1 Slackware 12 12-17-2020 05:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration