-
-
Save kallisti5/1fd277bbe507728637e47217fd4a0836 to your computer and use it in GitHub Desktop.
RepositoryInfo url rework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/build/jam/RepositoryRules b/build/jam/RepositoryRules | |
index fb91089..9290f2f 100644 | |
--- a/build/jam/RepositoryRules | |
+++ b/build/jam/RepositoryRules | |
@@ -761,10 +761,10 @@ actions BuildRemoteHaikuPortsRepository1 | |
} | |
-rule HaikuRepository repository : repoInfoTemplate : packages | |
+rule HaikuRepository repository : repoInfoTemplate : packages : url | |
{ | |
- # HaikuRepository <repository> : <repoInfoTemplate> : <packages> | |
- # [ : <url> [ : <versionFile> ] ] ; | |
+ # HaikuRepository <repository> : <repoInfoTemplate> : <packages> : <url> | |
+ # [ : <versionFile> ] ; | |
# Builds the Haiku repository from the given packages and repository info | |
# template. <repository> must already be located. | |
# | |
@@ -773,6 +773,7 @@ rule HaikuRepository repository : repoInfoTemplate : packages | |
# meta data files. | |
# <repoInfoTemplate> - The repository info template file to be used. | |
# <packages> - The packages to be added to the repository. | |
+ # <url> - The remote location of the initial update repository | |
local architecture = $(HAIKU_PACKAGING_ARCH) ; | |
local secondaryArchitecture ; | |
@@ -791,7 +792,7 @@ rule HaikuRepository repository : repoInfoTemplate : packages | |
# build the respository config | |
local repositoryConfig = $(repository:G=repository-config)-config ; | |
MakeLocate $(repositoryConfig) : $(repositoriesDir) ; | |
- RepositoryConfig $(repositoryConfig) : $(repositoryInfo) ; | |
+ RepositoryConfig $(repositoryConfig) : $(repositoryInfo) : $(url) ; | |
HAIKU_REPOSITORY_CONFIG_FILE on $(repository) = $(repositoryConfig) ; | |
# setup the repository cache file | |
diff --git a/build/jam/repositories/Haiku b/build/jam/repositories/Haiku | |
index 14f5ebe..050eae7 100644 | |
--- a/build/jam/repositories/Haiku | |
+++ b/build/jam/repositories/Haiku | |
@@ -52,4 +52,5 @@ if $(webPositiveIsAvailable) { | |
packages += webpositive ; | |
} | |
-HaikuRepository $(haikuRepository) : $(repoInfo) : $(packages:S=.hpkg) ; | |
+HaikuRepository $(haikuRepository) : $(repoInfo) : $(packages:S=.hpkg) | |
+ : "http://packages.haiku-os.org/haiku/master/$(HAIKU_PACKAGING_ARCH)/$(HAIKU_VERSION_NO_REVISION)" ; | |
diff --git a/headers/os/package/RepositoryInfo.h b/headers/os/package/RepositoryInfo.h | |
index 32aa05d..c948724 100644 | |
--- a/headers/os/package/RepositoryInfo.h | |
+++ b/headers/os/package/RepositoryInfo.h | |
@@ -33,7 +33,6 @@ public: | |
status_t InitCheck() const; | |
const BString& Name() const; | |
- const BString& OriginalBaseURL() const; | |
const BString& Vendor() const; | |
const BString& Summary() const; | |
uint8 Priority() const; | |
@@ -42,7 +41,6 @@ public: | |
const BStringList& LicenseTexts() const; | |
void SetName(const BString& name); | |
- void SetOriginalBaseURL(const BString& url); | |
void SetVendor(const BString& vendor); | |
void SetSummary(const BString& summary); | |
void SetPriority(uint8 priority); | |
@@ -58,7 +56,6 @@ public: | |
static const uint8 kDefaultPriority; | |
static const char* const kNameField; | |
- static const char* const kURLField; | |
static const char* const kVendorField; | |
static const char* const kSummaryField; | |
static const char* const kPriorityField; | |
@@ -74,7 +71,6 @@ private: | |
status_t fInitStatus; | |
BString fName; | |
- BString fOriginalBaseURL; | |
BString fVendor; | |
BString fSummary; | |
uint8 fPriority; | |
diff --git a/src/bin/package_repo/command_list.cpp b/src/bin/package_repo/command_list.cpp | |
index c2dcd12..54d223d 100644 | |
--- a/src/bin/package_repo/command_list.cpp | |
+++ b/src/bin/package_repo/command_list.cpp | |
@@ -69,7 +69,6 @@ struct RepositoryContentListHandler : BRepositoryContentHandler { | |
printf("repository-info:\n"); | |
printf("\tname: %s\n", repositoryInfo.Name().String()); | |
printf("\tsummary: %s\n", repositoryInfo.Summary().String()); | |
- printf("\turl: %s\n", repositoryInfo.OriginalBaseURL().String()); | |
printf("\tvendor: %s\n", repositoryInfo.Vendor().String()); | |
printf("\tpriority: %u\n", repositoryInfo.Priority()); | |
printf("\tarchitecture: %s\n", | |
diff --git a/src/bin/pkgman/command_list_repos.cpp b/src/bin/pkgman/command_list_repos.cpp | |
index 677983a..c7a26cc 100644 | |
--- a/src/bin/pkgman/command_list_repos.cpp | |
+++ b/src/bin/pkgman/command_list_repos.cpp | |
@@ -118,8 +118,6 @@ ListReposCommand::Execute(int argc, const char* const* argv) | |
repoCache.Info().Architecture()]); | |
printf("\t\tpkg-count: %" B_PRIu32 "\n", | |
repoCache.CountPackages()); | |
- printf("\t\torig-url: %s\n", | |
- repoCache.Info().OriginalBaseURL().String()); | |
printf("\t\torig-prio: %u\n", repoCache.Info().Priority()); | |
} else | |
printf("\t\t<no repository cache found>\n"); | |
diff --git a/src/data/repository_infos/haiku b/src/data/repository_infos/haiku | |
index a6501ab..1c1a558 100644 | |
--- a/src/data/repository_infos/haiku | |
+++ b/src/data/repository_infos/haiku | |
@@ -2,5 +2,4 @@ name Haiku | |
vendor "Haiku Project" | |
summary "The Haiku repository (for Haiku %HAIKU_VERSION_NO_REVISION%)" | |
priority 1 | |
-url http://packages.haiku-os.org/haiku/master/%HAIKU_PACKAGING_ARCH%/%HAIKU_VERSION_NO_REVISION% | |
architecture %HAIKU_PACKAGING_ARCH% | |
diff --git a/src/data/repository_infos/haikuports b/src/data/repository_infos/haikuports | |
index 3c62733..bb62321 100644 | |
--- a/src/data/repository_infos/haikuports | |
+++ b/src/data/repository_infos/haikuports | |
@@ -2,5 +2,4 @@ name HaikuPorts | |
vendor "Haiku Project" | |
summary "The HaikuPorts repository (for Haiku %HAIKU_VERSION_NO_REVISION%)" | |
priority 1 | |
-url http://packages.haiku-os.org/haikuports/master/repo/%HAIKU_PACKAGING_ARCH%/dummy | |
architecture %HAIKU_PACKAGING_ARCH% | |
diff --git a/src/kits/package/RepositoryConfig.cpp b/src/kits/package/RepositoryConfig.cpp | |
index a5eeb49..05bd61b 100644 | |
--- a/src/kits/package/RepositoryConfig.cpp | |
+++ b/src/kits/package/RepositoryConfig.cpp | |
@@ -104,9 +104,6 @@ BRepositoryConfig::SetTo(const BEntry& entry) | |
const char* url = driverSettings.GetParameterValue("url"); | |
const char* priorityString = driverSettings.GetParameterValue("priority"); | |
- if (url == NULL || *url == '\0') | |
- return B_BAD_DATA; | |
- | |
fName = entry.Name(); | |
fBaseURL = url; | |
fPriority = priorityString == NULL | |
diff --git a/src/kits/package/RepositoryInfo.cpp b/src/kits/package/RepositoryInfo.cpp | |
index aaff367..096eb19 100644 | |
--- a/src/kits/package/RepositoryInfo.cpp | |
+++ b/src/kits/package/RepositoryInfo.cpp | |
@@ -27,7 +27,6 @@ namespace BPackageKit { | |
const uint8 BRepositoryInfo::kDefaultPriority = 50; | |
const char* const BRepositoryInfo::kNameField = "name"; | |
-const char* const BRepositoryInfo::kURLField = "url"; | |
const char* const BRepositoryInfo::kVendorField = "vendor"; | |
const char* const BRepositoryInfo::kSummaryField = "summary"; | |
const char* const BRepositoryInfo::kPriorityField = "priority"; | |
@@ -84,8 +83,6 @@ BRepositoryInfo::Archive(BMessage* data, bool deep) const | |
if ((result = data->AddString(kNameField, fName)) != B_OK) | |
return result; | |
- if ((result = data->AddString(kURLField, fOriginalBaseURL)) != B_OK) | |
- return result; | |
if ((result = data->AddString(kVendorField, fVendor)) != B_OK) | |
return result; | |
result = data->AddString(kSummaryField, fSummary); | |
@@ -139,13 +136,6 @@ BRepositoryInfo::Name() const | |
const BString& | |
-BRepositoryInfo::OriginalBaseURL() const | |
-{ | |
- return fOriginalBaseURL; | |
-} | |
- | |
- | |
-const BString& | |
BRepositoryInfo::Vendor() const | |
{ | |
return fVendor; | |
@@ -195,13 +185,6 @@ BRepositoryInfo::SetName(const BString& name) | |
void | |
-BRepositoryInfo::SetOriginalBaseURL(const BString& url) | |
-{ | |
- fOriginalBaseURL = url; | |
-} | |
- | |
- | |
-void | |
BRepositoryInfo::SetVendor(const BString& vendor) | |
{ | |
fVendor = vendor; | |
@@ -257,8 +240,6 @@ BRepositoryInfo::_SetTo(const BMessage* data) | |
status_t result; | |
if ((result = data->FindString(kNameField, &fName)) != B_OK) | |
return result; | |
- if ((result = data->FindString(kURLField, &fOriginalBaseURL)) != B_OK) | |
- return result; | |
if ((result = data->FindString(kVendorField, &fVendor)) != B_OK) | |
return result; | |
result = data->FindString(kSummaryField, &fSummary); | |
@@ -318,7 +299,6 @@ BRepositoryInfo::_SetTo(const BEntry& entry) | |
&unload_driver_settings); | |
const char* name = get_driver_parameter(settingsHandle, "name", NULL, NULL); | |
- const char* url = get_driver_parameter(settingsHandle, "url", NULL, NULL); | |
const char* vendor | |
= get_driver_parameter(settingsHandle, "vendor", NULL, NULL); | |
const char* summary | |
@@ -328,7 +308,7 @@ BRepositoryInfo::_SetTo(const BEntry& entry) | |
const char* architectureString | |
= get_driver_parameter(settingsHandle, "architecture", NULL, NULL); | |
- if (name == NULL || *name == '\0' || url == NULL || *url == '\0' | |
+ if (name == NULL || *name == '\0' | |
|| vendor == NULL || *vendor == '\0' | |
|| summary == NULL || *summary == '\0' | |
|| priorityString == NULL || *priorityString == '\0' | |
@@ -343,7 +323,6 @@ BRepositoryInfo::_SetTo(const BEntry& entry) | |
} | |
fName = name; | |
- fOriginalBaseURL = url; | |
fVendor = vendor; | |
fSummary = summary; | |
fPriority = atoi(priorityString); | |
diff --git a/src/tools/create_repository_config/create_repository_config.cpp b/src/tools/create_repository_config/create_repository_config.cpp | |
index 9837945..549146f 100644 | |
--- a/src/tools/create_repository_config/create_repository_config.cpp | |
+++ b/src/tools/create_repository_config/create_repository_config.cpp | |
@@ -1,9 +1,10 @@ | |
/* | |
- * Copyright 2013, Haiku, Inc. All Rights Reserved. | |
+ * Copyright 2013-2016, Haiku, Inc. All Rights Reserved. | |
* Distributed under the terms of the MIT License. | |
* | |
* Authors: | |
* Ingo Weinhold <ingo_weinhold@gmx.de> | |
+ * Alexander von Gluck IV <kallisti5@unixzen.com> | |
*/ | |
@@ -37,11 +38,10 @@ void | |
print_usage_and_exit(bool error) | |
{ | |
fprintf(error ? stderr : stdout, | |
- "Usage: %s [ <URL> ] <repository info> <repository config>\n" | |
+ "Usage: %s <URL> <repository info> <repository config>\n" | |
"Creates a repository config file from a given repository info and\n" | |
- "the base URL (the directory in which the \"repo\", \"repo.info\',\n" | |
- "and \"repo.sha256 files can be found). If the URL is not specified,\n" | |
- "the one from the repository info is used.", | |
+ "the base URL (the directory in which the 'repo', 'repo.info',\n" | |
+ "and 'repo.sha256' files can be found).\n", | |
sProgramName); | |
exit(error ? 1 : 0); | |
} | |
@@ -50,7 +50,7 @@ print_usage_and_exit(bool error) | |
int | |
main(int argc, const char* const* argv) | |
{ | |
- if (argc < 3 || argc > 4) { | |
+ if (argc != 4) { | |
if (argc == 2 | |
&& (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)) { | |
print_usage_and_exit(false); | |
@@ -59,7 +59,7 @@ main(int argc, const char* const* argv) | |
} | |
int argi = 1; | |
- const char* url = argc == 4 ? argv[argi++] : NULL; | |
+ const char* url = argv[argi++]; | |
const char* infoPath = argv[argi++]; | |
const char* configPath = argv[argi++]; | |
@@ -68,9 +68,6 @@ main(int argc, const char* const* argv) | |
DIE_ON_ERROR(repoInfo.SetTo(infoPath), | |
"failed to read repository info file \"%s\"", infoPath); | |
- if (url == NULL) | |
- url = repoInfo.OriginalBaseURL(); | |
- | |
// init and write the config | |
BPackageKit::BRepositoryConfig repoConfig; | |
repoConfig.SetName(repoInfo.Name()); | |
diff --git a/src/tools/get_package_dependencies/get_package_dependencies.cpp b/src/tools/get_package_dependencies/get_package_dependencies.cpp | |
index 63d5439..c643529 100644 | |
--- a/src/tools/get_package_dependencies/get_package_dependencies.cpp | |
+++ b/src/tools/get_package_dependencies/get_package_dependencies.cpp | |
@@ -1,9 +1,10 @@ | |
/* | |
- * Copyright 2013, Haiku, Inc. All Rights Reserved. | |
+ * Copyright 2013-2016, Haiku, Inc. All Rights Reserved. | |
* Distributed under the terms of the MIT License. | |
* | |
* Authors: | |
* Ingo Weinhold <ingo_weinhold@gmx.de> | |
+ * Alexander von Gluck IV <kallisti5@unixzen.com> | |
*/ | |
@@ -154,7 +155,9 @@ main(int argc, const char* const* argv) | |
if (package->Repository() != &installedRepository) { | |
const BRepositoryInfo& info | |
= repositoryInfos[package->Repository()]; | |
- BString url = info.OriginalBaseURL(); | |
+ // XXX: Temp HACK -- FIXME | |
+ //BString url = info.OriginalBaseURL(); | |
+ BString url = "http://127.0.0.1"; | |
url << "/packages/" << package->Info().CanonicalFileName(); | |
printf("%s\n", url.String()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
build output: