Support package info [source] URL attributes

This commit is contained in:
Ingo Weinhold 2011-06-28 18:16:18 +02:00
parent 4b6a3a9c5f
commit 4ebd3de828
4 changed files with 48 additions and 0 deletions

View File

@ -164,6 +164,14 @@ struct PackageContentListHandler : BPackageContentHandler {
printf("\tlicense: %s\n", value.string);
break;
case B_PACKAGE_INFO_URLS:
printf("\tURL: %s\n", value.string);
break;
case B_PACKAGE_INFO_SOURCE_URLS:
printf("\tsource URL: %s\n", value.string);
break;
case B_PACKAGE_INFO_PROVIDES:
printf("\tprovides: %s", value.resolvable.name);
if (value.resolvable.haveVersion) {

View File

@ -115,6 +115,16 @@ struct RepositoryContentListHandler : BRepositoryContentHandler {
printf("\tlicense: %s\n", value.string);
break;
case B_PACKAGE_INFO_URLS:
if (fVerbose)
printf("\tURL: %s\n", value.string);
break;
case B_PACKAGE_INFO_SOURCE_URLS:
if (fVerbose)
printf("\tsource URL: %s\n", value.string);
break;
case B_PACKAGE_INFO_PROVIDES:
if (!fVerbose)
break;

View File

@ -376,6 +376,14 @@ ReaderImplBase::PackageAttributeHandler::HandleAttribute(
value.string);
break;
case B_HPKG_ATTRIBUTE_ID_PACKAGE_URL:
fPackageInfoValue.SetTo(B_PACKAGE_INFO_URLS, value.string);
break;
case B_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL:
fPackageInfoValue.SetTo(B_PACKAGE_INFO_SOURCE_URLS, value.string);
break;
case B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES:
fPackageInfoValue.resolvable.name = value.string;
fPackageInfoValue.attributeID = B_PACKAGE_INFO_PROVIDES;

View File

@ -431,6 +431,28 @@ WriterImplBase::RegisterPackageInfo(PackageAttributeList& attributeList,
attributeList.Add(license);
}
// URL list
const BObjectList<BString>& urlList = packageInfo.URLList();
for (int i = 0; i < urlList.CountItems(); ++i) {
PackageAttribute* url = new PackageAttribute(
B_HPKG_ATTRIBUTE_ID_PACKAGE_URL, B_HPKG_ATTRIBUTE_TYPE_STRING,
B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE);
url->string = fPackageStringCache.Get(urlList.ItemAt(i)->String());
attributeList.Add(url);
}
// source URL list
const BObjectList<BString>& sourceURLList = packageInfo.SourceURLList();
for (int i = 0; i < sourceURLList.CountItems(); ++i) {
PackageAttribute* url = new PackageAttribute(
B_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL,
B_HPKG_ATTRIBUTE_TYPE_STRING,
B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE);
url->string = fPackageStringCache.Get(
sourceURLList.ItemAt(i)->String());
attributeList.Add(url);
}
// provides list
const BObjectList<BPackageResolvable>& providesList
= packageInfo.ProvidesList();