diff options
author | Jeremy Katz <katzj@redhat.com> | 2004-06-15 19:35:56 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2004-06-15 19:35:56 +0000 |
commit | 25c415dab34029d4c63f1687b7887bf3097c777f (patch) | |
tree | 48ea2a65892daf95cb1ec8817c5d9502fa873699 /scripts | |
parent | fc5279429e5794ec699965a3175c10f6ae84dfbe (diff) | |
download | anaconda-25c415dab34029d4c63f1687b7887bf3097c777f.tar.gz anaconda-25c415dab34029d4c63f1687b7887bf3097c777f.tar.xz anaconda-25c415dab34029d4c63f1687b7887bf3097c777f.zip |
add bits from msw to set mtimes on .pyc files to 0 as that's what they are
on cramfs and this improves the startup time
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/fixmtime.py | 43 | ||||
-rwxr-xr-x | scripts/upd-instroot | 9 |
2 files changed, 52 insertions, 0 deletions
diff --git a/scripts/fixmtime.py b/scripts/fixmtime.py new file mode 100755 index 000000000..f3b046d20 --- /dev/null +++ b/scripts/fixmtime.py @@ -0,0 +1,43 @@ +#!/usr/bin/python + +"""Walks path given on the command line for .pyc and .pyo files, changing +the mtime in the header to 0, so it will match the .py file on the cramfs""" + +import os +import sys +import getopt + +debug = 0 + +def usage(): + print 'usage: %s /path/to/walk/and/fix' %sys.argv[0] + sys.exit(1) + +def visit(arg, d, files): + for filen in files: + if not (filen.endswith('.pyc') or filen.endswith('.pyo')): + continue + path = os.sep.join((d, filen)) + #print 'fixing mtime', path + f = open(path, 'r+') + f.seek(4) + f.write('\0\0\0\0') + f.close() + +if __name__ == '__main__': + (args, extra) = getopt.getopt(sys.argv[1:], '', "debug") + + if len(extra) < 1: + usage() + + for arg in args: + if arg == "--debug": + debug = 1 + + dir = extra[0] + + if not os.path.isdir(dir): + usage() + + os.path.walk(dir, visit, None) + diff --git a/scripts/upd-instroot b/scripts/upd-instroot index c8957b5ff..7b60d4797 100755 --- a/scripts/upd-instroot +++ b/scripts/upd-instroot @@ -814,6 +814,15 @@ if [ $ARCH = s390 -o $ARCH = s390x ]; then done fi +# change mtimes to 0 (to match what happens on the cramfs) +for p in $DEST $DESTGR; do + if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then + runroot $COMPONENT --onlyone --arch $ARCH "cd $p\; usr/lib/anaconda-runtime/fixmtime.py $DEBUG $p" + else + $p/usr/lib/anaconda-runtime/fixmtime.py $DEBUG $p + fi +done + # Remove locales unused during the install cat $DESTGR/usr/lib/anaconda/lang-table* | awk ' { gsub("-", "", $4); |