* use keyword arguments for files.File
* fix: use Long insted of Integer type for file/dir sizes we just removed 4GB limits, ahahaha * build number: start counting from 1 like normal human beings
This commit is contained in:
+6
-6
@@ -344,8 +344,8 @@ class Builder:
|
|||||||
for path in package.files:
|
for path in package.files:
|
||||||
size += util.dir_size(util.join_path(d, path.path))
|
size += util.dir_size(util.join_path(d, path.path))
|
||||||
|
|
||||||
metadata.package.installedSize = int(size) # should be enough for everyone!
|
metadata.package.installedSize = size
|
||||||
# mwahahah! FIXME: really?
|
|
||||||
# build no
|
# build no
|
||||||
if ctx.config.options.ignore_build_no:
|
if ctx.config.options.ignore_build_no:
|
||||||
metadata.package.build = None # means, build no information n/a
|
metadata.package.build = None # means, build no information n/a
|
||||||
@@ -380,10 +380,10 @@ class Builder:
|
|||||||
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
frpath = util.removepathprefix(install_dir, fpath) # relative path
|
||||||
ftype = get_file_type(frpath, package.files)
|
ftype = get_file_type(frpath, package.files)
|
||||||
try: # broken links and empty dirs can cause problem
|
try: # broken links and empty dirs can cause problem
|
||||||
fsize = str(os.path.getsize(fpath))
|
fsize = os.path.getsize(fpath)
|
||||||
except OSError:
|
except OSError:
|
||||||
fsize = None
|
fsize = None
|
||||||
d[frpath] = FileInfo(frpath, ftype, fsize, fhash)
|
d[frpath] = FileInfo(path=frpath, type=ftype, size=fsize, hash=fhash)
|
||||||
|
|
||||||
for pinfo in package.files:
|
for pinfo in package.files:
|
||||||
wildcard_path = util.join_path(install_dir, pinfo.path)
|
wildcard_path = util.join_path(install_dir, pinfo.path)
|
||||||
@@ -424,8 +424,8 @@ class Builder:
|
|||||||
locate_package_names(files)
|
locate_package_names(files)
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
return 0
|
return 1
|
||||||
ctx.ui.warning(_('(no previous build found, setting build no to 0.)'))
|
ctx.ui.warning(_('(no previous build found, setting build no to 1.)'))
|
||||||
else:
|
else:
|
||||||
a = filter(lambda (x,y): y != None, found)
|
a = filter(lambda (x,y): y != None, found)
|
||||||
ctx.ui.debug(str(a))
|
ctx.ui.debug(str(a))
|
||||||
|
|||||||
+4
-1
@@ -26,7 +26,7 @@ class File:
|
|||||||
|
|
||||||
t_Path = [ xmlfile.String, xmlfile.mandatory ]
|
t_Path = [ xmlfile.String, xmlfile.mandatory ]
|
||||||
t_Type = [ xmlfile.String, xmlfile.mandatory ]
|
t_Type = [ xmlfile.String, xmlfile.mandatory ]
|
||||||
t_Size = [ xmlfile.Integer, xmlfile.mandatory ]
|
t_Size = [ xmlfile.Long, xmlfile.mandatory ]
|
||||||
t_Hash = [ xmlfile.String, xmlfile.optional, "SHA1Sum" ]
|
t_Hash = [ xmlfile.String, xmlfile.optional, "SHA1Sum" ]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -42,6 +42,9 @@ class Files(xmlfile.XmlFile):
|
|||||||
|
|
||||||
t_List = [ [File], xmlfile.optional, "File"]
|
t_List = [ [File], xmlfile.optional, "File"]
|
||||||
|
|
||||||
|
def append(self, fileinfo):
|
||||||
|
self.list.append(fileinfo)
|
||||||
|
|
||||||
class FilesDB(shelve.LockedDBShelf):
|
class FilesDB(shelve.LockedDBShelf):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ class Package(specfile.Package):
|
|||||||
t_Distribution = [ xmlfile.String, xmlfile.mandatory]
|
t_Distribution = [ xmlfile.String, xmlfile.mandatory]
|
||||||
t_DistributionRelease = [ xmlfile.String, xmlfile.mandatory]
|
t_DistributionRelease = [ xmlfile.String, xmlfile.mandatory]
|
||||||
t_Architecture = [ xmlfile.String, xmlfile.mandatory]
|
t_Architecture = [ xmlfile.String, xmlfile.mandatory]
|
||||||
t_InstalledSize = [ xmlfile.Integer, xmlfile.mandatory]
|
t_InstalledSize = [ xmlfile.Long, xmlfile.mandatory]
|
||||||
t_PackageURI = [ xmlfile.String, xmlfile.optional]
|
t_PackageURI = [ xmlfile.String, xmlfile.optional]
|
||||||
|
|
||||||
def decode_hook(self, node, errs, where):
|
def decode_hook(self, node, errs, where):
|
||||||
|
|||||||
Reference in New Issue
Block a user