44
45
interactive = False # Set to true for interactive command line
45
46
match_commands = [] # For interactive command line completion
48
#------------------------------------------------------------------------
52
#------------------------------------------------------------------------
53
def requires_no_args(command, args, test=False):
56
message = "no further arguments"
57
print "WaJIG Error: " + command.upper() + " requires " + message
63
def requires_one_arg(command, args, message=False):
65
if message: # checks if this is a unit test
66
print "WaJIG Error: " + command.upper() + " requires " + message
72
def requires_two_args(command, args, message=False):
74
if message: # checks if this is a unit test
75
print "WaJIG Error: " + command.upper() + " requires " + message
81
def requires_opt_arg(command, args, message=False):
83
if message: # checks if this is a unit test
84
print "WaJIG Error: " + command.upper() +\
85
" has one optional arg: " + message
91
def requires_args(command, args, required=False):
93
if required: # checks if this is a unit test
94
print "WaJIG Error: {0} requires {1}".\
95
format(command.upper(), required)
101
def requires_package(package, path, test=False):
102
if not os.path.exists(path):
104
print 'The "' + package + '" package does not appear to be installed.'
105
print 'Consider installing it with "wajig install ' + package + '".'
111
def finishup(code=0):
114
print "Press Enter to continue...",
48
pager = False # Use a pager?
120
51
def print_help(command, args, verbose=False, exit=False):
121
52
if command == "doc" or command == "docs" or command == "documentation":
122
requires_no_args(command, args)
53
util.requires_no_args(command, args)
124
55
documentation.help(verbose)
127
58
elif command == "help":
128
requires_no_args(command, args)
59
util.requires_no_args(command, args)
129
60
documentation.help(verbose)
134
65
#------------------------------------------------------------------------
352
295
changes.start_log()
353
296
if command in ["addcdrom", "cdromadd"]:
354
if requires_no_args(command, args):
297
if util.requires_no_args(command, args):
355
298
perform.execute("apt-cdrom add", root=True)
357
300
elif command == "addrepo":
358
if requires_one_arg(command, args,
301
if util.requires_one_arg(command, args,
359
302
"a PPA (Personal Package Archive) repository to add"):
360
if requires_package("add-apt-repository",
303
if util.requires_package("add-apt-repository",
361
304
"/usr/bin/add-apt-repository"):
362
305
perform.execute("add-apt-repository " + args[1], root=True)
364
307
elif command in ["autoalts", "autoalternatives"]:
365
if requires_one_arg(command, args, "name alternative to set as auto"):
308
if util.requires_one_arg(command, args, "name alternative to set as auto"):
366
309
perform.execute("update-alternatives --auto " + args[1], root=True)
368
311
elif command == "autodownload":
369
if requires_no_args(command, args):
312
if util.requires_no_args(command, args):
371
314
commands.do_update()
380
323
commands.do_newupgrades()
382
325
elif command == "autoclean":
383
if requires_no_args(command, args):
326
if util.requires_no_args(command, args):
384
327
perform.execute("apt-get autoclean", root=True)
386
329
elif command == "autoinstall":
387
if requires_args(command, args, "a list of package names"):
330
if util.requires_args(command, args, "a list of package names"):
388
331
command = "apt-get install --assume-yes " + noauth + " " +\
389
332
perform.concat(args[1:])
390
333
perform.execute(command, root=True)
392
335
elif command == "autoremove":
393
if requires_no_args(command, args):
336
if util.requires_no_args(command, args):
394
337
perform.execute("apt-get autoremove", root=True)
396
339
elif command in ["available", "avail"]:
397
if requires_args(command, args, "a list of packages"):
340
if util.requires_args(command, args, "a list of packages"):
398
341
perform.execute("apt-cache policy " + perform.concat(args[1:]))
400
343
elif command in ["bug", "bugs", "reportbug"]:
401
if requires_one_arg(command, args, "a single named package"):
402
if requires_package("reportbug", "/usr/bin/reportbug"):
344
if util.requires_one_arg(command, args, "a single named package"):
345
if util.requires_package("reportbug", "/usr/bin/reportbug"):
403
346
# 090430 Specify bts=debian since ubuntu not working at present
404
347
perform.execute("reportbug --bts=debian " + args[1])
406
349
elif command == "build":
407
if requires_args(command, args, "a list of package names"):
408
if requires_package("fakeroot", "/usr/bin/fakeroot"):
350
if util.requires_args(command, args, "a list of package names"):
351
if util.requires_package("sudo", "/usr/bin/sudo"):
409
352
# First make sure dependencies are met
410
353
result = perform.execute("apt-get build-dep " +
411
perform.concat(args[1:]), root=True)
354
perform.concat(args[1:]), root=True)
413
perform.execute("fakeroot " + "apt-get source -b " +
414
perform.concat(args[1:]))
356
perform.execute("apt-get source -b " +
357
perform.concat(args[1:]), root=True)
416
elif command == "builddepend":
417
if requires_args(command, args, "a list of package names"):
359
elif command in ("builddepend", "builddep"):
360
if util.requires_args(command, args, "a list of package names"):
418
361
perform.execute("apt-get build-dep " + perform.concat(args[1:]),
364
elif command in ("reverse-build-depends", "rbuilddeps"):
365
if util.requires_one_arg(command, args, "one package name") \
366
and util.requires_package("grep-dctrl", "/usr/bin/grep-dctrl"):
367
commands.rbuilddep(args[1])
421
369
elif command == "changelog":
422
if requires_args(command, args, "a list of packages"):
423
commands.do_changelog(args[1:])
370
if util.requires_one_arg(command, args, "one package name") \
371
and util.package_exists(args[1]):
372
commands.do_changelog(args[1], pager)
425
374
elif command == "clean":
426
if requires_no_args(command, args):
375
if util.requires_no_args(command, args):
427
376
perform.execute("apt-get clean", root=True)
429
378
elif command == "contents":
430
if requires_one_arg(command, args, "a filename"):
379
if util.requires_one_arg(command, args, "a filename"):
431
380
perform.execute("dpkg --contents " + args[1])
433
382
elif command == "dailyupgrade":
434
if requires_no_args(command, args):
383
if util.requires_no_args(command, args):
435
384
commands.do_update()
436
385
perform.execute("apt-get --show-upgraded dist-upgrade", root=True)
438
387
elif command == "dependents":
439
if requires_one_arg(command, args, "package name"):
388
if util.requires_one_arg(command, args, "one package name"):
440
389
commands.do_dependents(args[1])
442
391
elif command == "describe":
443
if requires_args(command, args, "a list of packages"):
392
if util.requires_args(command, args, "a list of packages"):
444
393
commands.do_describe(args[1:])
446
395
elif command in ["describenew", "newdescribe"]:
447
if requires_no_args(command, args):
396
if util.requires_no_args(command, args):
448
397
commands.do_describe_new()
450
399
elif command in ["detail", "details", "show"]:
451
if requires_args(command, args, "a list of packages or package file"):
400
if util.requires_args(command, args, "a list of packages or package file"):
453
402
commands.set_verbosity_level(verbose)
454
403
commands.do_describe(args[1:])
456
405
elif command in ["detailnew", "newdetail"]:
457
if requires_no_args(command, args):
406
if util.requires_no_args(command, args):
459
408
commands.set_verbosity_level(verbose)
460
409
commands.do_describe_new()
462
411
elif command == "distupgrade":
463
if requires_opt_arg(command, args,
413
if util.requires_opt_arg(command, args,
464
414
"the distribution to upgrade to"):
465
cmd = "apt-get -u %s %s " % (yes, noauth)
467
cmd += "-t " + args[1] + " "
468
cmd += "dist-upgrade"
469
perform.execute(cmd, root=True)
416
and util.requires_package("dpkg-repack", "/usr/bin/dpkg-repack") \
417
and util.requires_package("fakeroot", "/usr/bin/fakeroot"):
419
changes.backup_before_upgrade(backup, distupgrade=True)
420
if upgradable != "quit":
421
cmd = "apt-get -u %s %s " % (yes, noauth)
423
cmd += "-t " + args[1] + " "
424
cmd += "dist-upgrade"
425
perform.execute(cmd, root=True)
471
427
elif command == "download":
472
if requires_args(command, args, "a list of packages"):
428
if util.requires_args(command, args, "a list of packages"):
474
430
if len(pkgs) == 1 and pkgs[0] == "-":
475
431
stripped = [x.strip() for x in sys.stdin.readlines()]
495
451
elif command in ["editsources", "setup"]:
496
if requires_no_args(command, args):
497
# if requires_package("base-config", "/usr/sbin/apt-setup"):
452
if util.requires_no_args(command, args):
453
# if util.requires_package("base-config", "/usr/sbin/apt-setup"):
498
454
# perform.execute("apt-setup", root=True)
499
455
perform.execute("editor /etc/apt/sources.list", root=True)
501
457
elif command == "extract":
502
if requires_two_args(command, args,
458
if util.requires_two_args(command, args,
503
459
"a filename and directory to extract into"):
504
460
perform.execute("dpkg --extract " + args[1] + " " + args[2])
506
462
elif command in ["filedownload", "downloadfile"]:
507
if requires_one_arg(command, args,
463
if util.requires_one_arg(command, args,
508
464
"a file name containing list of packages"):
509
465
stripped = [x.strip() for x in open(args[1]).readlines()]
510
466
pkgs = str.join(stripped)
511
467
perform.execute("apt-get --download-only install " + pkgs, root=True)
513
469
elif command in ["fileinstall", "installfile"]:
514
if requires_one_arg(command, args,
515
"a file name containing list of packages"):
470
if util.requires_one_arg(command, args,
471
"a file name containing a list of packages"):
516
472
stripped = [x.strip() for x in open(args[1]).readlines()]
517
473
pkgs = str.join(stripped)
518
474
perform.execute("apt-get install " + pkgs, root=True)
520
476
elif command in ["fileremove", "removefile"]:
521
if requires_one_arg(command, args,
522
"a file name containing list of packages"):
477
if util.requires_one_arg(command, args,
478
"a file name containing a list of packages"):
523
479
stripped = [x.strip() for x in open(args[1]).readlines()]
524
480
pkgs = str.join(stripped)
525
481
perform.execute("apt-get remove " + pkgs, root=True)
527
483
elif command in ["findfile", "locate"]:
528
if requires_one_arg(command, args, "a file name"):
484
if util.requires_one_arg(command, args, "a file name"):
529
485
perform.execute("dpkg --search " + args[1])
531
487
elif command in ["findpkg", "unofficial"]:
532
if requires_one_arg(command, args, "a package name"):
488
if util.requires_one_arg(command, args, "one package name") \
489
and util.requires_package("wget", "/usr/bin/wget"):
533
490
commands.do_findpkg(args[1])
535
492
elif command == "fixconfigure":
536
if requires_no_args(command, args):
493
if util.requires_no_args(command, args):
537
494
perform.execute("dpkg --configure -a", root=True)
539
496
elif command == "fixinstall":
540
if requires_no_args(command, args):
497
if util.requires_no_args(command, args):
541
498
perform.execute("apt-get --fix-broken install", root=True)
543
500
elif command == "fixmissing":
544
if requires_no_args(command, args):
501
if util.requires_no_args(command, args):
545
502
perform.execute("apt-get --fix-missing upgrade", root=True)
547
504
elif command == "force":
548
if requires_args(command, args, "a package name"):
505
if util.requires_args(command, args, "a package name"):
549
506
commands.do_force(args[1:])
551
508
elif command == "geturl":
552
if requires_one_arg(command, args, "a package name"):
509
if util.requires_one_arg(command, args, "one package name"):
553
510
# Not yet quite working
554
511
perform.execute("/usr/lib/apt-move/fetch -t " + args[1], root=True)
556
513
elif command == "hold":
557
if requires_args(command, args, "a list of packages to place on hold"):
514
if util.requires_args(command, args, "a list of packages to place on hold"):
558
515
commands.do_hold(args[1:])
559
516
# TODO Perhaps I can use map to "execute" over each package
561
518
elif command == "info":
562
if requires_one_arg(command, args, "a filename"):
519
if util.requires_one_arg(command, args, "one filename"):
563
520
perform.execute("dpkg --info " + args[1])
565
522
elif command == "init":
566
if requires_no_args(command, args):
523
if util.requires_no_args(command, args):
567
524
changes.reset_files()
569
526
elif command in ["install", "isntall"]:
571
528
# Okay, so I'm sometimes dyslexic :-)
573
if requires_args(command, args,
530
if util.requires_args(command, args,
574
531
"a list of packages, .deb files, or url"):
575
532
commands.do_install(args[1:], noauth)
577
534
elif command in ["installr", "recommended"]:
578
if requires_args(command, args, "a list of packages"):
535
if util.requires_args(command, args, "a list of packages"):
579
536
commands.do_install_suggest(args[1:], "Recommends")
581
538
elif command == "installrs":
582
if requires_args(command, args, "a list of packages"):
539
if util.requires_args(command, args, "a list of packages"):
583
540
commands.do_install_suggest(args[1:], "Both")
585
542
elif command in ["installs", "suggested"]:
586
if requires_args(command, args, "a list of packages"):
543
if util.requires_args(command, args, "a list of packages"):
587
544
commands.do_install_suggest(args[1:], "Suggests")
589
546
elif re.compile(r'install.*').match(command):
590
547
# For example: install/unsable
591
if requires_args(command, args,
548
if util.requires_args(command, args,
592
549
"a list of packages, .deb files, or url"):
593
550
command = "apt-get --target-release %s install %s" % \
594
551
(re.compile(r'install').sub("", command),
673
630
perform.execute("dpkg --listfiles " + args[1])
675
632
elif command == "listsection":
676
if requires_one_arg(command, args, "the name of a Debian Section." +
633
if util.requires_one_arg(command, args, "the name of a Debian Section." +
677
634
"\nUse the LIST-SECTIONS command for a list " +
678
635
"of Debian Sections."):
679
636
commands.do_listsection(args[1])
681
638
elif command == "listsections":
682
if requires_no_args(command, args):
639
if util.requires_no_args(command, args):
683
640
commands.do_listsections()
685
642
elif command == "listhold":
686
if requires_no_args(command, args):
643
if util.requires_no_args(command, args):
687
644
perform.execute("dpkg --get-selections | egrep 'hold$' | cut -f1")
689
646
elif command == "listinstalled":
690
if requires_opt_arg(command, args, "string to filter on"):
647
if util.requires_opt_arg(command, args, "string to filter on"):
691
648
commands.do_listinstalled(args[1:])
693
650
elif command == "listlog":
694
if requires_opt_arg(command, args, "string to filter on"):
651
if util.requires_opt_arg(command, args, "string to filter on"):
695
652
cmd = "cat " + changes.log_file + "| sed 's|T| |'"
696
653
if len(args) == 2:
697
654
cmd = cmd + " | grep '" + args[1] + "'"
764
716
print "WaJIG Error: NEWUPGRADES only accepts " +\
765
717
"optional argument INSTALL"
769
721
elif command == "nonfree":
770
if requires_no_args(command, args):
771
if requires_package("vrms", "/usr/bin/vrms"):
722
if util.requires_no_args(command, args):
723
if util.requires_package("vrms", "/usr/bin/vrms"):
772
724
perform.execute("vrms")
774
726
elif command in ["orphans", "listorphans"]:
775
if requires_no_args(command, args):
776
if requires_package("deborphan", "/usr/bin/deborphan"):
727
if util.requires_no_args(command, args):
728
if util.requires_package("deborphan", "/usr/bin/deborphan"):
777
729
perform.execute("deborphan")
779
731
elif command == "policy":
780
732
perform.execute("apt-cache policy " + perform.concat(args[1:]))
782
734
elif command == "purge":
783
if requires_args(command, args, "a list of packages"):
735
if util.requires_args(command, args, "a list of packages"):
784
736
perform.execute("dpkg --purge " + perform.concat(args[1:]), root=True)
786
738
elif command == "purgedepend":
787
if requires_one_arg(command, args, "a single package"):
788
# Bug#579419 - this is more efficient than do_removedepend
739
if util.requires_one_arg(command, args, "a single package"):
789
740
perform.execute("apt-get remove --purge --auto-remove " + args[1], root=True)
790
# commands.do_removedepend(args[1], purge=True)
792
742
elif command == "purgeorphans":
794
743
# Deborphans does not require root, but dpkg does.
795
744
# So build up the orphans list first, then apss that to dpkg.
797
if requires_no_args(command, args):
798
if requires_package("deborphan", "/usr/bin/deborphan"):
745
if util.requires_no_args(command, args):
746
if util.requires_package("deborphan", "/usr/bin/deborphan"):
800
748
for p in perform.execute("deborphan", pipe=True):
801
749
pkgs += " " + p.strip()
851
799
perform.execute("gkdebconf", root=True)
853
801
elif command == "reinstall":
854
if requires_args(command, args, "a list of packages"):
802
if util.requires_args(command, args, "a list of packages"):
855
803
perform.execute("apt-get --reinstall install " +\
856
804
perform.concat(args[1:]), root=True)
858
806
elif command == "reload":
859
if requires_one_arg(command, args, "name of service to " + command):
807
if util.requires_one_arg(command, args, "name of service to " + command):
860
808
perform.execute("/etc/init.d/" + args[1] + " " + command, root=True)
862
810
# perform.execute("invoke-rc.d " + args[1] + " " + command, root=True)
864
812
elif command == "remove":
865
if requires_args(command, args, "a list of packages"):
813
if util.requires_args(command, args, "a list of packages"):
866
814
perform.execute("apt-get %s remove %s" %
867
815
(yes, perform.concat(args[1:])), root=True)
869
817
elif command == "removedepend":
870
if requires_one_arg(command, args, "a single package"):
818
if util.requires_one_arg(command, args, "a single package"):
871
819
#print changes.get_dependents("libclan2-mikmod")
872
820
# Bug#579419 - this is more efficient than do_removedepend
873
821
perform.execute("apt-get remove --auto-remove " + args[1], root=True)
874
822
#commands.do_removedepend(args[1])
876
824
elif command == "removeorphans":
877
if requires_no_args(command, args):
878
if requires_package("deborphan", "/usr/bin/deborphan"):
825
if util.requires_no_args(command, args):
826
if util.requires_package("deborphan", "/usr/bin/deborphan"):
880
828
for p in perform.execute("deborphan", pipe=True):
881
829
pkgs += " " + p.strip()
883
831
perform.execute("apt-get remove" + pkgs, root=True)
885
833
elif command in ["repackage", "package"]:
886
if requires_one_arg(command, args, "name of an installed package"):
887
if requires_package("dpkg-repack", "/usr/bin/dpkg-repack"):
834
if util.requires_one_arg(command, args, "name of an installed package"):
835
if util.requires_package("dpkg-repack", "/usr/bin/dpkg-repack"):
888
836
perform.execute("dpkg-repack " + args[1], root=True)
890
838
elif command == "reset":
891
if requires_no_args(command, args):
839
if util.requires_no_args(command, args):
892
840
changes.reset_files()
894
842
elif command == "restart":
895
if requires_one_arg(command, args, "name of service to " + command):
843
if util.requires_one_arg(command, args, "name of service to " + command):
896
844
perform.execute("/etc/init.d/" + args[1] + " " + command, root=True)
898
846
# perform.execute("invoke-rc.d " + args[1] + " " + command, root=True)
900
848
elif command == "rpminstall":
901
if requires_one_arg(command, args,
849
if util.requires_one_arg(command, args,
902
850
"a Red Hat package file name (.rpm)"):
903
851
perform.execute("alien --to-deb --install " + args[1], root=True)
905
853
elif command in ["rpmtodeb", "rpm2deb"]:
906
if requires_one_arg(command, args,
854
if util.requires_one_arg(command, args,
907
855
"a Red Hat package file name (.rpm)"):
908
856
perform.execute("alien -d " + args[1], root=True)
910
858
elif command == "search":
911
859
# Note that this uses a regular expression, thus libstdc++6
912
860
# finds nothing but libstdc..6 does.
913
if requires_args(command, args, "a list of words to search for"):
861
if util.requires_args(command, args, "a list of words to search for"):
914
862
perform.execute("apt-cache search " + perform.concat(args[1:]))
916
864
elif command == "searchapt":
917
if requires_one_arg(command, args, "one of stable|testing|unstable"):
918
requires_package("netselect-apt", "/usr/bin/netselect-apt")
865
if util.requires_one_arg(command, args, "one of stable|testing|unstable"):
866
util.requires_package("netselect-apt", "/usr/bin/netselect-apt")
919
867
perform.execute("netselect-apt " + args[1], root=True)
921
869
elif command == "showdistupgrade":
922
if requires_no_args(command, args):
870
if util.requires_no_args(command, args):
923
871
perform.execute("apt-get -u -s dist-upgrade", root=True)
925
873
elif command == "showinstall":
926
if requires_args(command, args, "a list of packages"):
874
if util.requires_args(command, args, "a list of packages"):
927
875
perform.execute("apt-get -u -s install " +
928
876
perform.concat(args[1:]), root=True)
930
878
elif command == "showremove":
931
if requires_args(command, args, "a list of packages"):
879
if util.requires_args(command, args, "a list of packages"):
932
880
perform.execute("apt-get -u -s remove " + perform.concat(args[1:]),
935
883
elif command == "showupgrade":
936
if requires_no_args(command, args):
884
if util.requires_no_args(command, args):
937
885
perform.execute("apt-get -u -s upgrade", root=True)
939
elif command == "size" or command == "sizes":
887
elif command in ["size", "sizes"]:
940
888
commands.do_size(args[1:], 0)
942
890
elif command == "snapshot":
943
if requires_no_args(command, args):
891
if util.requires_no_args(command, args):
944
892
commands.do_status([], True)
946
894
elif command == "source":
947
if requires_args(command, args, "a list of package names"):
895
if util.requires_args(command, args, "a list of package names"):
948
896
# First make sure dependencies are met
949
897
# John V. Belmonte 04 Nov 2005 requested this not be done
950
898
# Leave it to the user to do wajig builddepend
982
930
# + " | xargs wajig status ")
984
932
elif command == "stop":
985
if requires_one_arg(command, args, "name of service to " + command):
933
if util.requires_one_arg(command, args, "name of service to " + command):
986
934
perform.execute("/etc/init.d/" + args[1] + " " + command, root=True)
988
936
# perform.execute("invoke-rc.d " + args[1] + " " + command, root=True)
990
938
elif command == "tasksel":
991
if requires_no_args(command, args):
992
if requires_package("tasksel", "/usr/bin/tasksel"):
939
if util.requires_no_args(command, args):
940
if util.requires_package("tasksel", "/usr/bin/tasksel"):
993
941
perform.execute("tasksel", root=True)
995
943
elif command == "toupgrade":
996
if requires_no_args(command, args):
944
if util.requires_no_args(command, args):
997
945
commands.do_toupgrade()
999
947
# edd 03 Sep 2003 unhold patch based on hold semantics
1000
948
elif command == "unhold":
1001
if requires_args(command, args,
949
if util.requires_args(command, args,
1002
950
"a list of packages to remove from hold"):
1003
951
commands.do_unhold(args[1:])
1004
952
# TODO Perhaps I can use map to "execute" over each package
1006
954
elif command == "update":
1007
if requires_no_args(command, args):
955
if util.requires_no_args(command, args):
1008
956
commands.do_update()
1010
958
# For testing only!
1011
959
elif command == "updateavailable":
1012
if requires_no_args(command, args):
960
if util.requires_no_args(command, args):
1013
961
changes.update_available()
1015
963
elif command in ["updatealts", "updatealternatives", "setalts",
1016
964
"setalternatives"]:
1017
if requires_one_arg(command, args, "name of alternative to update"):
965
if util.requires_one_arg(command, args, "name of alternative to update"):
1018
966
perform.execute("update-alternatives --config " + args[1], root=True)
1020
968
elif command == "updatepciids":
1021
if requires_package("pciutils", "/usr/bin/update-pciids"):
1022
if requires_no_args(command, args):
969
if util.requires_package("pciutils", "/usr/bin/update-pciids"):
970
if util.requires_no_args(command, args):
1023
971
perform.execute("update-pciids", root=True)
1025
973
elif command == "updateusbids":
1026
if requires_package("usbutils", "/usr/sbin/update-usbids"):
1027
if requires_no_args(command, args):
974
if util.requires_package("usbutils", "/usr/sbin/update-usbids"):
975
if util.requires_no_args(command, args):
1028
976
perform.execute("update-usbids", root=True)
1030
978
elif command == "upgrade":
1031
if backup and requires_package("dpkg-repack", "/usr/bin/dpkg-repack")\
1032
and requires_package("fakeroot", "/usr/bin/fakeroot"):
1037
changes.backup_before_upgrade(bkdir)
1039
perform.execute("apt-get install " + perform.concat(args[1:]),
981
and util.requires_package("dpkg-repack", "/usr/bin/dpkg-repack") \
982
and util.requires_package("fakeroot", "/usr/bin/fakeroot") \
983
and util.requires_no_args(command, args):
984
upgradable = changes.backup_before_upgrade(backup)
985
if upgradable != "quit":
1042
986
perform.execute("apt-get %s -u upgrade" % noauth, root=True)
1044
988
elif command == "upgradesecurity":
1058
1002
os.remove(sources_list)
1060
1004
elif command == "verify":
1061
if requires_one_arg(command, args, "a package name"):
1005
if util.requires_one_arg(command, args, "a package name"):
1062
1006
perform.execute("debsums " + args[1])
1064
elif command == "version" or command == "versions":
1008
elif command in ["version", "versions"]:
1065
1009
if command == "version" and len(args) == 1:
1066
1010
documentation.version()
1068
if requires_package("apt-show-versions",
1069
"/usr/bin/apt-show-versions"):
1070
commands.versions(args[1:])
1011
elif util.requires_package("apt-show-versions",
1012
"/usr/bin/apt-show-versions"):
1013
commands.versions(args[1:])
1071
1015
elif command == "whatis":
1072
if requires_args(command, args, "a list of package names"):
1016
if util.requires_args(command, args, "a list of package names"):
1073
1017
commands.do_describe(args[1:])
1075
1019
elif command in ["whichpkg", "whichpackage"]:
1076
if requires_one_arg(command, args,
1077
"a file name (possibly with a path)"):
1020
if util.requires_one_arg(command, args, "a filename (possibly with a path)") \
1021
and util.requires_package("wget", "/usr/bin/wget") \
1022
and util.requires_package("lynx", "/usr/bin/lynx"):
1078
1023
commands.do_whichpkg(args[1])