annotate sources/toys/filter.py @ 1839:c8293b3ab81f draft default tip

Teach chroot-splice to accept one or two arguments. (Control image now optional.)
author Rob Landley <rob@landley.net>
date Sun, 17 Jan 2016 21:18:52 -0600
parents f24c0deeed24
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1404
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/usr/bin/python
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # Filter out baseconfig entries from output of miniconfig.sh
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 import os,sys
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 if len(sys.argv) != 3:
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
8 sys.stderr.write("usage: filter.py baseconfig mini.config\n")
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 sys.exit(1)
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
10
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 baseconfig=file(sys.argv[1]).readlines()
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 miniconfig=file(sys.argv[2]).readlines()
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
13
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 for i in baseconfig:
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 if i in miniconfig:
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 miniconfig.remove(i)
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
17
f24c0deeed24 Add quick and dirty toy to filter out baseconfig entries from miniconfig.sh output to give LINUX_CONFIG entry for a target settings file.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 print "".join(miniconfig),