fix digest generation for --initialize

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@380 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
lxnay
2007-08-03 20:02:05 +00:00
parent 04d152a4e8
commit f845f0c723
3 changed files with 9 additions and 9 deletions

View File

@@ -88,11 +88,11 @@ def database(options):
currCounter += 1
print_info(green(" (")+ blue(str(currCounter))+"/"+red(str(atomsnumber))+green(") ")+red("Analyzing ")+bold(pkg)+red(" ..."))
etpData = reagentTools.extractPkgData(package = etpConst['packagesbindir']+"/"+pkg, structuredLayout = True)
# remove shait
entropyTools.spawnCommand("rm -rf "+etpConst['packagestmpdir']+"/"+pkg)
entropyTools.spawnCommand("rm -rf "+etpConst['packagestmpdir']+"/"+pkg+"*")
# fill the db entry
dbconn.addPackage(etpData)
idpk, revision, etpDataUpdated, accepted = dbconn.addPackage(etpData)
dbconn.commitChanges()
dbconn.closeDB()

View File

@@ -346,6 +346,7 @@ etpConst = {
'filesystemdirs': ['/bin','/boot','/emul','/etc','/lib','/lib32','/lib64','/opt','/sbin','/usr','/var'], # directory of the filesystem
'officialrepositoryname': "sabayonlinux.org", # our official repository name
'packagedbdir': "/db", # directory of the database file in the .tbz2 package
'packagedbfile': "/data.db", # database file in the directory above
'packagecontentdir': "/package" # directory of the package file in the .tbz2 package
}

View File

@@ -142,7 +142,7 @@ def enzyme(options):
os.makedirs(tdir)
os.mkdir(tdir+etpConst['packagecontentdir']) # content directory
os.mkdir(tdir+etpConst['packagedbdir']) # content directory
dbpath = tdir+etpConst['packagedbdir']+"/data.db"
dbpath = tdir+etpConst['packagedbdir']+etpConst['packagedbfile']
# fill /package
spawnCommand("mv "+etpConst['packagessuploaddir']+"/"+newFileName+" "+tdir+etpConst['packagecontentdir']+"/")
# create db
@@ -161,7 +161,6 @@ def enzyme(options):
hashFilePath = createHashFile(etpConst['packagessuploaddir']+"/"+newFileName)
# remove tdir
spawnCommand("rm -rf "+tdir)
print_info(yellow(" * ")+red("Database injection complete for ")+newFileName)
else:
@@ -214,6 +213,10 @@ def extractPkgData(package, etpBranch = "unstable", structuredLayout = False):
etpData['name'] = pkgname
etpData['version'] = pkgver
print_info(yellow(" * ")+red("Getting package md5..."),back = True)
# .tbz2 md5
etpData['digest'] = md5sum(tbz2File)
if (structuredLayout):
# extract tbz2
structuredPackageDir = etpConst['packagestmpdir']+"/"+etpData['name']+"-"+etpData['version']+"-structured"
@@ -224,10 +227,6 @@ def extractPkgData(package, etpBranch = "unstable", structuredLayout = False):
tbz2filename = os.path.basename(tbz2File)
tbz2File = structuredPackageDir+etpConst['packagecontentdir']+"/"+tbz2filename
print_info(yellow(" * ")+red("Getting package md5..."),back = True)
# .tbz2 md5
etpData['digest'] = md5sum(tbz2File)
print_info(yellow(" * ")+red("Getting package mtime..."),back = True)
# .tbz2 md5
etpData['datecreation'] = str(getFileUnixMtime(tbz2File))