~ubuntu-branches/ubuntu/oneiric/dpkg/oneiric

« back to all changes in this revision

Viewing changes to src/enquiry.c

  • Committer: Steve Langasek
  • Date: 2011-06-15 22:25:32 UTC
  • mfrom: (1.4.19 sid)
  • Revision ID: steve.langasek@linaro.org-20110615222532-r71dhdy4bbkoyl05
Merge 1.16.0.1 from Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
  printf(" %-20s %.*s\n", pkg_describe(pkg, pdo_foreign), l, pdesc);
132
132
}
133
133
 
134
 
void audit(const char *const *argv) {
 
134
int
 
135
audit(const char *const *argv)
 
136
{
135
137
  const struct badstatinfo *bsi;
136
138
  bool head_running = false;
137
139
  enum modstatdb_rw msdb_status;
168
170
  }
169
171
 
170
172
  m_output(stdout, _("<standard output>"));
 
173
 
 
174
  return 0;
171
175
}
172
176
 
173
177
struct sectionentry {
198
202
  return false;
199
203
}
200
204
 
201
 
void unpackchk(const char *const *argv) {
 
205
int
 
206
unpackchk(const char *const *argv)
 
207
{
202
208
  int totalcount, sects;
203
209
  struct sectionentry *sectionentries, *se, **sep;
204
210
  struct pkgiterator *it;
236
242
  }
237
243
  pkg_db_iter_free(it);
238
244
 
239
 
  if (totalcount == 0) exit(0);
 
245
  if (totalcount == 0)
 
246
    return 0;
240
247
 
241
248
  if (totalcount <= 12) {
242
249
    it = pkg_db_iter_new();
280
287
  }
281
288
 
282
289
  m_output(stdout, _("<standard output>"));
 
290
 
 
291
  return 0;
283
292
}
284
293
 
285
 
static void
 
294
static int
286
295
assert_version_support(const char *const *argv,
287
296
                       struct versionrevision *version,
288
297
                       const char *feature_name)
300
309
  switch (pkg->status) {
301
310
  case stat_installed:
302
311
  case stat_triggerspending:
303
 
    break;
 
312
    return 0;
304
313
  case stat_unpacked: case stat_halfconfigured: case stat_halfinstalled:
305
314
  case stat_triggersawaited:
306
315
    if (versionsatisfied3(&pkg->configversion, version, dvr_laterequal))
307
 
      break;
 
316
      return 0;
308
317
    printf(_("Version of dpkg with working %s support not yet configured.\n"
309
318
             " Please use 'dpkg --configure dpkg', and then try again.\n"),
310
319
           feature_name);
311
 
    exit(1);
 
320
    return 1;
312
321
  default:
313
322
    printf(_("dpkg not recorded as installed, cannot check for %s support!\n"),
314
323
           feature_name);
315
 
    exit(1);
 
324
    return 1;
316
325
  }
317
326
}
318
327
 
319
 
void assertpredep(const char *const *argv) {
 
328
int
 
329
assertpredep(const char *const *argv)
 
330
{
320
331
  struct versionrevision version = { 0, "1.1.0", NULL };
321
 
  assert_version_support(argv, &version, _("Pre-Depends field"));
 
332
 
 
333
  return assert_version_support(argv, &version, _("Pre-Depends field"));
322
334
}
323
335
 
324
 
void assertepoch(const char *const *argv) {
 
336
int
 
337
assertepoch(const char *const *argv)
 
338
{
325
339
  struct versionrevision version = { 0, "1.4.0.7", NULL };
326
 
  assert_version_support(argv, &version, _("epoch"));
 
340
 
 
341
  return assert_version_support(argv, &version, _("epoch"));
327
342
}
328
343
 
329
 
void assertlongfilenames(const char *const *argv) {
 
344
int
 
345
assertlongfilenames(const char *const *argv)
 
346
{
330
347
  struct versionrevision version = { 0, "1.4.1.17", NULL };
331
 
  assert_version_support(argv, &version, _("long filenames"));
 
348
 
 
349
  return assert_version_support(argv, &version, _("long filenames"));
332
350
}
333
351
 
334
 
void assertmulticonrep(const char *const *argv) {
 
352
int
 
353
assertmulticonrep(const char *const *argv)
 
354
{
335
355
  struct versionrevision version = { 0, "1.4.1.19", NULL };
336
 
  assert_version_support(argv, &version, _("multiple Conflicts and Replaces"));
 
356
 
 
357
  return assert_version_support(argv, &version,
 
358
                                _("multiple Conflicts and Replaces"));
337
359
}
338
360
 
339
 
void
 
361
int
340
362
assertmultiarch(const char *const *argv)
341
363
{
342
364
  /* FIXME: update with dpkg version introducing actual multiarch support. */
343
365
  struct versionrevision version = { 0, "1.16.0~ubuntu4", NULL };
344
366
 
345
 
  assert_version_support(argv, &version, _("multi-arch"));
 
367
  return assert_version_support(argv, &version, _("multi-arch"));
346
368
}
347
369
 
348
370
/**
358
380
 *  1 = no suitable package available
359
381
 *  2 = error
360
382
 */
361
 
void predeppackage(const char *const *argv) {
 
383
int
 
384
predeppackage(const char *const *argv)
 
385
{
362
386
  static struct varbuf vb;
363
387
 
364
388
  struct pkgiterator *it;
398
422
  pkg_db_iter_free(it);
399
423
 
400
424
  if (!dep)
401
 
    exit(1); /* Not found. */
 
425
    return 1; /* Not found. */
402
426
  assert(pkg);
403
427
  startpkg= pkg;
404
428
  pkg->clientdata->istobe= itb_preinstall;
458
482
  writerecord(stdout, _("<standard output>"), pkg, &pkg->available);
459
483
 
460
484
  m_output(stdout, _("<standard output>"));
 
485
 
 
486
  return 0;
461
487
}
462
488
 
463
 
void printarch(const char *const *argv) {
 
489
int
 
490
printarch(const char *const *argv)
 
491
{
464
492
  if (*argv)
465
493
    badusage(_("--%s takes no arguments"), cipaction->olong);
466
494
 
467
495
  printf("%s\n", dpkg_arch_get_native()->name);
468
496
 
469
497
  m_output(stdout, _("<standard output>"));
 
498
 
 
499
  return 0;
470
500
}
471
501
 
472
 
void
 
502
int
473
503
printinstarch(const char *const *argv)
474
504
{
475
505
  warning(_("obsolete option '--%s', please use '--%s' instead."),
476
506
          "print-installation-architecture", "print-architecture");
477
 
  printarch(argv);
 
507
  return printarch(argv);
478
508
}
479
509
 
480
 
void
 
510
int
481
511
print_foreign_archs(const char *const *argv)
482
512
{
483
513
  struct dpkg_arch *arch;
495
525
  printf("\n");
496
526
 
497
527
  m_output(stdout, _("<standard output>"));
 
528
 
 
529
  return 0;
498
530
}
499
531
 
500
 
void cmpversions(const char *const *argv) {
 
532
int
 
533
cmpversions(const char *const *argv)
 
534
{
501
535
  struct relationinfo {
502
536
    const char *string;
503
537
    /* These values are exit status codes, so 0 = true, 1 = false. */
559
593
    blankversion(&b);
560
594
  }
561
595
  if (!informativeversion(&a)) {
562
 
    exit(informativeversion(&b) ? rip->if_none_a : rip->if_none_both);
 
596
    return informativeversion(&b) ? rip->if_none_a : rip->if_none_both;
563
597
  } else if (!informativeversion(&b)) {
564
 
    exit(rip->if_none_b);
 
598
    return rip->if_none_b;
565
599
  }
566
600
  r= versioncompare(&a,&b);
567
601
  debug(dbg_general,"cmpversions a=`%s' b=`%s' r=%d",
568
602
        versiondescribe(&a,vdew_always),
569
603
        versiondescribe(&b,vdew_always),
570
604
        r);
571
 
  if (r>0) exit(rip->if_greater);
572
 
  else if (r<0) exit(rip->if_lesser);
573
 
  else exit(rip->if_equal);
 
605
  if (r > 0)
 
606
    return rip->if_greater;
 
607
  else if (r < 0)
 
608
    return rip->if_lesser;
 
609
  else
 
610
    return rip->if_equal;
574
611
}