Example #1
0
 def add_file_item():
     # Prevent code duplication
     if not os.path.islink(target):
         shelltools.set_id(target, perms["uid"], perms["gid"])
         shelltools.set_mod(target, perms["mod"])
         self.append_filesdb("file", real_target, perms, \
                 sha1sum=utils.sha1sum(target),
                 size = utils.get_size(source, dec=True)
         )
     else:
         self.append_filesdb("link", real_target, perms,\
                 realpath=os.path.realpath(source))
Example #2
0
 def add_file_item():
     # Prevent code duplication
     if not os.path.islink(target):
         shelltools.set_id(target, perms["uid"],
                           perms["gid"])
         shelltools.set_mod(target, perms["mod"])
         self.append_filesdb("file", real_target, perms, \
                 sha1sum=utils.sha1sum(target),
                 size = utils.get_size(source, dec=True)
         )
     else:
         self.append_filesdb("link", real_target, perms,\
                 realpath=os.path.realpath(source))
Example #3
0
            for path in content["dirs"]:
                if path == "" or not os.path.exists(path):
                    if path != "": print("\t%s not found" % path)
                    continue
                uid = utils.get_uid(path)
                gid = utils.get_gid(path)
                mod = utils.get_mod(path)
                if not os.path.islink(path):
                    _filesdb.append_query((repo, category, name, version, path, \
                            "dir", None, gid, mod, uid, None, None))
                else:
                    _filesdb.append_query((repo, category, name, version, path, \
                            "link", None, gid, mod, uid, None, os.path.realpath(path)))
            for path in content["file"]:
                if path == "" or not os.path.exists(path):
                    if path != "": print("\t%s not found" % path)
                    continue
                uid = utils.get_uid(path)
                gid = utils.get_gid(path)
                mod = utils.get_mod(path)
                if not os.path.islink(path):
                    size = utils.get_size(path, dec=True)
                    sha1sum = utils.sha1sum(path)
                    _filesdb.append_query((repo, category, name, version, path, \
                        "file", size, gid, mod, uid, sha1sum, None))
                else:
                    _filesdb.append_query((repo, category, name, version, path, \
                        "link", None, gid, mod, uid, None, None))

_filesdb.insert_query(commit=True)