~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/archiveuploader/uploadprocessor.py

  • Committer: Abel Deuring
  • Date: 2009-01-03 19:32:48 UTC
  • mfrom: (7498 launchpad)
  • mto: This revision was merged to the branch mainline in revision 7499.
  • Revision ID: abel.deuring@canonical.com-20090103193248-s5odmrycs9m77ky6
RF merged

Show diffs side-by-side

added added

removed removed

Lines of Context:
412
412
        The valid paths are:
413
413
        '' - default distro, ubuntu
414
414
        '<distroname>' - given distribution
415
 
        '~<personname>[/ppa_name]/<distroname>[/distroseriesname]' - given ppa,
416
 
          distribution and optionally a distroseries.  If ppa_name is not
417
 
          specified it will default to the one referenced by IPerson.archive.
 
415
        '~<personname>/<distroname>/[distroseriesname]' - given ppa,
 
416
          distribution and optionally a distroseries.
418
417
 
419
418
        I raises UploadPathError if something was wrong when parsing it.
420
419
 
441
440
                    "Could not find distribution '%s'" % distribution_name)
442
441
            archive = distribution.main_archive
443
442
 
444
 
        # PPA upload (~<person>/<ppa_name>/<distro>[/distroseries])
445
 
        elif len(parts) <= 4:
 
443
        # PPA upload (~<person>/<distro>/[distroseries])
 
444
        elif len(parts) <= 3:
446
445
            if not first_path.startswith('~'):
447
446
                raise PPAUploadPathError(
448
447
                    "PPA upload path must start with '~'.")
454
453
                raise PPAUploadPathError(
455
454
                    "Could not find person '%s'" % person_name)
456
455
 
457
 
            # For now, only a ppa_name of "default" is allowed.  If it's
458
 
            # anything else we assume it's a distroseries name,
459
 
            # unless there's >3 parts in which case the upload path
460
 
            # is invalid.
461
 
            #
462
 
            # When we switch off the parallel run of old and new
463
 
            # paths, this check can disappear and distroseries
464
 
            # overrides will always appear in the 4th part.
465
 
 
466
 
            if parts[1] == "default" and len(parts) >= 3:
467
 
                # ppa_name and distro have been specified.
468
 
                distribution_name = parts[2]
469
 
 
470
 
            if parts[1] == "default" and len(parts) == 2:
471
 
                # ppa_name but no distro supplied, bail out.
472
 
                raise UploadPathError(
473
 
                    "Path mismatch '%s'. "
474
 
                    "Use ~<person>/<ppa_name>/<distro>[/distroseries]/"
475
 
                    "[files] for PPAs and <distro>/[files] for normal "
476
 
                    "uploads."
477
 
                    % (relative_path))
478
 
 
479
 
            if parts[1] != "default":
480
 
                distribution_name = parts[1]
481
 
 
 
456
            distribution_name = parts[1]
482
457
            distribution = getUtility(IDistributionSet).getByName(
483
458
                distribution_name)
484
459
            if distribution is None:
500
475
                    % (archive.title, archive.distribution.name))
501
476
 
502
477
            if len(parts) > 2:
503
 
                if parts[1] != "default":
504
 
                    suite_name = parts[2]
505
 
                if parts[1] == "default" and len(parts) > 3:
506
 
                    # parts[1] is the ppa name, so get the suite name
507
 
                    # again from the last part of the path.
508
 
                    suite_name = parts[3]
509
 
 
510
 
            if suite_name is not None:
 
478
                suite_name = parts[2]
511
479
                # Check if the given suite name is valid.
512
480
                # We will return the suite_name string simply.
513
481
                try:
517
485
                        "Could not find suite '%s'" % suite_name)
518
486
        else:
519
487
            raise UploadPathError(
520
 
                "Path mismatch '%s'. "
521
 
                "Use ~<person>/<ppa_name>/<distro>[/distroseries]/"
 
488
                "Path mismatch '%s'. Use ~<person>/<distro>/[distroseries]/"
522
489
                "[files] for PPAs and <distro>/[files] for normal uploads."
523
490
                % (relative_path))
524
491