Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm-dbus-service
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
eepm-dbus-service
Commits
6964bae8
Commit
6964bae8
authored
Mar 29, 2026
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix simulate parser for ALT format with 'replaced' field
parent
a4d55307
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
parser.rs
src/eepm/parser.rs
+19
-2
No files found.
src/eepm/parser.rs
View file @
6964bae8
...
...
@@ -153,7 +153,8 @@ pub fn parse_simulate_output(output: &str) -> Result<PackageChanges> {
let
mut
changes
=
PackageChanges
::
default
();
// Regex for statistics line: "N upgraded, N newly installed, N removed and N not upgraded."
let
stats_re
=
Regex
::
new
(
r
"(
\
d+)
\
s+upgraded,
\
s+(
\
d+)
\
s+newly installed,
\
s+(
\
d+)
\
s+removed
\
s+and
\
s+(
\
d+)
\
s+not upgraded"
)
// Also handles ALT format: "N upgraded, N newly installed, N replaced, N removed ..."
let
stats_re
=
Regex
::
new
(
r
"(
\
d+)
\
s+upgraded,
\
s+(
\
d+)
\
s+newly installed,
\
s+(?:(
\
d+)
\
s+replaced,
\
s+)?(
\
d+)
\
s+removed"
)
.unwrap
();
// Regex for Inst lines: "Inst package [old_version] (new_version repo)" or "Inst package (new_version repo)"
...
...
@@ -246,7 +247,7 @@ pub fn parse_simulate_output(output: &str) -> Result<PackageChanges> {
if
let
Some
(
caps
)
=
stats_re
.captures
(
line
)
{
changes
.upgraded_count
=
caps
.get
(
1
)
.and_then
(|
m
|
m
.as_str
()
.parse
()
.ok
())
.unwrap_or
(
0
);
changes
.installed_count
=
caps
.get
(
2
)
.and_then
(|
m
|
m
.as_str
()
.parse
()
.ok
())
.unwrap_or
(
0
);
changes
.removed_count
=
caps
.get
(
3
)
.and_then
(|
m
|
m
.as_str
()
.parse
()
.ok
())
.unwrap_or
(
0
);
changes
.removed_count
=
caps
.get
(
4
)
.and_then
(|
m
|
m
.as_str
()
.parse
()
.ok
())
.unwrap_or
(
0
);
current_section
=
""
;
continue
;
}
...
...
@@ -694,6 +695,22 @@ Conf htop (3.4.1-alt1 Sisyphus)
}
#[test]
fn
test_parse_simulate_with_replaced
()
{
let
output
=
r
#
"The following packages will be upgraded:
pkg1 pkg2
The following NEW packages will be installed:
pkg3
1208 upgraded, 55 newly installed, 8 replaced, 1 removed and 5 not upgraded.
"
#
;
let
changes
=
parse_simulate_output
(
output
)
.unwrap
();
assert_eq!
(
changes
.upgraded_count
,
1208
);
assert_eq!
(
changes
.installed_count
,
55
);
assert_eq!
(
changes
.removed_count
,
1
);
assert_eq!
(
changes
.upgrade
.len
(),
2
);
assert_eq!
(
changes
.install
.len
(),
1
);
}
#[test]
fn
test_parse_kernel_update_already_installed
()
{
let
output
=
r
#
"Running kernel: kernel-image-6.18-6.18.3-alt1
Checking for available 6.18 kernel packages...
...
...
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