Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
updater
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michal Čihař
updater
Commits
392723b7
Verified
Commit
392723b7
authored
May 09, 2016
by
Michal 'vorner' Vaner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg: Allow parsing empty repo indices
parent
8d6f5eb9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
src/lib/autoload/a_05_backend.lua
src/lib/autoload/a_05_backend.lua
+5
-3
tests/backend.lua
tests/backend.lua
+23
-0
No files found.
src/lib/autoload/a_05_backend.lua
View file @
392723b7
...
...
@@ -329,9 +329,11 @@ function repo_parse(content)
local
result
=
{}
for
block
in
block_split
(
content
)
do
local
pkg
=
block_parse
(
block
)
-- Some fields are not present here (conffiles, status), but there are just ignored.
pkg
=
package_postprocess
(
pkg
)
result
[
pkg
.
Package
]
=
pkg
if
next
(
pkg
)
then
-- Problems with empty indices...
-- Some fields are not present here (conffiles, status), but there are just ignored.
pkg
=
package_postprocess
(
pkg
)
result
[
pkg
.
Package
]
=
pkg
end
end
return
result
end
...
...
tests/backend.lua
View file @
392723b7
...
...
@@ -716,6 +716,29 @@ function test_config_modified()
assert
(
B
.
config_modified
(
file
,
"5f54362b30f53ae6862b11ff34d22a8d4510ed2b3e757b1f285db"
))
end
function
test_repo_parse
()
assert_table_equal
({
[
"base-files"
]
=
{
Package
=
"base-files"
,
Version
=
"160-r49274"
,
Depends
=
{
"libc"
,
"netifd"
,
"procd"
,
"jsonfilter"
}
},
[
"block-mount"
]
=
{
Package
=
"block-mount"
,
Version
=
"2015-05-24-09027fc86babc3986027a0e677aca1b6999a9e14"
,
Depends
=
{
"libc"
,
"ubox"
,
"libubox"
,
"libuci"
}
}
},
B
.
repo_parse
(
[[
Package: base-files
Version: 160-r49274
Depends: libc, netifd, procd, jsonfilter
Package: block-mount
Version: 2015-05-24-09027fc86babc3986027a0e677aca1b6999a9e14
Depends: libc, ubox, libubox, libuci
]]
))
end
function
setup
()
local
sdir
=
os.getenv
(
"S"
)
or
"."
-- Use a shortened version of a real status file for tests
...
...
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