Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Akabei frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chakra
Akabei
Akabei frontend
Commits
efef3991
Commit
efef3991
authored
Jul 13, 2016
by
Lisa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test-import uses os.path.join properly and ignores non-directories in the pacman local database.
parent
91e4d218
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
scripts/akabei-db-import/test-import.py
scripts/akabei-db-import/test-import.py
+6
-10
No files found.
scripts/akabei-db-import/test-import.py
View file @
efef3991
...
...
@@ -21,18 +21,11 @@ except ImportError:
print
"[!!] You need to install the python-pysqlite package to execute this script. Quitting..."
sys
.
exit
(
-
1
)
# Concatenate two paths (relative or non) safely
def
concatenatePaths
(
path1
,
path2
):
if
(
path1
[
-
1
]
!=
'/'
):
path1
+=
"/"
path1
+=
path2
return
path1
# Reads the package name directly from the main information file
# This is much safer than obtaining it from the directory name for cause of
# inconsistencies in version specifications
def
getPackageName
(
pkgDir
):
descFile
=
open
(
concatenatePaths
(
pkgDir
,
"desc"
),
"r"
)
descFile
=
open
(
os
.
path
.
join
(
pkgDir
,
"desc"
),
"r"
)
isName
=
False
for
line
in
descFile
.
readlines
():
...
...
@@ -68,7 +61,10 @@ def compareDatabases(pacmanDb, akabeiDb):
# Takes every package in the pacman database directory and looks for it in the akabei database
for
pkgDir
in
os
.
listdir
(
pacmanDb
):
pkgname
=
getPackageName
(
concatenatePaths
(
pacmanDb
,
pkgDir
))
if
not
os
.
path
.
isdir
(
pkgDir
):
continue
pkgname
=
getPackageName
(
os
.
path
.
join
(
pacmanDb
,
pkgDir
))
query
=
"SELECT * FROM packages WHERE name='"
+
pkgname
+
"'"
dbcursor
.
execute
(
query
)
...
...
@@ -153,4 +149,4 @@ if __name__ == "__main__":
if
len
(
diff
)
>
0
:
print
"[!!] Package "
+
diff
+
" was found in pacman db but not in akabei db"
else
:
print
"[**] Test passed."
\ No newline at end of file
print
"[**] Test passed."
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