Example #1
0
def check_timestamps():
    """
    Check all files for timestamps in the future; common from hardware
    (e.g. alpha) which have far-future dates as their default dates.
    """

    global current_file

    q = DBConn().session().query(PoolFile).filter(PoolFile.filename.like('.deb$'))

    db_files.clear()
    count = 0

    for pf in q.all():
        filename = os.path.abspath(os.path.join(pf.location.path, pf.filename))
        if os.access(filename, os.R_OK):
            f = utils.open_file(filename)
            current_file = filename
            sys.stderr.write("Processing %s.\n" % (filename))
            apt_inst.debExtract(f, Ent, "control.tar.gz")
            f.seek(0)
            apt_inst.debExtract(f, Ent, "data.tar.gz")
            count += 1

    print "Checked %d files (out of %d)." % (count, len(db_files.keys()))
Example #2
0
def check_timestamps():
    """
    Check all files for timestamps in the future; common from hardware
    (e.g. alpha) which have far-future dates as their default dates.
    """

    global current_file

    q = DBConn().session().query(PoolFile).filter(
        PoolFile.filename.like('.deb$'))

    db_files.clear()
    count = 0

    for pf in q.all():
        filename = os.path.abspath(os.path.join(pf.location.path, pf.filename))
        if os.access(filename, os.R_OK):
            f = utils.open_file(filename)
            current_file = filename
            sys.stderr.write("Processing %s.\n" % (filename))
            apt_inst.debExtract(f, Ent, "control.tar.gz")
            f.seek(0)
            apt_inst.debExtract(f, Ent, "data.tar.gz")
            count += 1

    print "Checked %d files (out of %d)." % (count, len(db_files.keys()))
def main():
    """Main function"""
    if len(sys.argv) < 2:
        print >> sys.stderr, "need filename argumnet"
        sys.exit(1)

    fobj = open(sys.argv[1])
    try:
        apt_inst.debExtract(fobj, callback, "data.tar.gz")
    finally:
        fobj.close()
Example #4
0
 def filelist(self):
     """ return the list of files in the deb """
     files = []
     def extract_cb(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor):
         #print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u"\
         #      % (What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor)
         files.append(Name)
     for member in self._supported_data_members:
         if arCheckMember(open(self.filename), member):
             try:
                 apt_inst.debExtract(open(self.filename), extract_cb, member)
                 break
             except SystemError, e:
                 return [_("List of files for '%s'could not be read" % self.filename)]
Example #5
0
    def filelist(self):
        """ return the list of files in the deb """
        files = []

        def extract_cb(What, Name, Link, Mode, UID, GID, Size, MTime, Major,
                       Minor):
            #print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u"\
            #      % (What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor)
            files.append(Name)

        for member in self._supported_data_members:
            if arCheckMember(open(self.filename), member):
                try:
                    apt_inst.debExtract(open(self.filename), extract_cb,
                                        member)
                    break
                except SystemError, e:
                    return [
                        _("List of files for '%s'could not be read" %
                          self.filename)
                    ]
Example #6
0
    def items(self):
        """ Return the list of items in the package.
        Each file is represented by an instance of  FileInfo """
        items = []

        def extract_cb(kind, name, target, mode, uid, gid, size, mtime, major, minor):
            if kind == "FILE":
                items.append(FileInfo(name, mode, uid, gid, size, mtime))
            elif kind == "DIR":
                items.append(DirectoryInfo(name, mode, uid, gid, size, mtime))
            elif kind == "SYMLINK":
                items.append(SymbolicLinkInfo(name, target, mode, uid, gid, size, mtime))
            elif kind == "HARDLINK":
                items.append(HardLinkInfo(name, target, mode, uid, gid, size, mtime))
            elif kind == "FIFO":
                items.append(FifoInfo(name, mode, uid, gid, size, mtime))
            else:
                print "unsupported kind: %s" % kind
        try:
            apt_inst.debExtract(open(self.filename), extract_cb, "data.tar.gz")
        except:
            apt_inst.debExtract(open(self.filename), extract_cb, "data.tar.bz2")
        return items
Example #7
0
def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor):
    """ callback for debExtract """

    print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u"\
          % (What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor)


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print "need filename argumnet"
        sys.exit(1)
    file = sys.argv[1]

    print "Working on: %s" % file
    print "Displaying data.tar.gz:"
    apt_inst.debExtract(open(file), Callback, "data.tar.gz")

    print "Now extracting the control file:"
    control = apt_inst.debExtractControl(open(file))
    sections = apt_pkg.ParseSection(control)

    print "Maintainer is: "
    print sections["Maintainer"]

    print
    print "DependsOn: "
    depends = sections["Depends"]
    print apt_pkg.ParseDepends(depends)

    print "extracting archive"
    dir = "/tmp/deb"
def main():
    member = "data.tar.lzma"
    if len(sys.argv) > 2:
        member = sys.argv[2]
    apt_inst.debExtract(open(sys.argv[1]), Callback, member)
def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor):
    """ callback for debExtract """
    print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" \
          % (What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor)


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print "need filename argumnet"
        sys.exit(1)
    file = sys.argv[1]

    print "Working on: %s" % file
    print "Displaying data.tar.gz:"
    apt_inst.debExtract(open(file), Callback, "data.tar.gz")

    print "Now extracting the control file:"
    control = apt_inst.debExtractControl(open(file))
    sections = apt_pkg.ParseSection(control)

    print "Maintainer is: "
    print sections["Maintainer"]

    print
    print "DependsOn: "
    depends = sections["Depends"]
    print apt_pkg.ParseDepends(depends)


    print "extracting archive"
Example #10
0
#!/usr/bin/python

import apt_inst
import sys


def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor):
    print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" % (
        What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor)


member = "data.tar.lzma"
if len(sys.argv) > 2:
    member = sys.argv[2]
apt_inst.debExtract(open(sys.argv[1]), Callback, member)
Example #11
0
#!/usr/bin/python

import apt_inst
import sys

def Callback(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor):
    print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" % (
        What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor)

member = "data.tar.lzma" 
if len(sys.argv) > 2:
    member = sys.argv[2]
apt_inst.debExtract(open(sys.argv[1]), Callback, member)