raptget 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/raptget.rb ADDED
@@ -0,0 +1,877 @@
1
+ # = raptget - A apt-get gem for Ruby
2
+ #
3
+ # Homepage:: http://github.com/jjuliano/raptget
4
+ # Author:: Joel Bryan Juliano
5
+ # Copyright:: (cc) 2011 Joel Bryan Juliano
6
+ # License:: MIT
7
+ #
8
+ # class Raptget::Package.new( array, str, array)
9
+
10
+ require 'tempfile'
11
+
12
+ class Raptget
13
+ #
14
+ # All accessors are boolean unless otherwise noted.
15
+ #
16
+
17
+ #
18
+ # Download only; package files are only retrieved,
19
+ # not unpacked or installed.
20
+ # Configuration Item: APT::Get::Download-Only.
21
+ #
22
+ attr_accessor :download_only
23
+
24
+ #
25
+ # Fix; attempt to correct a system with broken dependencies
26
+ # in place. This option, when used with install/remove,
27
+ # can omit any packages to permit APT to deduce a likely solution.
28
+ # Any Package that are specified must completely correct the problem.
29
+ # The option is sometimes necessary when running APT for the first time;
30
+ # APT itself does not allow broken package dependencies to exist on a system.
31
+ # It is possible that a system's dependency structure can be so corrupt as to
32
+ # require manual intervention (which usually means using dselect(8) or
33
+ # dpkg --remove to eliminate some of the offending packages).
34
+ # Use of this option together with 'fix_missing' may produce
35
+ # an error in some situations. Configuration Item: APT::Get::Fix-Broken.
36
+ #
37
+ attr_accessor :fix_broken
38
+
39
+ #
40
+ # Ignore missing packages; If packages cannot be retrieved or fail the integrity check
41
+ # after retrieval (corrupted package files), hold back those packages and handle
42
+ # the result. Use of this option together with -f may produce an error in some
43
+ # situations. If a package is selected for installation
44
+ # (particularly if it is mentioned on the command line) and it could not be
45
+ # downloaded then it will be silently held back.
46
+ # Configuration Item: APT::Get::Fix-Missing.
47
+ #
48
+ attr_accessor :fix_missing
49
+ attr_accessor :ignore_missing
50
+
51
+ #
52
+ # Disables downloading of packages.
53
+ # This is best used with ignore_missing to force APT
54
+ # to use only the .debs it has already downloaded.
55
+ # Configuration Item: APT::Get::Download.
56
+ #
57
+ attr_accessor :no_download
58
+
59
+ #
60
+ # Quiet; produces output suitable for logging, omitting progress
61
+ # indicators. More q's will produce more quiet up to a maximum of 2.
62
+ # You can also use -q=# to set the quiet level, overriding the configuration
63
+ # file. Note that quiet level 2 implies -y, you should never use -qq without
64
+ # a no-action modifier such as -d, --print-uris or -s as APT may decided to
65
+ # do something you did not expect. Configuration Item: quiet.
66
+ #
67
+ attr_accessor :quiet
68
+
69
+ #
70
+ # No action; perform a simulation of events that would occur
71
+ # but do not actually change the system.
72
+ # Configuration Item: APT::Get::Simulate.
73
+ # Simulate prints out a series of lines each one representing a
74
+ # dpkg operation, Configure (Conf), Remove (Remv), Unpack (Inst).
75
+ # Square brackets indicate broken packages with and empty set of square
76
+ # brackets meaning breaks that are of no consequence (rare).
77
+ #
78
+ attr_accessor :simulate
79
+ attr_accessor :just_print
80
+ attr_accessor :dry_run
81
+ attr_accessor :recon
82
+ attr_accessor :no_act
83
+
84
+ #
85
+ # Automatic yes to prompts; assume "yes" as answer to all
86
+ # prompts and run non-interactively. If an undesirable situation,
87
+ # such as changing a held package or removing an essential package
88
+ # occurs then apt-get will abort.
89
+ # Configuration Item: APT::Get::Assume-Yes.
90
+ #
91
+ attr_accessor :assume_yes
92
+ attr_accessor :yes
93
+
94
+ #
95
+ # Show upgraded packages; Print out a list of all packages
96
+ # that are to be upgraded.
97
+ # Configuration Item: APT::Get::Show-Upgraded.
98
+ #
99
+ attr_accessor :show_upgraded
100
+
101
+ #
102
+ # Show full versions for upgraded and installed packages.
103
+ # Configuration Item: APT::Get::Show-Versions.
104
+ #
105
+ attr_accessor :verbose_version
106
+
107
+ #
108
+ # Compile source packages after downloading them.
109
+ # Configuration Item: APT::Get::Compile.
110
+ #
111
+ attr_accessor :build
112
+ attr_accessor :compile
113
+
114
+ #
115
+ # Also install recommended packages.
116
+ #
117
+ attr_accessor :install_recommends
118
+
119
+ #
120
+ # Do not install recommended packages.
121
+ #
122
+ attr_accessor :no_install_recommends
123
+
124
+ #
125
+ # Ignore package Holds; This causes apt-get to ignore a
126
+ # hold placed on a package.
127
+ # This may be useful in conjunction with dist-upgrade
128
+ # to override a large number of undesired holds.
129
+ # Configuration Item: APT::Ignore-Hold.
130
+ #
131
+ attr_accessor :ignore_hold
132
+
133
+ #
134
+ # Do not upgrade packages; When used in conjunction with
135
+ # install no-upgrade will prevent packages listed from being
136
+ # upgraded if they are already installed.
137
+ # Configuration Item: APT::Get::Upgrade.
138
+ #
139
+ attr_accessor :no_upgrade
140
+
141
+ #
142
+ # Force yes; This is a dangerous option that will cause
143
+ # apt to continue without prompting if it is doing something
144
+ # potentially harmful. It should not be used except in very special
145
+ # situations. Using force-yes can potentially destroy your system!
146
+ # Configuration Item: APT::Get::force-yes.
147
+ #
148
+ attr_accessor :force_yes
149
+
150
+ #
151
+ # Instead of fetching the files to install their URIs are printed.
152
+ # Each URI will have the path, the destination file name, the size
153
+ # and the expected md5 hash. Note that the file name to write to will
154
+ # not always match the file name on the remote site!
155
+ # This also works with the source and update commands.
156
+ # When used with the update command the MD5 and size are not included,
157
+ # and it is up to the user to decompress any compressed files.
158
+ # Configuration Item: APT::Get::Print-URIs.
159
+ #
160
+ attr_accessor :print_uris
161
+
162
+ #
163
+ # Use purge instead of remove for anything that would be removed.
164
+ # An asterisk ("*") will be displayed next to packages which are
165
+ # scheduled to be purged.
166
+ # Configuration Item: APT::Get::Purge.
167
+ #
168
+ attr_accessor :purge
169
+
170
+ #
171
+ # Re-Install packages that are already installed and at the
172
+ # newest version.
173
+ # Configuration Item: APT::Get::ReInstall.
174
+ #
175
+ attr_accessor :reinstall
176
+
177
+ #
178
+ # This option defaults to on, use --no-list-cleanup to turn it off.
179
+ # When on apt-get will automatically manage the contents of /var/lib/apt/lists
180
+ # to ensure that obsolete files are erased.
181
+ # The only reason to turn it off is if you frequently change your source list.
182
+ # Configuration Item: APT::Get::List-Cleanup.
183
+ #
184
+ attr_accessor :list_cleanup
185
+
186
+ #
187
+ # This option controls the default input to the policy engine,
188
+ # it creates a default pin at priority 990 using the specified release string.
189
+ # The preferences file may further override this setting.
190
+ # In short, this option lets you have simple control over which distribution
191
+ # packages will be retrieved from. Some common examples might be -t '2.1*' or
192
+ # -t unstable.
193
+ # Configuration Item: APT::Default-Release;
194
+ #
195
+ attr_accessor :default_release
196
+ attr_accessor :target_release
197
+
198
+ #
199
+ # Only perform operations that are 'trivial'. Logically this can
200
+ # be considered related to --assume-yes, where --assume-yes will
201
+ # answer yes to any prompt, --trivial-only will answer no.
202
+ # Configuration Item: APT::Get::Trivial-Only.
203
+ #
204
+ attr_accessor :trivial_only
205
+
206
+ #
207
+ # If any packages are to be removed apt-get immediately aborts
208
+ # without prompting.
209
+ # Configuration Item: APT::Get::Remove
210
+ #
211
+ attr_accessor :no_remove
212
+
213
+ #
214
+ # If the command is either install or remove, then this option acts
215
+ # like running autoremove command, removing the unused dependency
216
+ # packages.
217
+ # Configuration Item: APT::Get::AutomaticRemove.
218
+ #
219
+ attr_accessor :auto_remove
220
+
221
+ #
222
+ # Only has meaning for the source command.
223
+ # Indicates that the given source names are not to be mapped
224
+ # through the binary table. This means that if this option is specified,
225
+ # the source command will only accept source package names as arguments,
226
+ # rather than accepting binary package names and looking up the
227
+ # corresponding source package.
228
+ # Configuration Item: APT::Get::Only-Source
229
+ #
230
+ attr_accessor :only_source
231
+
232
+ #
233
+ # Download only the diff or tar file of a source archive.
234
+ # Configuration Item: APT::Get::Diff-Only and APT::Get::Tar-Only
235
+ #
236
+ attr_accessor :tar_only
237
+ attr_accessor :dsc_only
238
+ attr_accessor :diff_only
239
+
240
+ #
241
+ # Ignore if packages can't be authenticated and don't prompt about
242
+ # it. This is useful for tools like pbuilder.
243
+ # Configuration Item: APT::Get::AllowUnauthenticated.
244
+ #
245
+ attr_accessor :allow_unauthenticated
246
+
247
+ #
248
+ # Only process architecture-dependent build-dependencies.
249
+ # Configuration Item: APT::Get::Arch-Only
250
+ #
251
+ attr_accessor :arch_only
252
+
253
+ #
254
+ # Configuration File; Specify a configuration file to use.
255
+ # The program will read the default configuration file and
256
+ # then this configuration file.
257
+ #
258
+ attr_accessor :config_file
259
+
260
+ #
261
+ # Set a Configuration Option; This will set an arbitrary
262
+ # configuration option.
263
+ # The syntax is raptget.option = "Foo::Bar=bar"
264
+ #
265
+ attr_accessor :option
266
+
267
+ #
268
+ # Disable sudo. If this is not set, sudo
269
+ # is used.
270
+ attr_accessor :disable_sudo
271
+
272
+ # Returns a new Raptget Object
273
+
274
+ def initialize()
275
+ end
276
+ #
277
+ # install is followed by one or more packages desired for
278
+ # installation or upgrading. Each package is a package name, not a
279
+ # fully qualified filename (for instance, in a Debian GNU/Linux
280
+ # system, libc6 would be the argument provided, not
281
+ # libc6_1.9.6-2.deb). All packages required by the package(s)
282
+ # specified for installation will also be retrieved and installed.
283
+ # The /etc/apt/sources.list file is used to locate the desired
284
+ # packages. If a hyphen is appended to the package name (with no
285
+ # intervening space), the identified package will be removed if it is
286
+ # installed. Similarly a plus sign can be used to designate a package
287
+ # to install. These latter features may be used to override decisions
288
+ # made by apt-get's conflict resolution system.
289
+ #
290
+ # A specific version of a package can be selected for installation by
291
+ # following the package name with an equals and the version of the
292
+ # package to select. This will cause that version to be located and
293
+ # selected for install. Alternatively a specific distribution can be
294
+ # selected by following the package name with a slash and the version
295
+ # of the distribution or the Archive name (stable, testing,
296
+ # unstable).
297
+ #
298
+ # Both of the version selection mechanisms can downgrade packages and
299
+ # must be used with care.
300
+ #
301
+ # This is also the target to use if you want to upgrade one or more
302
+ # already-installed packages without upgrading every package you have
303
+ # on your system. Unlike the "upgrade" target, which installs the
304
+ # newest version of all currently installed packages, "install" will
305
+ # install the newest version of only the package(s) specified. Simply
306
+ # provide the name of the package(s) you wish to upgrade, and if a
307
+ # newer version is available, it (and its dependencies, as described
308
+ # above) will be downloaded and installed.
309
+ #
310
+ # Finally, the apt_preferences(5) mechanism allows you to create an
311
+ # alternative installation policy for individual packages.
312
+ #
313
+ # If no package matches the given expression and the expression
314
+ # contains one of '.', '?' or '*' then it is assumed to be a POSIX
315
+ # regular expression, and it is applied to all package names in the
316
+ # database. Any matches are then installed (or removed). Note that
317
+ # matching is done by substring so 'lo.*' matches 'how-lo' and
318
+ # 'lowest'. If this is undesired, anchor the regular expression with
319
+ # a '^' or '$' character, or create a more specific regular
320
+ # expression.
321
+
322
+ # Returns the package names
323
+
324
+ def install(packages)
325
+
326
+ tmp = Tempfile.new('raptget_install')
327
+ packages.collect! { |i| i + " " }
328
+ command = option_string() + "install " + packages.to_s + " 2> " + tmp.path
329
+ success = system(command)
330
+ if success
331
+ begin
332
+ while (line = tmp.readline)
333
+ line.chomp
334
+ selected_string = line if line =~ /Setting up/
335
+ end
336
+ rescue EOFError
337
+ tmp.close
338
+ end
339
+ return selected_string
340
+ else
341
+ tmp.close!
342
+ return success
343
+ end
344
+
345
+ end
346
+
347
+ # update is used to resynchronize the package index files from their
348
+ # sources. The indexes of available packages are fetched from the
349
+ # location(s) specified in /etc/apt/sources.list. For example, when
350
+ # using a Debian archive, this command retrieves and scans the
351
+ # Packages.gz files, so that information about new and updated
352
+ # packages is available. An update should always be performed before
353
+ # an upgrade or dist-upgrade. Please be aware that the overall
354
+ # progress meter will be incorrect as the size of the package files
355
+ # cannot be known in advance.
356
+
357
+ def update
358
+
359
+ tmp = Tempfile.new('raptget_update')
360
+ command = option_string() + "update " + " 2> " + tmp.path
361
+ success = system(command)
362
+ if success
363
+ begin
364
+ while (line = tmp.readline)
365
+ line.chomp
366
+ selected_string = line if line =~ /Hit/
367
+ end
368
+ rescue EOFError
369
+ tmp.close
370
+ end
371
+ return selected_string
372
+ else
373
+ tmp.close!
374
+ return success
375
+ end
376
+
377
+ end
378
+
379
+ # upgrade is used to install the newest versions of all packages
380
+ # currently installed on the system from the sources enumerated in
381
+ # /etc/apt/sources.list. Packages currently installed with new
382
+ # versions available are retrieved and upgraded; under no
383
+ # circumstances are currently installed packages removed, or packages
384
+ # not already installed retrieved and installed. New versions of
385
+ # currently installed packages that cannot be upgraded without
386
+ # changing the install status of another package will be left at
387
+ # their current version. An update must be performed first so that
388
+ # apt-get knows that new versions of packages are available.
389
+
390
+ def upgrade
391
+
392
+ tmp = Tempfile.new('raptget_upgrade')
393
+ command = option_string() + "upgrade " + " 2> " + tmp.path
394
+ success = system(command)
395
+ if success
396
+ begin
397
+ while (line = tmp.readline)
398
+ line.chomp
399
+ selected_string = line if line =~ /^Setting up/
400
+ end
401
+ rescue EOFError
402
+ tmp.close
403
+ end
404
+ return selected_string
405
+ else
406
+ tmp.close!
407
+ return success
408
+ end
409
+
410
+ end
411
+
412
+ # dselect_upgrade is used in conjunction with the traditional Debian
413
+ # packaging front-end, dselect(1). dselect-upgrade follows the
414
+ # changes made by dselect(1) to the Status field of available
415
+ # packages, and performs the actions necessary to realize that state
416
+ # (for instance, the removal of old and the installation of new
417
+ # packages).
418
+
419
+ def dselect_upgrade
420
+
421
+ tmp = Tempfile.new('raptget_dselect_upgrade')
422
+ command = option_string() + "dselect-upgrade " + " 2> " + tmp.path
423
+ success = system(command)
424
+ if success
425
+ begin
426
+ while (line = tmp.readline)
427
+ line.chomp
428
+ selected_string = line if line =~ /^Setting up/
429
+ end
430
+ rescue EOFError
431
+ tmp.close
432
+ end
433
+ return selected_string
434
+ else
435
+ tmp.close!
436
+ return success
437
+ end
438
+
439
+ end
440
+
441
+ # dist_upgrade in addition to performing the function of upgrade,
442
+ # also intelligently handles changing dependencies with new versions
443
+ # of packages; apt-get has a "smart" conflict resolution system, and
444
+ # it will attempt to upgrade the most important packages at the
445
+ # expense of less important ones if necessary. So, dist-upgrade
446
+ # command may remove some packages. The /etc/apt/sources.list file
447
+ # contains a list of locations from which to retrieve desired package
448
+ # files. See also apt_preferences(5) for a mechanism for overriding
449
+ # the general settings for individual packages.
450
+
451
+ def dist_upgrade
452
+
453
+ tmp = Tempfile.new('raptget_dist_upgrade')
454
+ command = option_string() + "dist-upgrade " + " 2> " + tmp.path
455
+ success = system(command)
456
+ if success
457
+ begin
458
+ while (line = tmp.readline)
459
+ line.chomp
460
+ selected_string = line if line =~ /^Setting up/
461
+ end
462
+ rescue EOFError
463
+ tmp.close
464
+ end
465
+ return selected_string
466
+ else
467
+ tmp.close!
468
+ return success
469
+ end
470
+
471
+ end
472
+
473
+ # remove is identical to install except that packages are removed
474
+ # instead of installed. Note the removing a package leaves its
475
+ # configuration files in system. If a plus sign is appended to the
476
+ # package name (with no intervening space), the identified package
477
+ # will be installed instead of removed.
478
+
479
+ def remove(packages)
480
+
481
+ tmp = Tempfile.new('raptget_remove')
482
+ packages.collect! { |i| i + " " }
483
+ command = option_string() + "remove " + packages.to_s + " 2> " + tmp.path
484
+ success = system(command)
485
+ if success
486
+ begin
487
+ while (line = tmp.readline)
488
+ line.chomp
489
+ selected_string = line if line =~ /Removing/
490
+ end
491
+ rescue EOFError
492
+ tmp.close
493
+ end
494
+ return selected_string
495
+ else
496
+ tmp.close!
497
+ return success
498
+ end
499
+
500
+ end
501
+
502
+ # purge is identical to remove except that packages are removed and
503
+ # purged (any configuration files are deleted too).
504
+
505
+ def purge(packages)
506
+
507
+ tmp = Tempfile.new('raptget_purge')
508
+ packages.collect! { |i| i + " " }
509
+ command = option_string() + "purge " + packages.to_s + " 2> " + tmp.path
510
+ success = system(command)
511
+ if success
512
+ begin
513
+ while (line = tmp.readline)
514
+ line.chomp
515
+ selected_string = line if line =~ /Removing/
516
+ end
517
+ rescue EOFError
518
+ tmp.close
519
+ end
520
+ return selected_string
521
+ else
522
+ tmp.close!
523
+ return success
524
+ end
525
+
526
+ end
527
+
528
+ # source causes apt-get to fetch source packages. APT will examine
529
+ # the available packages to decide which source package to fetch. It
530
+ # will then find and download into the current directory the newest
531
+ # available version of that source package while respect the default
532
+ # release, set with the option APT::Default-Release, the -t option or
533
+ # per package with the pkg/release syntax, if possible.#
534
+ #
535
+ # Source packages are tracked separately from binary packages via
536
+ # deb-src type lines in the sources.list(5) file. This means that you
537
+ # will need to add such a line for each repository you want to get
538
+ # sources from. If you don't do this you will properly get another
539
+ # (newer, older or none) source version than the one you have
540
+ # installed or could install.
541
+ #
542
+ # If the --compile option is specified then the package will be
543
+ # compiled to a binary .deb using dpkg-buildpackage, if
544
+ # --download-only is specified then the source package will not be
545
+ # unpacked.
546
+ #
547
+ # A specific source version can be retrieved by postfixing the source
548
+ # name with an equals and then the version to fetch, similar to the
549
+ # mechanism used for the package files. This enables exact matching
550
+ # of the source package name and version, implicitly enabling the
551
+ # APT::Get::Only-Source option.
552
+ #
553
+ # Note that source packages are not tracked like binary packages,
554
+ # they exist only in the current directory and are similar to
555
+ # downloading source tar balls.
556
+
557
+ def source(packages)
558
+
559
+ tmp = Tempfile.new('raptget_source')
560
+ packages.collect! { |i| i + " " }
561
+ command = option_string() + "source " + packages.to_s + " 2> " + tmp.path
562
+ success = system(command)
563
+ if success
564
+ begin
565
+ while (line = tmp.readline)
566
+ line.chomp
567
+ selected_string = line
568
+ end
569
+ rescue EOFError
570
+ tmp.close
571
+ end
572
+ return selected_string
573
+ else
574
+ tmp.close!
575
+ return success
576
+ end
577
+
578
+ end
579
+
580
+ # build-dep causes apt-get to install/remove packages in an attempt
581
+ # to satisfy the build dependencies for a source package.
582
+
583
+ def build_dep(packages)
584
+
585
+ tmp = Tempfile.new('raptget_build_dep')
586
+ packages.collect! { |i| i + " " }
587
+ command = option_string() + "build-dep " + packages.to_s + " 2> " + tmp.path
588
+ success = system(command)
589
+ if success
590
+ begin
591
+ while (line = tmp.readline)
592
+ line.chomp
593
+ selected_string = line
594
+ end
595
+ rescue EOFError
596
+ tmp.close
597
+ end
598
+ return selected_string
599
+ else
600
+ tmp.close!
601
+ return success
602
+ end
603
+
604
+ end
605
+
606
+ # clean clears out the local repository of retrieved package files.
607
+ # It removes everything but the lock file from
608
+ # /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When
609
+ # APT is used as a dselect(1) method, clean is run automatically.
610
+ # Those who do not use dselect will likely want to run apt-get clean
611
+ # from time to time to free up disk space.
612
+
613
+ def clean
614
+
615
+ command = option_string() + "clean "
616
+ success = system(command)
617
+ return success
618
+
619
+ end
620
+
621
+ # check is a diagnostic tool; it updates the package cache and checks
622
+ # for broken dependencies.
623
+
624
+ def check
625
+
626
+ tmp = Tempfile.new('raptget_check')
627
+ command = option_string() + "check " + " 2> " + tmp.path
628
+ success = system(command)
629
+ if success
630
+ begin
631
+ while (line = tmp.readline)
632
+ line.chomp
633
+ selected_string = line
634
+ end
635
+ rescue EOFError
636
+ tmp.close
637
+ end
638
+ return selected_string
639
+ else
640
+ tmp.close!
641
+ return success
642
+ end
643
+
644
+ end
645
+
646
+ # Like clean, autoclean clears out the local repository of retrieved
647
+ # package files. The difference is that it only removes package files
648
+ # that can no longer be downloaded, and are largely useless. This
649
+ # allows a cache to be maintained over a long period without it
650
+ # growing out of control. The configuration option
651
+ # APT::Clean-Installed will prevent installed packages from being
652
+ # erased if it is set to off.
653
+
654
+ def autoclean
655
+
656
+ tmp = Tempfile.new('raptget_autoclean')
657
+ command = option_string() + "autoclean " + " 2> " + tmp.path
658
+ success = system(command)
659
+ if success
660
+ begin
661
+ while (line = tmp.readline)
662
+ line.chomp
663
+ selected_string = line
664
+ end
665
+ rescue EOFError
666
+ tmp.close
667
+ end
668
+ return selected_string
669
+ else
670
+ tmp.close!
671
+ return success
672
+ end
673
+
674
+ end
675
+
676
+ # autoremove is used to remove packages that were automatically
677
+ # installed to satisfy dependencies for some package and that are no
678
+ # more needed.
679
+
680
+ def autoremove
681
+
682
+ tmp = Tempfile.new('raptget_autoremove')
683
+ command = option_string() + "autoremove " + " 2> " + tmp.path
684
+ success = system(command)
685
+ if success
686
+ begin
687
+ while (line = tmp.readline)
688
+ line.chomp
689
+ selected_string = line if line =~ /Removing/
690
+ end
691
+ rescue EOFError
692
+ tmp.close
693
+ end
694
+ return selected_string
695
+ else
696
+ tmp.close!
697
+ return success
698
+ end
699
+
700
+ end
701
+
702
+ private
703
+
704
+ def option_string()
705
+ unless @disable_sudo
706
+ ostring = "sudo apt-get "
707
+ else
708
+ ostring = "apt-get "
709
+ end
710
+
711
+ if @option
712
+ ostring += "--option " + @option
713
+ end
714
+
715
+ if @config_file
716
+ ostring += "--config-file " + @config_file
717
+ end
718
+
719
+ if @arch_only
720
+ ostring += "--arch-only "
721
+ end
722
+
723
+ if @allow_unauthenticated
724
+ ostring += "--allow-unauthenticated "
725
+ end
726
+
727
+ if @diff_only
728
+ ostring += "--diff-only "
729
+ end
730
+
731
+ if @dsc_only
732
+ ostring += "--dsc-only "
733
+ end
734
+
735
+ if @tar_only
736
+ ostring += "--tar-only "
737
+ end
738
+
739
+ if @only_source
740
+ ostring += "--only-source "
741
+ end
742
+
743
+ if @auto_remove
744
+ ostring += "--auto-remove "
745
+ end
746
+
747
+ if @no_remove
748
+ ostring += "--no-remove "
749
+ end
750
+
751
+ if @trivial_only
752
+ ostring += "--trivial-only "
753
+ end
754
+
755
+ if @target_release
756
+ ostring += "--target-release " + @target_release
757
+ end
758
+
759
+ if @default_release
760
+ ostring += "--default-release " + @default_release
761
+ end
762
+
763
+ if @list_cleanup
764
+ ostring += "--list-cleanup "
765
+ end
766
+
767
+ if @reinstall
768
+ ostring += "--reinstall "
769
+ end
770
+
771
+ if @purge
772
+ ostring += "--purge "
773
+ end
774
+
775
+ if @print_uris
776
+ ostring += "--print-uris "
777
+ end
778
+
779
+ if @force_yes
780
+ ostring += "--force-yes "
781
+ end
782
+
783
+ if @only_upgrade
784
+ ostring += "--only-upgrade "
785
+ end
786
+
787
+ if @no_upgrade
788
+ ostring += "--no-upgrade "
789
+ end
790
+
791
+ if @ignore_hold
792
+ ostring += "--ignore-hold "
793
+ end
794
+
795
+ if @no_install_recommends
796
+ ostring += "--no-install-recommends "
797
+ end
798
+
799
+ if @install_recommends
800
+ ostring += "--install-recommends "
801
+ end
802
+
803
+ if @compile
804
+ ostring += "--compile "
805
+ end
806
+
807
+ if @build
808
+ ostring += "--build "
809
+ end
810
+
811
+ if @verbose_versions
812
+ ostring += "--verbose-versions "
813
+ end
814
+
815
+ if @show_upgraded
816
+ ostring += "--show-upgraded "
817
+ end
818
+
819
+ if @yes
820
+ ostring += "--yes "
821
+ end
822
+
823
+ if @assume_yes
824
+ ostring += "--assume-yes "
825
+ end
826
+
827
+ if @simulate
828
+ ostring += "--simulate "
829
+ end
830
+
831
+ if @just_print
832
+ ostring += "--just-print "
833
+ end
834
+
835
+ if @dry_run
836
+ ostring += "--dry-run "
837
+ end
838
+
839
+ if @recon
840
+ ostring += "--recon "
841
+ end
842
+
843
+ if @no_act
844
+ ostring += "--no-act "
845
+ end
846
+
847
+ if @quiet
848
+ ostring += "--quiet " + @quiet
849
+ end
850
+
851
+ if @no_download
852
+ ostring += "--no-download "
853
+ end
854
+
855
+ if @ignore_missing
856
+ ostring += "--ignore-missing "
857
+ end
858
+
859
+ if @fix_missing
860
+ ostring += "--fix-missing "
861
+ end
862
+
863
+ if @fix_broken
864
+ ostring += "--fix-broken "
865
+ end
866
+
867
+ if @download_only
868
+ ostring += "--download-only "
869
+ end
870
+
871
+ return ostring
872
+
873
+ end
874
+ end
875
+
876
+
877
+ #Dir[File.join(File.dirname(__FILE__), 'raptget/**/*.rb')].sort.each { |lib| require lib }