Ticket #12917: get_package_dependencies.diff

File get_package_dependencies.diff, 2.3 KB (added by kallisti5, 3 years ago)
  • src/tools/get_package_dependencies/get_package_dependencies.cpp

    diff --git a/src/tools/get_package_dependencies/get_package_dependencies.cpp b/src/tools/get_package_dependencies/get_package_dependencies.cpp
    index 63d5439..f51f101 100644
    a b  
    11/*
    2  * Copyright 2013, Haiku, Inc. All Rights Reserved.
     2 * Copyright 2013-2016, Haiku, Inc. All Rights Reserved.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
    66 *      Ingo Weinhold <ingo_weinhold@gmx.de>
     7 *      Alexander von Gluck IV <kallisti5@unixzen.com>
    78 */
    89
    910
     
    1314
    1415#include <map>
    1516
    16 #include <package/RepositoryCache.h>
     17#include <package/RepositoryConfig.h>
    1718#include <package/manager/Exceptions.h>
    1819#include <package/manager/RepositoryBuilder.h>
    1920#include <package/solver/Solver.h>
    main(int argc, const char* const* argv) 
    9394        DIE(B_OK, "%s", e.Details().String());
    9495    }
    9596
    96     // add external repositories
    97     std::map<BSolverRepository*, BRepositoryInfo> repositoryInfos;
     97    // add specified remote repositories
     98    std::map<BSolverRepository*, BString> repositoryURLs;
    9899    for (int i = 0; i < repositoryCount; i++) {
    99100        BSolverRepository* repository = new BSolverRepository;
    100         BRepositoryCache cache;
    101         error = cache.SetTo(repositories[i]);
     101        BRepositoryConfig config;
     102        error = config.SetTo(repositories[i]);
    102103        if (error != B_OK)
    103             DIE(error, "failed to read repository file '%s'", repositories[i]);
    104         BRepositoryBuilder(*repository, cache)
     104            DIE(error, "failed to read repository config '%s'", repositories[i]);
     105        BRepositoryBuilder(*repository, config)
    105106            .AddToSolver(solver, false);
    106         repositoryInfos[repository] = cache.Info();
     107        repositoryURLs[repository] = config.BaseURL();
     108        printf("%s: BASE: %s\n", __func__, config.BaseURL().String());
    107109    }
    108110
    109111    // solve
    main(int argc, const char* const* argv) 
    152154        switch (element->Type()) {
    153155            case BSolverResultElement::B_TYPE_INSTALL:
    154156                if (package->Repository() != &installedRepository) {
    155                     const BRepositoryInfo& info
    156                         = repositoryInfos[package->Repository()];
    157                     BString url = info.OriginalBaseURL();
     157                    BString url = repositoryURLs[package->Repository()];
    158158                    url << "/packages/" << package->Info().CanonicalFileName();
    159159                    printf("%s\n", url.String());
    160160                }