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)
def apply(self, builder, instr, role, target_base, hierarchy): dp = cpiofile.CpioFileDataProvider(hierarchy) files = dp.abs_match(instr.filespec, vroot = target_base) uid = utils.parse_uid(builder, instr.new_user) gid = utils.parse_gid(builder, instr.new_group) for f in files: if (instr.new_user is not None): f.uid = uid if (instr.new_group is not None): f.gid = gid