Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-system-updater
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-system-updater
Commits
93d43fb4
Commit
93d43fb4
authored
Sep 30, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parallel package info loading (max 15 threads) and icons support
parent
aa7ff78a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
122 additions
and
18 deletions
+122
-18
info.go
lib/apm/info.go
+31
-0
structs.go
lib/apm/structs.go
+5
-0
conn.go
lib/apm/sudbus/conn.go
+28
-0
updates.go
lib/apm/updates.go
+4
-2
main.go
main.go
+5
-10
packagerows.go
packagerows.go
+49
-6
No files found.
lib/apm/info.go
0 → 100644
View file @
93d43fb4
package
apm
import
(
"SystemUpdater/lib/apm/sudbus"
"encoding/json"
)
func
GetPackageInfo
(
name
string
)
InfoResponse
{
conn
:=
sudbus
.
GetConnection
()
reply
:=
conn
.
BusObject
.
Call
(
"org.altlinux.APM.system.Info"
,
0
,
name
,
"Ximper System Updater"
)
if
reply
.
Err
!=
nil
{
panic
(
"Error during async method call: "
+
reply
.
Err
.
Error
())
}
if
len
(
reply
.
Body
)
<
1
{
panic
(
"Unexpected reply body"
)
}
responseStr
,
ok
:=
reply
.
Body
[
0
]
.
(
string
)
if
!
ok
{
panic
(
"Unexpected response type"
)
}
var
response
InfoRootResponse
if
err
:=
json
.
Unmarshal
([]
byte
(
responseStr
),
&
response
);
err
!=
nil
{
panic
(
"Failed to parse response: "
+
err
.
Error
())
}
return
response
.
Data
}
lib/apm/structs.go
View file @
93d43fb4
...
...
@@ -102,3 +102,8 @@ type InfoResponse struct {
Message
string
`json:"message"`
PackageInfo
Package
`json:"packageInfo"`
}
type
InfoRootResponse
struct
{
Data
InfoResponse
`json:"data"`
Error
bool
`json:"error"`
}
lib/apm/sudbus/conn.go
0 → 100644
View file @
93d43fb4
package
sudbus
import
(
"log"
"github.com/godbus/dbus/v5"
)
type
Connection
struct
{
Conn
*
dbus
.
Conn
BusObject
dbus
.
BusObject
}
var
conn
*
Connection
func
GetConnection
()
*
Connection
{
if
conn
==
nil
{
connection
,
err
:=
dbus
.
ConnectSystemBus
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
obj
:=
connection
.
Object
(
"org.altlinux.APM"
,
dbus
.
ObjectPath
(
"/org/altlinux/APM"
))
conn
=
&
Connection
{
connection
,
obj
}
}
return
conn
}
lib/apm/updates.go
View file @
93d43fb4
package
apm
import
(
"SystemUpdater/lib/apm/sudbus"
"encoding/json"
"github.com/godbus/dbus/v5"
...
...
@@ -56,9 +57,10 @@ func updatesOutputProcessing(reply *dbus.Call) PackageChanges {
type
UpdatesSources
map
[
string
]
UpdaterSource
func
NewUpdatesSources
(
conn
*
dbus
.
Conn
,
obj
dbus
.
BusObject
)
UpdatesSources
{
func
NewUpdatesSources
()
UpdatesSources
{
conn
:=
sudbus
.
GetConnection
()
return
UpdatesSources
{
"System"
:
&
SystemUpdatesSource
{
conn
:
conn
,
obj
:
obj
},
"System"
:
&
SystemUpdatesSource
{
conn
:
conn
.
Conn
,
obj
:
conn
.
BusObject
},
// "Kernel": &KernelUpdatesSource{conn: conn, obj: obj},
}
}
...
...
main.go
View file @
93d43fb4
...
...
@@ -2,8 +2,9 @@ package main
import
(
"SystemUpdater/lib/apm"
sudbus
"SystemUpdater/lib/apm/sudbus"
bldr
"SystemUpdater/lib/gtks/builder"
"log"
"os"
"unsafe"
...
...
@@ -12,7 +13,6 @@ import (
"github.com/diamondburned/gotk4-adwaita/pkg/adw"
"github.com/diamondburned/gotk4/pkg/gio/v2"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
"github.com/godbus/dbus/v5"
)
type
SystemUpdater
struct
{
...
...
@@ -39,16 +39,11 @@ func GetSystemUpdater() *SystemUpdater {
}
func
(
su
*
SystemUpdater
)
onActivate
()
{
conn
,
err
:=
dbus
.
ConnectSystemBus
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
defer
conn
.
Close
()
conn
:=
sudbus
.
GetConnection
()
obj
:=
conn
.
Object
(
"org.altlinux.APM"
,
dbus
.
ObjectPath
(
"/org/altlinux/APM"
)
)
defer
conn
.
Conn
.
Close
(
)
upds
:=
apm
.
NewUpdatesSources
(
conn
,
obj
)
upds
:=
apm
.
NewUpdatesSources
()
window
:=
GetSystemUpdaterWindow
()
...
...
packagerows.go
View file @
93d43fb4
...
...
@@ -3,6 +3,9 @@ package main
import
(
"SystemUpdater/lib/apm"
bldr
"SystemUpdater/lib/gtks/builder"
"fmt"
"strings"
"sync"
_
"embed"
...
...
@@ -10,10 +13,25 @@ import (
"github.com/diamondburned/gotk4/pkg/gtk/v4"
)
func
NewPackageRow
(
item
string
,
ver
string
)
*
adw
.
ActionRow
{
func
NewPackageRow
(
name
string
,
info
apm
.
Package
)
*
adw
.
ActionRow
{
row
:=
adw
.
NewActionRow
()
row
.
SetTitle
(
item
)
row
.
SetSubtitle
(
ver
)
if
info
.
AppStream
!=
nil
&&
len
(
info
.
AppStream
.
Icons
)
>
0
{
ico
:=
info
.
AppStream
.
Icons
[
len
(
info
.
AppStream
.
Icons
)
-
1
]
icoPath
:=
fmt
.
Sprintf
(
"/usr/share/swcatalog/icons/altlinux/%dx%d/%s"
,
ico
.
Height
,
ico
.
Width
,
ico
.
Value
,
)
icoWidget
:=
gtk
.
NewImageFromFile
(
icoPath
)
icoWidget
.
SetIconSize
(
gtk
.
IconSizeLarge
)
row
.
AddPrefix
(
icoWidget
)
}
row
.
SetTitle
(
name
)
row
.
SetSubtitle
(
info
.
VersionInstalled
+
" -> "
+
strings
.
Split
(
info
.
VersionRaw
,
":"
)[
0
])
return
row
}
...
...
@@ -58,6 +76,32 @@ func NewUpdateRow(name string, info apm.PackageChanges) *adw.ActionRow {
continue
}
pkgsWithInfo
:=
make
(
map
[
string
]
apm
.
InfoResponse
)
var
mu
sync
.
Mutex
var
wg
sync
.
WaitGroup
sem
:=
make
(
chan
struct
{},
15
)
for
_
,
p
:=
range
pkgs
{
wg
.
Add
(
1
)
go
func
(
pkg
string
)
{
defer
wg
.
Done
()
sem
<-
struct
{}{}
defer
func
()
{
<-
sem
}()
info
:=
apm
.
GetPackageInfo
(
pkg
)
mu
.
Lock
()
pkgsWithInfo
[
pkg
]
=
info
mu
.
Unlock
()
}(
p
)
}
wg
.
Wait
()
row
:=
adw
.
NewActionRow
()
row
.
SetTitle
(
title
)
row
.
SetActivatable
(
true
)
...
...
@@ -68,9 +112,8 @@ func NewUpdateRow(name string, info apm.PackageChanges) *adw.ActionRow {
win
.
navView
.
Push
(
page
.
nav
)
})
for
_
,
p
:=
range
pkgs
{
ar
:=
adw
.
NewActionRow
()
ar
.
SetTitle
(
p
)
for
p
,
info
:=
range
pkgsWithInfo
{
ar
:=
NewPackageRow
(
p
,
info
.
PackageInfo
)
page
.
listbox
.
Append
(
ar
)
}
upage
.
listbox
.
Append
(
row
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment