parent
dfbc91f22e
commit
156e281a82
|
@ -14,6 +14,8 @@ logger = logging.getLogger(__name__)
|
||||||
def take():
|
def take():
|
||||||
parser = argparse.ArgumentParser(description='update version records of nvchecker')
|
parser = argparse.ArgumentParser(description='update version records of nvchecker')
|
||||||
core.add_common_arguments(parser)
|
core.add_common_arguments(parser)
|
||||||
|
parser.add_argument('--all', action='store_true',
|
||||||
|
help='take all updates')
|
||||||
parser.add_argument('names', metavar='NAME', nargs='*',
|
parser.add_argument('names', metavar='NAME', nargs='*',
|
||||||
help='software name to be updated')
|
help='software name to be updated')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
@ -30,14 +32,17 @@ def take():
|
||||||
oldvers = core.read_verfile(s.oldver)
|
oldvers = core.read_verfile(s.oldver)
|
||||||
newvers = core.read_verfile(s.newver)
|
newvers = core.read_verfile(s.newver)
|
||||||
|
|
||||||
for name in args.names:
|
if args.all:
|
||||||
try:
|
oldvers.update(newvers)
|
||||||
oldvers[name] = newvers[name]
|
else:
|
||||||
except KeyError:
|
for name in args.names:
|
||||||
logger.fatal(
|
try:
|
||||||
"%s doesn't exist in 'newver' set.", name
|
oldvers[name] = newvers[name]
|
||||||
)
|
except KeyError:
|
||||||
sys.exit(2)
|
logger.fatal(
|
||||||
|
"%s doesn't exist in 'newver' set.", name
|
||||||
|
)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.rename(s.oldver, s.oldver + '~')
|
os.rename(s.oldver, s.oldver + '~')
|
||||||
|
|
Loading…
Reference in New Issue