mirror of https://github.com/hak5/openwrt.git
dl_cleanup: Show it to the user, if file extension or version pattern is unknown
SVN-Revision: 19085lede-17.01
parent
bee5dab1a1
commit
ff6010a732
|
@ -11,8 +11,6 @@ import os
|
||||||
import re
|
import re
|
||||||
import getopt
|
import getopt
|
||||||
|
|
||||||
DEBUG = 0
|
|
||||||
|
|
||||||
# Commandline options
|
# Commandline options
|
||||||
opt_dryrun = False
|
opt_dryrun = False
|
||||||
|
|
||||||
|
@ -94,7 +92,7 @@ blacklist = [
|
||||||
(".fw", re.compile(r".*\.fw")),
|
(".fw", re.compile(r".*\.fw")),
|
||||||
(".arm", re.compile(r".*\.arm")),
|
(".arm", re.compile(r".*\.arm")),
|
||||||
(".bin", re.compile(r".*\.bin")),
|
(".bin", re.compile(r".*\.bin")),
|
||||||
("rt-firmware", re.compile(r"RT\d+_Firmware.*")),
|
("rt-firmware", re.compile(r"RT[\d\w]+_Firmware.*")),
|
||||||
]
|
]
|
||||||
|
|
||||||
class EntryParseError(Exception): pass
|
class EntryParseError(Exception): pass
|
||||||
|
@ -110,8 +108,7 @@ class Entry:
|
||||||
filename = filename[0:0-len(ext)]
|
filename = filename[0:0-len(ext)]
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if DEBUG:
|
print self.filename, "has an unknown file-extension"
|
||||||
print "Extension did not match on", filename
|
|
||||||
raise EntryParseError("ext")
|
raise EntryParseError("ext")
|
||||||
for (regex, parseVersion) in versionRegex:
|
for (regex, parseVersion) in versionRegex:
|
||||||
match = regex.match(filename)
|
match = regex.match(filename)
|
||||||
|
@ -119,8 +116,7 @@ class Entry:
|
||||||
(self.progname, self.version) = parseVersion(match)
|
(self.progname, self.version) = parseVersion(match)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if DEBUG:
|
print self.filename, "has an unknown version pattern"
|
||||||
print "Version regex did not match on", filename
|
|
||||||
raise EntryParseError("ver")
|
raise EntryParseError("ver")
|
||||||
|
|
||||||
def deleteFile(self):
|
def deleteFile(self):
|
||||||
|
|
Loading…
Reference in New Issue