Revert "PackageKit: HPKR BMessage Format Fix"

This reverts commit 82f985c036.

Reason for revert: Broke the build with this message:
/packages/groff-1.22.3-1-x86_64.hpkg: Scheme missing.

Change-Id: I9dea4986238cedfdc33c84739e69a331add09cdf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2896
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
waddlesplash
2020-06-10 00:20:21 +00:00
parent 16ad15142c
commit 9ab0dec545
+23 -23
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2011-2020, Haiku, Inc. All Rights Reserved. * Copyright 2011-2018, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -92,14 +92,15 @@ BRepositoryInfo::Archive(BMessage* data, bool deep) const
if ((result = data->AddString(kNameField, fName)) != B_OK) if ((result = data->AddString(kNameField, fName)) != B_OK)
return result; return result;
if ((result = data->AddString(kIdentifierField, fIdentifier)) != B_OK) // Field in the archive is named "url" for backward compatility reasons.
return result; // We can change this when everyone has updated to a version of Haiku
// "url" is an older, deprecated key for "identifier" // with support for reading the "identifier" field.
if ((result = data->AddString(kURLField, fIdentifier)) != B_OK) if ((result = data->AddString(kURLField, fIdentifier)) != B_OK)
return result; return result;
if ((result = data->AddString(kVendorField, fVendor)) != B_OK) if ((result = data->AddString(kVendorField, fVendor)) != B_OK)
return result; return result;
if ((result = data->AddString(kSummaryField, fSummary)) != B_OK) result = data->AddString(kSummaryField, fSummary);
if (result != B_OK)
return result; return result;
if ((result = data->AddUInt8(kPriorityField, fPriority)) != B_OK) if ((result = data->AddUInt8(kPriorityField, fPriority)) != B_OK)
return result; return result;
@@ -281,35 +282,34 @@ BRepositoryInfo::_SetTo(const BMessage* data)
status_t result; status_t result;
if ((result = data->FindString(kNameField, &fName)) != B_OK) if ((result = data->FindString(kNameField, &fName)) != B_OK)
return result; return result;
result = data->FindString(kIdentifierField, &fIdentifier); if ((result = data->FindString(kIdentifierField, &fIdentifier)) != B_OK) {
if (result == B_NAME_NOT_FOUND) { // Handle the "url" field as well (it is still the one we generate).
result = data->FindString(kURLField, &fIdentifier); // Later on when everyone is using this code we can switch the writing
// this is a legacy key for the identifier. // side to use the "identifier" field with its correct name.
if ((result = data->FindString(kURLField, &fIdentifier)) != B_OK)
return result;
} }
if (result != B_OK)
return result;
if ((result = data->FindString(kVendorField, &fVendor)) != B_OK) if ((result = data->FindString(kVendorField, &fVendor)) != B_OK)
return result; return result;
if ((result = data->FindString(kSummaryField, &fSummary)) != B_OK) if ((result = data->FindString(kSummaryField, &fSummary)) != B_OK)
return result; return result;
if ((result = data->FindUInt8(kPriorityField, &fPriority)) != B_OK) if ((result = data->FindUInt8(kPriorityField, &fPriority)) != B_OK)
return result; return result;
if ((result = data->FindUInt8( result = data->FindUInt8(kArchitectureField, (uint8*)&fArchitecture);
kArchitectureField, (uint8*)&fArchitecture)) != B_OK) { if (result != B_OK)
return result; return result;
}
if (fArchitecture == B_PACKAGE_ARCHITECTURE_ANY) if (fArchitecture == B_PACKAGE_ARCHITECTURE_ANY)
return B_BAD_DATA; return B_BAD_DATA;
// this field is optional because earlier versions did not support this // Old packages had no base-url field, the "url" field acted both as an
// field. // identifier and locator for the repository.
status_t baseUrlResult = data->FindString(kBaseURLField, &fBaseURL); data->FindString(kBaseURLField, &fBaseURL);
switch (baseUrlResult) { if (fBaseURL.Length() == 0) {
case B_OK: fBaseURL = fIdentifier;
case B_NAME_NOT_FOUND: // In that case make sure the identifier is indeed an http URL
break; // (in the new format, the protocol is not required to be http anymore)
default: if (!fBaseURL.StartsWith("http"))
return baseUrlResult; return B_BAD_DATA;
} }
const char* licenseName; const char* licenseName;