Appends the platform version to the given artifact name.

    Also validates that the name doesn't already end with the version.
347414
def suffix_version(self, name):
    
    if self.version == 'custom':
      suffix = self.get_options().suffix_version
      if suffix:
        return '{0}_{1}'.format(name, suffix)
      else:
        raise RuntimeError('Suffix version must be specified if using a custom scala version. '
                           'Suffix version is used for bootstrapping jars.  If a custom '
                           'scala version is not specified, then the version specified in '
                           '--scala-suffix-version is used.  For example for Scala '
                           '2.10.7 you would use the suffix version "2.10".')

    elif name.endswith(self.version):
      raise ValueError('The name "{0}" should not be suffixed with the scala platform version '
                      '({1}): it will be added automatically.'.format(name, self.version))
    return '{0}_{1}'.format(name, self.version)
548922
private void addNewRepos(List<ArtifactoryRepo> repos, List<ArtifactoryRepo> existingRepos, ArtifactoryCollector collector) {
        long start = System.currentTimeMillis();
        int count = 0;

        List<ArtifactoryRepo> newRepos = new ArrayList<>();
        for (ArtifactoryRepo repo : repos) {
            ArtifactoryRepo existing = null;
            if (!CollectionUtils.isEmpty(existingRepos) && (existingRepos.contains(repo))) {
                existing = existingRepos.get(existingRepos.indexOf(repo));
            }

            if (existing == null) {
                repo.setCollectorId(collector.getId());
                repo.setEnabled(false); // Do not enable for collection. Will be enabled later
                repo.setDescription(repo.getRepoName());
                newRepos.add(repo);
                count++;
            }
        }
        //save all in one shot
        if (!CollectionUtils.isEmpty(newRepos)) {
            artifactoryRepoRepository.save(newRepos);
        }
        log("New repos", start, count);
    }
214085
private void appendVersionPiece(StringBuilder sb, String pc) {
        if ((pc != null) && !pc.isEmpty()) {
            pc = pc.trim();
            
            if (sb.length() > 0) {
                sb.append(".");
            }
            
            sb.append(StringUtils.isNumeric(pc) ? pc : "0");
        }
    }
556396
private void addNewArtifactsItems(List<BaseArtifact> baseArtifacts, List<ArtifactItem> existingArtifactItems, ArtifactoryCollector collector) {
        long start = System.currentTimeMillis();
        List<BinaryArtifact> binaryArtifacts = new ArrayList<>();
        int count = 0;
        Set<ArtifactItem> existingSet = new HashSet<>(existingArtifactItems);
        for (BaseArtifact baseArtifact : baseArtifacts) {
            ArtifactItem newArtifactItem = baseArtifact.getArtifactItem();
            if (newArtifactItem != null && !existingSet.contains(newArtifactItem)) {
                newArtifactItem.setLastUpdated(System.currentTimeMillis());
                newArtifactItem.setCollectorId(collector.getId());
                newArtifactItem = artifactItemRepository.save(newArtifactItem);
                existingSet.add(newArtifactItem);
                BinaryArtifact binaryArtifact = baseArtifact.getBinaryArtifact();
                if (binaryArtifact != null) {
                    binaryArtifact.setCollectorItemId(newArtifactItem.getId());
                    binaryArtifacts.add(binaryArtifact);
                }
                count++;
            }
        }
        if (!binaryArtifacts.isEmpty()) {
            binaryArtifacts.forEach(binaryArtifact -> binaryArtifactRepository.save(binaryArtifact));
        }
        log("New artifacts", start, count);
    }
697077
public void registerVersion(Version versionToAdd) {
    String versionName = keyHandler.handle(versionToAdd.getName());
    versions.put(versionName, versionToAdd);
    notifyReportableObservers(versionToAdd);
  }
1357401
def versions(name, constraint = Semverse::DEFAULT_CONSTRAINT)
      constraint = Semverse::Constraint.coerce(constraint)

      if constraint == Semverse::DEFAULT_CONSTRAINT
        @artifacts_by_name[name]
      else
        @artifacts_by_name[name].select do |artifact|
          constraint.satisfies?(artifact.version)
        end
      end
    end
974749
def _copy_artifact(self, tgt, jar, version, typename, suffix='', extension='jar',
                     artifact_ext='', override_name=None):
    """"""
    genmap = self.context.products.get(typename)
    product_mapping = genmap.get(tgt)
    if product_mapping is None:
      raise ValueError("No product mapping in {} for {}. "
                       "You may need to run some other task first".format(typename, tgt))
    for basedir, jars in product_mapping.items():
      for artifact in jars:
        path = self.artifact_path(jar, version, name=override_name, suffix=suffix,
                                  extension=extension, artifact_ext=artifact_ext)
        safe_mkdir(os.path.dirname(path))
        shutil.copy(os.path.join(basedir, artifact), path)
55647
def set_baseline(self, version):
        
        pattern = re.compile(r"^\d+\.\d+\.\d+$")
        if not re.match(pattern, version):
            raise ValueError('Wrong version format')

        query = """
                INSERT INTO {} (
                    version,
                    description,
                    type,
                    script,
                    checksum,
                    installed_by,
                    execution_time,
                    success
                ) VALUES(
                    '{}',
                    '{}',
                    {},
                    '{}',
                    '{}',
                    '{}',
                    1,
                    TRUE
                ) """.format(self.upgrades_table, version, 'baseline', 0,
                             '', '', self.__get_dbuser())
        self.cursor.execute(query)
        self.connection.commit()
433669
private static boolean ensureVersion(Version existing, Version expected) {
        return existing != Version.UNDEFINED && existing.greaterThanOrEqualTo(expected);
    }
1024680
public void add(final long version) {
        versionWindow[versionWriteHead++] = version;
        if (versionWriteHead == versionWindow.length) {
            versionWriteHead = 0;
        }
        versionsStored++;
    }
544935
def process_package(self, package_name):
        

        metadata = super(ArtifactRegistry, self).process_package(package_name)
        if metadata:
            self.update_artifact_metadata(package_name, metadata)
198472
@Override
  public void exitNamed_version(VersionParser.Named_versionContext ctx)
  {
    IVersion version = null;
    try {
      version = new NamedVersion(ctx.getText());
    }
    catch (InvalidRangeException e) {
      throw new InvalidRangeRuntimeException(e.getMessage(), e);
    }
    stack.push(version);
  }
928059
def create_package_version(requirement):
    """"""
    try:
        PackageVersion(requirement=requirement).save()
        logger.info("Package '%s' added.", requirement.name)  # noqa
    except IntegrityError:
        logger.info("Package '%s' already exists.", requirement.name)
603855
def add_release(self, release):
        
        for r in self.releases:
            if r.version == release.version:
                return
        self.releases.append(release)
581869
private String packageAppend(String origPackage, String suffix) {
    if (origPackage == null) {
      return suffix;
    } else {
      return origPackage + "." + suffix;
    }
  }
1190690
@Override
  public PackageDescriptor add(String pm, String groupId, String artifactId, String version) {
    PackageCoordinate pkg = PackageCoordinate.newBuilder()
        .withFormat(pm)
        .withNamespace(groupId)
        .withName(artifactId)
        .withVersion(version)
        .build();
    return add(Collections.singletonList(pkg));
  }
1156511
def update(
        ctx,
        archive_name,
        bumpversion='patch',
        prerelease=None,
        dependency=None,
        message=None,
        string=False,
        file=None):
    '''
    
    '''

    _generate_api(ctx)

    args, kwargs = _parse_args_and_kwargs(ctx.args)
    assert len(args) == 0, 'Unrecognized arguments: "{}"'.format(args)

    dependencies_dict = _parse_dependencies(dependency)

    var = ctx.obj.api.get_archive(archive_name)
    latest_version = var.get_latest_version()

    if string:

        with var.open(
                'w+',
                bumpversion=bumpversion,
                prerelease=prerelease,
                dependencies=dependencies_dict,
                metadata=kwargs,
                message=message) as f:

            if file is None:
                for line in sys.stdin:
                    f.write(u(line))
            else:
                f.write(u(file))

    else:
        if file is None:
            file = click.prompt('enter filepath')

        var.update(
            file,
            bumpversion=bumpversion,
            prerelease=prerelease,
            dependencies=dependencies_dict,
            metadata=kwargs,
            message=message)

    new_version = var.get_latest_version()

    if latest_version is None and new_version is not None:
        bumpmsg = ' new version {} created.'.format(
            new_version)

    elif new_version != latest_version:
        bumpmsg = ' version bumped {} --> {}.'.format(
            latest_version, new_version)

    elif var.versioned:
        bumpmsg = ' version remains {}.'.format(latest_version)
    else:
        bumpmsg = ''

    click.echo('uploaded data to {}.{}'.format(var, bumpmsg))