mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-27 18:35:55 +02:00
dl_cleanup: Add linux and gcc to blacklist
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19082 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
631583226f
commit
4f2988f504
@ -81,12 +81,14 @@ versionRegex = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
blacklist = (
|
blacklist = (
|
||||||
re.compile(r"wl_apsta.*"),
|
("linux", re.compile(r"linux-.*")),
|
||||||
re.compile(r"boost.*"),
|
("gcc", re.compile(r"gcc-.*")),
|
||||||
re.compile(r".*\.fw"),
|
("boost", re.compile(r"boost.*")),
|
||||||
re.compile(r".*\.arm"),
|
("wl_apsta", re.compile(r"wl_apsta.*")),
|
||||||
re.compile(r".*\.bin"),
|
(".fw", re.compile(r".*\.fw")),
|
||||||
re.compile(r"RT\d+_Firmware.*"),
|
(".arm", re.compile(r".*\.arm")),
|
||||||
|
(".bin", re.compile(r".*\.bin")),
|
||||||
|
("rt-firmware", re.compile(r"RT\d+_Firmware.*")),
|
||||||
)
|
)
|
||||||
|
|
||||||
class EntryParseError(Exception): pass
|
class EntryParseError(Exception): pass
|
||||||
@ -132,14 +134,15 @@ def usage():
|
|||||||
print "Usage: " + sys.argv[0] + " [OPTIONS] <path/to/dl>"
|
print "Usage: " + sys.argv[0] + " [OPTIONS] <path/to/dl>"
|
||||||
print ""
|
print ""
|
||||||
print " -d|--dry-run Do a dry-run. Don't delete any files"
|
print " -d|--dry-run Do a dry-run. Don't delete any files"
|
||||||
|
print " -B|--show-blacklist Show the blacklist and exit"
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
global opt_dryrun
|
global opt_dryrun
|
||||||
|
|
||||||
try:
|
try:
|
||||||
(opts, args) = getopt.getopt(argv[1:],
|
(opts, args) = getopt.getopt(argv[1:],
|
||||||
"hd",
|
"hdB",
|
||||||
[ "help", "dry-run", ])
|
[ "help", "dry-run", "show-blacklist", ])
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
raise getopt.GetoptError()
|
raise getopt.GetoptError()
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
@ -152,14 +155,18 @@ def main(argv):
|
|||||||
return 0
|
return 0
|
||||||
if o in ("-d", "--dry-run"):
|
if o in ("-d", "--dry-run"):
|
||||||
opt_dryrun = True
|
opt_dryrun = True
|
||||||
|
if o in ("-B", "--show-blacklist"):
|
||||||
|
for (name, regex) in blacklist:
|
||||||
|
print name
|
||||||
|
return 0
|
||||||
|
|
||||||
# Create a directory listing and parse the file names.
|
# Create a directory listing and parse the file names.
|
||||||
entries = []
|
entries = []
|
||||||
for filename in os.listdir(directory):
|
for filename in os.listdir(directory):
|
||||||
if filename == "." or filename == "..":
|
if filename == "." or filename == "..":
|
||||||
continue
|
continue
|
||||||
for black in blacklist:
|
for (name, regex) in blacklist:
|
||||||
if black.match(filename):
|
if regex.match(filename):
|
||||||
if opt_dryrun:
|
if opt_dryrun:
|
||||||
print filename, "is blacklisted"
|
print filename, "is blacklisted"
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user