HaikuDepot : Changelog, Remove old API and Version Bump
This change re-instates the change-log function (TRAC#13827) that was dropped in earlier changes. Also now-disused API handling logic is removed. A small code-style fix is made and the version of the application has been incremented so that this version's logic can later be detected by the HDS application server.
This commit is contained in:
parent
1603eec4a4
commit
80a272eed8
@ -8,13 +8,13 @@ resource app_flags B_SINGLE_LAUNCH;
|
|||||||
resource app_version {
|
resource app_version {
|
||||||
major = 0,
|
major = 0,
|
||||||
middle = 0,
|
middle = 0,
|
||||||
minor = 1,
|
minor = 2,
|
||||||
|
|
||||||
variety = B_APPV_ALPHA,
|
variety = B_APPV_ALPHA,
|
||||||
internal = 1,
|
internal = 1,
|
||||||
|
|
||||||
short_info = "HaikuDepot",
|
short_info = "HaikuDepot",
|
||||||
long_info = "HaikuDepot ©2013-2014 Haiku"
|
long_info = "HaikuDepot ©2013-2018 Haiku"
|
||||||
};
|
};
|
||||||
|
|
||||||
resource file_types message {
|
resource file_types message {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
|
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
|
||||||
* Copyright 2014, Axel Dörfler <axeld@pinc-software.de>.
|
* Copyright 2014, Axel Dörfler <axeld@pinc-software.de>.
|
||||||
* Copyright 2016-2017, Andrew Lindesay <apl@lindesay.co.nz>.
|
* Copyright 2016-2018, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -669,6 +669,10 @@ Model::PopulatePackage(const PackageInfoRef& package, uint32 flags)
|
|||||||
fPopulatedPackages.Add(package);
|
fPopulatedPackages.Add(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((flags & POPULATE_CHANGELOG) != 0) {
|
||||||
|
_PopulatePackageChangelog(package);
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & POPULATE_USER_RATINGS) != 0) {
|
if ((flags & POPULATE_USER_RATINGS) != 0) {
|
||||||
// Retrieve info from web-app
|
// Retrieve info from web-app
|
||||||
BMessage info;
|
BMessage info;
|
||||||
@ -746,8 +750,8 @@ Model::PopulatePackage(const PackageInfoRef& package, uint32 flags)
|
|||||||
comment, languageCode, versionString, 0, 0)
|
comment, languageCode, versionString, 0, 0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (info.FindMessage("error", &result) == B_OK) {
|
} else {
|
||||||
result.PrintToStream();
|
_MaybeLogJsonRpcError(info, "retrieve user ratings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -767,6 +771,48 @@ Model::PopulatePackage(const PackageInfoRef& package, uint32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Model::_PopulatePackageChangelog(const PackageInfoRef& package)
|
||||||
|
{
|
||||||
|
BMessage info;
|
||||||
|
BString packageName;
|
||||||
|
|
||||||
|
{
|
||||||
|
BAutolock locker(&fLock);
|
||||||
|
packageName = package->Name();
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t status = fWebAppInterface.GetChangelog(packageName, info);
|
||||||
|
|
||||||
|
if (status == B_OK) {
|
||||||
|
// Parse message
|
||||||
|
BMessage result;
|
||||||
|
BString content;
|
||||||
|
if (info.FindMessage("result", &result) == B_OK) {
|
||||||
|
if (result.FindString("content", &content) == B_OK
|
||||||
|
&& 0 != content.Length()) {
|
||||||
|
BAutolock locker(&fLock);
|
||||||
|
package->SetChangelog(content);
|
||||||
|
if (Logger::IsDebugEnabled()) {
|
||||||
|
fprintf(stdout, "changelog populated for [%s]\n",
|
||||||
|
packageName.String());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Logger::IsDebugEnabled()) {
|
||||||
|
fprintf(stdout, "no changelog present for [%s]\n",
|
||||||
|
packageName.String());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_MaybeLogJsonRpcError(info, "populate package changelog");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stdout, "unable to obtain the changelog for the package"
|
||||||
|
"[%s]\n", packageName.String());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::SetUsername(BString username)
|
Model::SetUsername(BString username)
|
||||||
{
|
{
|
||||||
@ -1080,4 +1126,24 @@ Model::LogDepotsWithNoWebAppRepositoryCode() const
|
|||||||
"depot server system\n");
|
"depot server system\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Model::_MaybeLogJsonRpcError(const BMessage &responsePayload,
|
||||||
|
const char *sourceDescription) const
|
||||||
|
{
|
||||||
|
BMessage error;
|
||||||
|
BString errorMessage;
|
||||||
|
double errorCode;
|
||||||
|
|
||||||
|
if (responsePayload.FindMessage("error", &error) == B_OK
|
||||||
|
&& error.FindString("message", &errorMessage) == B_OK
|
||||||
|
&& error.FindDouble("code", &errorCode) == B_OK) {
|
||||||
|
printf("[%s] --> error : [%s] (%f)\n", sourceDescription,
|
||||||
|
errorMessage.String(), errorCode);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
printf("[%s] --> an undefined error has occurred\n", sourceDescription);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
|
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
|
||||||
* Copyright 2016-2017, Andrew Lindesay <apl@lindesay.co.nz>.
|
* Copyright 2016-2018, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef MODEL_H
|
#ifndef MODEL_H
|
||||||
@ -193,10 +193,17 @@ public:
|
|||||||
void LogDepotsWithNoWebAppRepositoryCode() const;
|
void LogDepotsWithNoWebAppRepositoryCode() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void _MaybeLogJsonRpcError(
|
||||||
|
const BMessage &responsePayload,
|
||||||
|
const char *sourceDescription) const;
|
||||||
|
|
||||||
void _UpdateIsFeaturedFilter();
|
void _UpdateIsFeaturedFilter();
|
||||||
|
|
||||||
static int32 _PopulateAllPackagesEntry(void* cookie);
|
static int32 _PopulateAllPackagesEntry(void* cookie);
|
||||||
|
|
||||||
|
void _PopulatePackageChangelog(
|
||||||
|
const PackageInfoRef& package);
|
||||||
|
|
||||||
void _PopulatePackageScreenshot(
|
void _PopulatePackageScreenshot(
|
||||||
const PackageInfoRef& package,
|
const PackageInfoRef& package,
|
||||||
const ScreenshotInfo& info,
|
const ScreenshotInfo& info,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
|
* Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
|
||||||
* Copyright 2013, Rene Gollent <rene@gollent.com>.
|
* Copyright 2013, Rene Gollent <rene@gollent.com>.
|
||||||
* Copyright 2016-2017, Andrew Lindesay <apl@lindesay.co.nz>.
|
* Copyright 2016-2018, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1064,7 +1064,8 @@ DepotInfo::AddPackage(const PackageInfoRef& package)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int32 PackageFixedNameCompare(const void* context,
|
static int32
|
||||||
|
PackageFixedNameCompare(const void* context,
|
||||||
const PackageInfoRef& package)
|
const PackageInfoRef& package)
|
||||||
{
|
{
|
||||||
const BString* packageName = static_cast<const BString*>(context);
|
const BString* packageName = static_cast<const BString*>(context);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
|
* Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
|
||||||
* Copyright 2016-2017, Andrew Lindesay <apl@lindesay.co.nz>.
|
* Copyright 2016-2018, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -315,81 +315,15 @@ WebAppInterface::SetPreferredLanguage(const BString& language)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
WebAppInterface::RetrieveRepositoriesForSourceBaseURLs(
|
WebAppInterface::GetChangelog(const BString& packageName, BMessage& message)
|
||||||
const StringList& repositorySourceBaseURLs,
|
|
||||||
BMessage& message)
|
|
||||||
{
|
{
|
||||||
BString jsonString = JsonBuilder()
|
BString jsonString = JsonBuilder()
|
||||||
.AddValue("jsonrpc", "2.0")
|
.AddValue("jsonrpc", "2.0")
|
||||||
.AddValue("id", ++fRequestIndex)
|
.AddValue("id", ++fRequestIndex)
|
||||||
.AddValue("method", "searchRepositories")
|
.AddValue("method", "getPkgChangelog")
|
||||||
.AddArray("params")
|
.AddArray("params")
|
||||||
.AddObject()
|
.AddObject()
|
||||||
.AddArray("repositorySourceSearchUrls")
|
.AddValue("pkgName", packageName)
|
||||||
.AddStrings(repositorySourceBaseURLs)
|
|
||||||
.EndArray()
|
|
||||||
.AddValue("offset", 0)
|
|
||||||
.AddValue("limit", 1000) // effectively a safety limit
|
|
||||||
.EndObject()
|
|
||||||
.EndArray()
|
|
||||||
.End();
|
|
||||||
|
|
||||||
return _SendJsonRequest("repository", jsonString, 0, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
WebAppInterface::RetrievePackageInfo(const BString& packageName,
|
|
||||||
const BString& architecture, const BString& repositoryCode,
|
|
||||||
BMessage& message)
|
|
||||||
{
|
|
||||||
BString jsonString = JsonBuilder()
|
|
||||||
.AddValue("jsonrpc", "2.0")
|
|
||||||
.AddValue("id", ++fRequestIndex)
|
|
||||||
.AddValue("method", "getPkg")
|
|
||||||
.AddArray("params")
|
|
||||||
.AddObject()
|
|
||||||
.AddValue("name", packageName)
|
|
||||||
.AddValue("architectureCode", architecture)
|
|
||||||
.AddValue("naturalLanguageCode", fLanguage)
|
|
||||||
.AddValue("repositoryCode", repositoryCode)
|
|
||||||
.AddValue("versionType", "NONE")
|
|
||||||
.EndObject()
|
|
||||||
.EndArray()
|
|
||||||
.End();
|
|
||||||
|
|
||||||
return _SendJsonRequest("pkg", jsonString, 0, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
WebAppInterface::RetrieveBulkPackageInfo(const StringList& packageNames,
|
|
||||||
const StringList& packageArchitectures,
|
|
||||||
const StringList& repositoryCodes, BMessage& message)
|
|
||||||
{
|
|
||||||
BString jsonString = JsonBuilder()
|
|
||||||
.AddValue("jsonrpc", "2.0")
|
|
||||||
.AddValue("id", ++fRequestIndex)
|
|
||||||
.AddValue("method", "getBulkPkg")
|
|
||||||
.AddArray("params")
|
|
||||||
.AddObject()
|
|
||||||
.AddArray("pkgNames")
|
|
||||||
.AddStrings(packageNames)
|
|
||||||
.EndArray()
|
|
||||||
.AddArray("architectureCodes")
|
|
||||||
.AddStrings(packageArchitectures)
|
|
||||||
.EndArray()
|
|
||||||
.AddArray("repositoryCodes")
|
|
||||||
.AddStrings(repositoryCodes)
|
|
||||||
.EndArray()
|
|
||||||
.AddValue("naturalLanguageCode", fLanguage)
|
|
||||||
.AddValue("versionType", "LATEST")
|
|
||||||
.AddArray("filter")
|
|
||||||
.AddItem("PKGCATEGORIES")
|
|
||||||
.AddItem("PKGSCREENSHOTS")
|
|
||||||
.AddItem("PKGVERSIONLOCALIZATIONDESCRIPTIONS")
|
|
||||||
.AddItem("PKGCHANGELOG")
|
|
||||||
.EndArray()
|
|
||||||
.EndObject()
|
.EndObject()
|
||||||
.EndArray()
|
.EndArray()
|
||||||
.End();
|
.End();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
|
* Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
|
||||||
* Copyright 2016-2017, Andrew Lindesay <apl@lindesay.co.nz>.
|
* Copyright 2016-2018, Andrew Lindesay <apl@lindesay.co.nz>.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef WEB_APP_INTERFACE_H
|
#ifndef WEB_APP_INTERFACE_H
|
||||||
@ -37,20 +37,8 @@ public:
|
|||||||
void SetPreferredLanguage(const BString& language);
|
void SetPreferredLanguage(const BString& language);
|
||||||
void SetArchitecture(const BString& architecture);
|
void SetArchitecture(const BString& architecture);
|
||||||
|
|
||||||
status_t RetrieveRepositoriesForSourceBaseURLs(
|
status_t GetChangelog(
|
||||||
const StringList& repositorySourceBaseURL,
|
|
||||||
BMessage& message);
|
|
||||||
|
|
||||||
status_t RetrievePackageInfo(
|
|
||||||
const BString& packageName,
|
const BString& packageName,
|
||||||
const BString& architecture,
|
|
||||||
const BString& repositoryCode,
|
|
||||||
BMessage& message);
|
|
||||||
|
|
||||||
status_t RetrieveBulkPackageInfo(
|
|
||||||
const StringList& packageNames,
|
|
||||||
const StringList& packageArchitectures,
|
|
||||||
const StringList& repositoryCodes,
|
|
||||||
BMessage& message);
|
BMessage& message);
|
||||||
|
|
||||||
status_t RetrieveUserRatings(
|
status_t RetrieveUserRatings(
|
||||||
|
Loading…
Reference in New Issue
Block a user