mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-30 19:37:31 +02:00
dl_cleanup: Allow removing items from blacklist
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19083 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
4f2988f504
commit
948d868266
@ -80,7 +80,7 @@ versionRegex = (
|
|||||||
(re.compile(r"(.+)[-_]r?(\d+)"), parseVer_r), # xxx-r1111
|
(re.compile(r"(.+)[-_]r?(\d+)"), parseVer_r), # xxx-r1111
|
||||||
)
|
)
|
||||||
|
|
||||||
blacklist = (
|
blacklist = [
|
||||||
("linux", re.compile(r"linux-.*")),
|
("linux", re.compile(r"linux-.*")),
|
||||||
("gcc", re.compile(r"gcc-.*")),
|
("gcc", re.compile(r"gcc-.*")),
|
||||||
("boost", re.compile(r"boost.*")),
|
("boost", re.compile(r"boost.*")),
|
||||||
@ -89,7 +89,7 @@ blacklist = (
|
|||||||
(".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+_Firmware.*")),
|
||||||
)
|
]
|
||||||
|
|
||||||
class EntryParseError(Exception): pass
|
class EntryParseError(Exception): pass
|
||||||
|
|
||||||
@ -135,14 +135,15 @@ def usage():
|
|||||||
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"
|
print " -B|--show-blacklist Show the blacklist and exit"
|
||||||
|
print " -w|--whitelist ITEM Remove ITEM from blacklist"
|
||||||
|
|
||||||
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:],
|
||||||
"hdB",
|
"hdBw:",
|
||||||
[ "help", "dry-run", "show-blacklist", ])
|
[ "help", "dry-run", "show-blacklist", "whitelist=", ])
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
raise getopt.GetoptError()
|
raise getopt.GetoptError()
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
@ -155,6 +156,16 @@ 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 ("-w", "--whitelist"):
|
||||||
|
for i in range(0, len(blacklist)):
|
||||||
|
(name, regex) = blacklist[i]
|
||||||
|
if name == v:
|
||||||
|
del blacklist[i]
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print "Whitelist error: Item", v,\
|
||||||
|
"is not in blacklist"
|
||||||
|
return 1
|
||||||
if o in ("-B", "--show-blacklist"):
|
if o in ("-B", "--show-blacklist"):
|
||||||
for (name, regex) in blacklist:
|
for (name, regex) in blacklist:
|
||||||
print name
|
print name
|
||||||
|
Loading…
Reference in New Issue
Block a user