Fix postinst CONTENTS

master3.3
Mike Hiretsky 11 years ago
parent 28bdaeb435
commit 06f5b638a0

@ -5017,9 +5017,12 @@ gettext -d cl_template "$*"
if not pkg:
return pathFile
if checkContents("{CATEGORY}/{PF}".format(**pkg[-1]),
pathFile,
prefix=chrootPath):
return pathFile
pathFile,
prefix=chrootPath,
reservedFile='/var/lib/calculate/-CONTENTS-{PN}'.format(**pkg[-1]) \
if self.objVar.Get('cl_ebuild_phase') == 'postinst' \
else None):
return pathFile
real_filename = os.path.basename(pathFile)
real_dirname = os.path.dirname(pathFile)
self.configMode = T_NEWCFG

@ -126,7 +126,29 @@ class PkgContents:
elif path.isfile(newfilename):
self.addFile(filename)
def checkContents(pkg,fileName,prefix='/'):
def checkReserved(fileName,contentFile):
"""
Check contents with newContent
"""
TYPE,FILENAME,MD5,MTIME=0,1,2,3
obj = filter(lambda x:x[1] == fileName,
map(lambda x:x.split(' '),
filter(lambda x:x.startswith('obj'),
readLinesFile(contentFile))))
# if pkg not content filename
if not obj:
return True
# if file is not exists
if not path.exists(fileName):
return True
contentMD5 = hashlib.md5(readFile(fileName)).hexdigest().strip()
configMD5 = obj[0][MD5].strip()
# if content was not changed
if contentMD5 == configMD5:
return True
return False
def checkContents(pkg,fileName,prefix='/',reservedFile=None):
"""
Check contents with newContent
"""
@ -143,10 +165,18 @@ def checkContents(pkg,fileName,prefix='/'):
readLinesFile(contentFile))))
# if pkg not content filename
if not obj:
return True
# for using reserved -CONTENTS file on postinst
if not reservedFile or checkReserved(fileName,reservedFile):
return True
else:
return False
# if file is not exists
if not path.exists(fileName):
return True
# for using reserved -CONTENTS file on postinst
if not reservedFile or checkReserved(fileName,reservedFile):
return True
else:
return False
contentMD5 = hashlib.md5(readFile(fileName)).hexdigest().strip()
configMD5 = obj[0][MD5].strip()
# if content was not changed

Loading…
Cancel
Save