Commit 42ffd483 authored by Lisa's avatar Lisa

Use os.path.join in akabei-db-import instead of a custom function.

parent 0933e9c1
......@@ -50,12 +50,6 @@ def getDatabasePath(pf):
conf.close()
return ""
def concatenatePaths(path1, path2):
if (path1[-1] != '/'):
path1 += "/"
path1 += path2
return path1
# Each local package is represented in pacman as a directory in the form name-version
# in this path. This directory contains: desc, files (always), install (not always).
def parseLocalDatabase(path):
......@@ -74,16 +68,16 @@ def parseLocalDatabase(path):
showProgress(progress)
for pkgDir in os.listdir(path):
pkgPath = concatenatePaths(path, pkgDir)
pkgPath = os.path.join(path, pkgDir)
if os.path.isdir(pkgPath):
for pkgFile in os.listdir(pkgPath):
if pkgFile == "desc":
desc = concatenatePaths(pkgPath, pkgFile)
desc = os.path.join(pkgPath, pkgFile)
elif pkgFile == "install":
install = concatenatePaths(pkgPath, pkgFile)
install = os.path.join(pkgPath, pkgFile)
elif pkgFile == "files":
files = concatenatePaths(pkgPath, pkgFile)
files = os.path.join(pkgPath, pkgFile)
progress += step # update progress
......@@ -158,7 +152,7 @@ if __name__ == "__main__":
if len(dbpath) == 0:
dbpath = "/var/lib/pacman" # if not explicitly set there, then go back to the default value
localPath = concatenatePaths(dbpath, "local")
localPath = os.path.join(dbpath, "local")
# Get local packages from pacman, then write them into the akabei database in the right format
......@@ -169,4 +163,4 @@ if __name__ == "__main__":
dbwriter = AkabeiDbWriter(outputFile, schemeFile)
dbwriter.addPackages(localPackages)
print "[**] Database converted successfully. Now enjoy akabei!"
\ No newline at end of file
print "[**] Database converted successfully. Now enjoy akabei!"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment