HaikuDepot : Rename Depot Url to Identifier
The old depot / repository "url" was renamed as "identifier" some years ago. This field seemed to remain as "url" and is now corrected. Change-Id: Icd1390745311030e3fd57b852de91ed69b326496 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7190 Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
parent
64408be772
commit
2af0f027cb
@ -213,7 +213,6 @@ local applicationSources =
|
||||
LanguageMenuUtils.cpp
|
||||
LocaleUtils.cpp
|
||||
PackageUtils.cpp
|
||||
RepositoryUrlUtils.cpp
|
||||
StorageUtils.cpp
|
||||
StringUtils.cpp
|
||||
LoggingUrlProtocolListener.cpp
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "Logger.h"
|
||||
#include "LocaleUtils.h"
|
||||
#include "StorageUtils.h"
|
||||
#include "RepositoryUrlUtils.h"
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
|
@ -40,6 +40,7 @@ _IsPackageBefore(const PackageInfoRef& p1, const PackageInfoRef& p2)
|
||||
DepotInfo::DepotInfo()
|
||||
:
|
||||
fName(),
|
||||
fIdentifier(),
|
||||
fWebAppRepositoryCode()
|
||||
{
|
||||
}
|
||||
@ -48,6 +49,7 @@ DepotInfo::DepotInfo()
|
||||
DepotInfo::DepotInfo(const BString& name)
|
||||
:
|
||||
fName(name),
|
||||
fIdentifier(),
|
||||
fWebAppRepositoryCode(),
|
||||
fWebAppRepositorySourceCode()
|
||||
{
|
||||
@ -57,10 +59,10 @@ DepotInfo::DepotInfo(const BString& name)
|
||||
DepotInfo::DepotInfo(const DepotInfo& other)
|
||||
:
|
||||
fName(other.fName),
|
||||
fIdentifier(other.fIdentifier),
|
||||
fPackages(other.fPackages),
|
||||
fWebAppRepositoryCode(other.fWebAppRepositoryCode),
|
||||
fWebAppRepositorySourceCode(other.fWebAppRepositorySourceCode),
|
||||
fURL(other.fURL)
|
||||
fWebAppRepositorySourceCode(other.fWebAppRepositorySourceCode)
|
||||
{
|
||||
}
|
||||
|
||||
@ -69,8 +71,8 @@ DepotInfo&
|
||||
DepotInfo::operator=(const DepotInfo& other)
|
||||
{
|
||||
fName = other.fName;
|
||||
fIdentifier = other.fIdentifier;
|
||||
fPackages = other.fPackages;
|
||||
fURL = other.fURL;
|
||||
fWebAppRepositoryCode = other.fWebAppRepositoryCode;
|
||||
fWebAppRepositorySourceCode = other.fWebAppRepositorySourceCode;
|
||||
return *this;
|
||||
@ -81,6 +83,7 @@ bool
|
||||
DepotInfo::operator==(const DepotInfo& other) const
|
||||
{
|
||||
return fName == other.fName
|
||||
&& fIdentifier == fIdentifier
|
||||
&& fPackages == other.fPackages;
|
||||
}
|
||||
|
||||
@ -204,9 +207,9 @@ DepotInfo::HasAnyProminentPackages() const
|
||||
|
||||
|
||||
void
|
||||
DepotInfo::SetURL(const BString& URL)
|
||||
DepotInfo::SetIdentifier(const BString& value)
|
||||
{
|
||||
fURL = URL;
|
||||
fIdentifier = value;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,10 @@ public:
|
||||
const BString& Name() const
|
||||
{ return fName; }
|
||||
|
||||
void SetIdentifier(const BString& value);
|
||||
const BString& Identifier() const
|
||||
{ return fIdentifier; }
|
||||
|
||||
int32 CountPackages() const;
|
||||
PackageInfoRef PackageAtIndex(int32 index);
|
||||
void AddPackage(PackageInfoRef& package);
|
||||
@ -38,10 +42,6 @@ public:
|
||||
|
||||
bool HasAnyProminentPackages() const;
|
||||
|
||||
void SetURL(const BString& URL);
|
||||
const BString& URL() const
|
||||
{ return fURL; }
|
||||
|
||||
void SetWebAppRepositoryCode(const BString& code);
|
||||
const BString& WebAppRepositoryCode() const
|
||||
{ return fWebAppRepositoryCode; }
|
||||
@ -53,12 +53,11 @@ public:
|
||||
|
||||
private:
|
||||
BString fName;
|
||||
BString fIdentifier;
|
||||
std::vector<PackageInfoRef>
|
||||
fPackages;
|
||||
BString fWebAppRepositoryCode;
|
||||
BString fWebAppRepositorySourceCode;
|
||||
BString fURL;
|
||||
// this is actually a unique identifier for the repository.
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2022, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* Copyright 2018-2023, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
@ -28,7 +28,6 @@
|
||||
#include "Logger.h"
|
||||
#include "PackageInfo.h"
|
||||
#include "PackageManager.h"
|
||||
#include "RepositoryUrlUtils.h"
|
||||
|
||||
#include <package/Context.h>
|
||||
#include <package/manager/Exceptions.h>
|
||||
@ -119,7 +118,7 @@ LocalPkgDataLoadProcess::RunInternal()
|
||||
repoName, &repoConfig);
|
||||
|
||||
if (getRepositoryConfigStatus == B_OK) {
|
||||
depotInfoRef->SetURL(repoConfig.Identifier());
|
||||
depotInfoRef->SetIdentifier(repoConfig.Identifier());
|
||||
HDDEBUG("[%s] local repository [%s] identifier; [%s]",
|
||||
Name(), repoName.String(), repoConfig.Identifier().String());
|
||||
} else {
|
||||
@ -224,8 +223,7 @@ LocalPkgDataLoadProcess::RunInternal()
|
||||
std::vector<DepotInfoRef>::iterator it;
|
||||
|
||||
for (it = depots.begin(); it != depots.end(); it++) {
|
||||
if (RepositoryUrlUtils::EqualsNormalized(
|
||||
(*it)->URL(), remoteRepository->Config().Identifier())) {
|
||||
if ((*it)->Identifier() == remoteRepository->Config().Identifier()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2020, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* Copyright 2017-2023, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#include "ServerRepositoryDataUpdateProcess.h"
|
||||
@ -92,7 +92,7 @@ DepotMatchingRepositoryListener::_SetupRepositoryData(DepotInfoRef& depot,
|
||||
HDDEBUG("[DepotMatchingRepositoryListener] associated depot [%s] (%s) "
|
||||
"with server repository source [%s] (%s)",
|
||||
depot->Name().String(),
|
||||
depot->URL().String(),
|
||||
depot->Identifier().String(),
|
||||
repositorySourceCode->String(),
|
||||
repositorySource->Identifier()->String());
|
||||
} else {
|
||||
@ -113,8 +113,7 @@ DepotMatchingRepositoryListener::Handle(const BString& identifier,
|
||||
AutoLocker<BLocker> locker(fModel->Lock());
|
||||
for (int32 i = 0; i < fModel->CountDepots(); i++) {
|
||||
DepotInfoRef depot = fModel->DepotAtIndex(i);
|
||||
BString depotUrl = depot->URL();
|
||||
if (identifier == depotUrl)
|
||||
if (identifier == depot->Identifier())
|
||||
_SetupRepositoryData(depot, repository, repositorySource);
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "RepositoryUrlUtils.h"
|
||||
|
||||
|
||||
void
|
||||
RepositoryUrlUtils::NormalizeUrl(BUrl& url)
|
||||
{
|
||||
if (url.Protocol() == "https")
|
||||
url.SetProtocol("http");
|
||||
|
||||
BString path(url.Path());
|
||||
|
||||
if (path.EndsWith("/"))
|
||||
url.SetPath(path.Truncate(path.Length() - 1));
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
RepositoryUrlUtils::EqualsNormalized(const BString& url1, const BString& url2)
|
||||
{
|
||||
if (url1.IsEmpty())
|
||||
return false;
|
||||
|
||||
BUrl normalizedUrl1(url1);
|
||||
NormalizeUrl(normalizedUrl1);
|
||||
BUrl normalizedUrl2(url2);
|
||||
NormalizeUrl(normalizedUrl2);
|
||||
|
||||
return normalizedUrl1 == normalizedUrl2;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef REPOSITORY_URL_UTILS_H
|
||||
#define REPOSITORY_URL_UTILS_H
|
||||
|
||||
|
||||
#include <Url.h>
|
||||
|
||||
|
||||
class RepositoryUrlUtils {
|
||||
|
||||
public:
|
||||
static void NormalizeUrl(BUrl& url);
|
||||
static bool EqualsNormalized(const BString& url1,
|
||||
const BString& url2);
|
||||
static bool EqualsNormalized(const BUrl& normalizedUrl1,
|
||||
const BString& url2);
|
||||
};
|
||||
|
||||
|
||||
#endif // REPOSITORY_URL_UTILS_H
|
Loading…
x
Reference in New Issue
Block a user