Changeset bd5f3b7 in mainline for tools/mktmpfs.py
- Timestamp:
- 2011-08-21T13:07:35Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 00aece0, f1a9e87
- Parents:
- 86a34d3e (diff), a6480d5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/mktmpfs.py
r86a34d3e rbd5f3b7 35 35 import os 36 36 import xstruct 37 38 exclude_names = set(['.svn', '.bzr']) 37 from imgutil import listdir_items, chunks 39 38 40 39 HEADER = """little: … … 71 70 "Recursive directory walk" 72 71 73 for name in os.listdir(root): 74 canon = os.path.join(root, name) 75 76 if (os.path.isfile(canon) and (not name in exclude_names)): 77 size = os.path.getsize(canon) 78 79 dentry = xstruct.create(DENTRY_FILE % len(name)) 72 for item in listdir_items(root): 73 if item.is_file: 74 dentry = xstruct.create(DENTRY_FILE % len(item.name)) 80 75 dentry.kind = TMPFS_FILE 81 dentry.fname_len = len( name)82 dentry.fname = name.encode('ascii')83 dentry.flen = size76 dentry.fname_len = len(item.name) 77 dentry.fname = item.name.encode('ascii') 78 dentry.flen = item.size 84 79 85 80 outf.write(dentry.pack()) 86 81 87 inf = open(canon, "rb") 88 rd = 0; 89 while (rd < size): 90 data = inf.read(4096); 82 for data in chunks(item, 4096): 91 83 outf.write(data) 92 rd += len(data)93 inf.close()94 84 95 if (os.path.isdir(canon) and (not name in exclude_names)):96 dentry = xstruct.create(DENTRY_DIRECTORY % len( name))85 elif item.is_dir: 86 dentry = xstruct.create(DENTRY_DIRECTORY % len(item.name)) 97 87 dentry.kind = TMPFS_DIRECTORY 98 dentry.fname_len = len( name)99 dentry.fname = name.encode('ascii')88 dentry.fname_len = len(item.name) 89 dentry.fname = item.name.encode('ascii') 100 90 101 91 outf.write(dentry.pack()) 102 92 103 recursion( canon, outf)93 recursion(item.path, outf) 104 94 105 95 dentry = xstruct.create(DENTRY_NONE)
Note:
See TracChangeset
for help on using the changeset viewer.