Exemplo n.º 1
0
    def apply(self, builder, instr, role, target_base, hierarchy):
        # Find or create the relevant file
        cpio_file = cpiofile.File()

        (clrb, setb) = utils.parse_mode(instr.mode)
        cpio_file.mode = setb
        cpio_file.uid = utils.parse_uid(builder, instr.uid)
        cpio_file.gid = utils.parse_gid(builder, instr.gid)
        if (instr.type == "char"):
            cpio_file.mode = cpio_file.mode | cpiofile.File.S_CHAR
        else:
            cpio_file.mode = cpio_file.mode | cpiofile.File.S_BLK

        cpio_file.rdev = os.makedev(int(instr.major), int(instr.minor))
        # Zero-length file - it's a device node.
        cpio_file.name = None
        cpio_file.data = None

        #print "target_base = %s for role %s"%(target_base, role)
        real_path = utils.rel_join(target_base, instr.file_name)

        cpio_file.key_name = real_path
        #print "put_target_file %s"%real_path
        print 'Adding device node %s'%real_path
        hierarchy.put_target_file(real_path, cpio_file)
Exemplo n.º 2
0
    def apply(self, builder, instr, role, target_base, hierarchy):
        dp = cpiofile.CpioFileDataProvider(hierarchy)

        (clrb, bits) = utils.parse_mode(instr.new_mode)



        files = dp.abs_match(instr.filespec,
                             vroot = target_base)


        for f in files:
            # For now ..
            #print "Change mode of f %s -> %s"%(f.name, instr.new_mode)
            #print "mode = %o clrb = %o bits = %o\n"%(f.mode, clrb, bits)
            #print "Change mode of %s"%(f.name)
            f.mode = f.mode & ~clrb
            f.mode = f.mode | bits