* add listing of repository attributes to 'package_repo list'
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40508 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,27 +8,22 @@
|
|||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
#include <package/hpkg/PackageContentHandler.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPackageKit {
|
namespace BPackageKit {
|
||||||
|
|
||||||
|
|
||||||
class BPackageInfo;
|
|
||||||
class BRepositoryInfo;
|
class BRepositoryInfo;
|
||||||
|
|
||||||
|
|
||||||
namespace BHPKG {
|
namespace BHPKG {
|
||||||
|
|
||||||
|
|
||||||
class BRepositoryContentHandler {
|
class BRepositoryContentHandler : public BPackageContentHandler {
|
||||||
public:
|
public:
|
||||||
virtual ~BRepositoryContentHandler();
|
|
||||||
|
|
||||||
virtual status_t HandleRepositoryInfo(
|
virtual status_t HandleRepositoryInfo(
|
||||||
const BRepositoryInfo& info) = 0;
|
const BRepositoryInfo& info) = 0;
|
||||||
virtual status_t HandlePackage(const BPackageInfo& info) = 0;
|
|
||||||
virtual status_t HandlePackagesDone() = 0;
|
|
||||||
|
|
||||||
virtual void HandleErrorOccurred() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace BPrivate {
|
|||||||
using BPrivate::RepositoryReaderImpl;
|
using BPrivate::RepositoryReaderImpl;
|
||||||
|
|
||||||
class BErrorOutput;
|
class BErrorOutput;
|
||||||
class BPackageContentHandler;
|
class BRepositoryContentHandler;
|
||||||
|
|
||||||
|
|
||||||
class BRepositoryReader {
|
class BRepositoryReader {
|
||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
|
|
||||||
status_t Init(const char* fileName);
|
status_t Init(const char* fileName);
|
||||||
status_t ParseContent(
|
status_t ParseContent(
|
||||||
BPackageContentHandler* contentHandler);
|
BRepositoryContentHandler* contentHandler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RepositoryReaderImpl* fImpl;
|
RepositoryReaderImpl* fImpl;
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ namespace BPackageKit {
|
|||||||
namespace BHPKG {
|
namespace BHPKG {
|
||||||
|
|
||||||
|
|
||||||
|
class BRepositoryContentHandler;
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +36,7 @@ public:
|
|||||||
BRepositoryInfo* _repositoryInfo) const;
|
BRepositoryInfo* _repositoryInfo) const;
|
||||||
|
|
||||||
status_t ParseContent(
|
status_t ParseContent(
|
||||||
BPackageContentHandler* contentHandler);
|
BRepositoryContentHandler* contentHandler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct RootAttributeHandler;
|
struct RootAttributeHandler;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -11,10 +11,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <package/hpkg/PackageContentHandler.h>
|
|
||||||
#include <package/hpkg/PackageInfoAttributeValue.h>
|
#include <package/hpkg/PackageInfoAttributeValue.h>
|
||||||
|
#include <package/hpkg/RepositoryContentHandler.h>
|
||||||
#include <package/hpkg/RepositoryReader.h>
|
#include <package/hpkg/RepositoryReader.h>
|
||||||
|
|
||||||
#include <package/PackageInfo.h>
|
#include <package/PackageInfo.h>
|
||||||
#include <package/RepositoryInfo.h>
|
#include <package/RepositoryInfo.h>
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@
|
|||||||
using namespace BPackageKit::BHPKG;
|
using namespace BPackageKit::BHPKG;
|
||||||
using namespace BPackageKit;
|
using namespace BPackageKit;
|
||||||
|
|
||||||
struct RepositoryContentListHandler : BPackageContentHandler {
|
struct RepositoryContentListHandler : BRepositoryContentHandler {
|
||||||
RepositoryContentListHandler(bool verbose)
|
RepositoryContentListHandler(bool verbose)
|
||||||
:
|
:
|
||||||
fLevel(0),
|
fLevel(0),
|
||||||
@@ -195,6 +194,26 @@ struct RepositoryContentListHandler : BPackageContentHandler {
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual status_t HandleRepositoryInfo(const BRepositoryInfo& repositoryInfo)
|
||||||
|
{
|
||||||
|
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",
|
||||||
|
BPackageInfo::kArchitectureNames[repositoryInfo.Architecture()]);
|
||||||
|
const BObjectList<BString> licenseNames = repositoryInfo.LicenseNames();
|
||||||
|
if (!licenseNames.IsEmpty()) {
|
||||||
|
printf("\tlicenses:\n");
|
||||||
|
for (int i = 0; i < licenseNames.CountItems(); ++i)
|
||||||
|
printf("\t\t%s\n", licenseNames.ItemAt(i)->String());
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void HandleErrorOccurred()
|
virtual void HandleErrorOccurred()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include <package/hpkg/ErrorOutput.h>
|
#include <package/hpkg/ErrorOutput.h>
|
||||||
#include <package/hpkg/PackageContentHandler.h>
|
#include <package/hpkg/RepositoryContentHandler.h>
|
||||||
#include <package/hpkg/RepositoryReaderImpl.h>
|
#include <package/hpkg/RepositoryReaderImpl.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ BRepositoryReader::Init(const char* fileName)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BRepositoryReader::ParseContent(BPackageContentHandler* contentHandler)
|
BRepositoryReader::ParseContent(BRepositoryContentHandler* contentHandler)
|
||||||
{
|
{
|
||||||
if (fImpl == NULL)
|
if (fImpl == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|||||||
@@ -18,9 +18,9 @@
|
|||||||
#include <ByteOrder.h>
|
#include <ByteOrder.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
#include <package/hpkg/HPKGDefsPrivate.h>
|
|
||||||
|
|
||||||
#include <package/hpkg/ErrorOutput.h>
|
#include <package/hpkg/ErrorOutput.h>
|
||||||
|
#include <package/hpkg/HPKGDefsPrivate.h>
|
||||||
|
#include <package/hpkg/RepositoryContentHandler.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPackageKit {
|
namespace BPackageKit {
|
||||||
@@ -252,11 +252,14 @@ RepositoryReaderImpl::GetRepositoryInfo(BRepositoryInfo* _repositoryInfo) const
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
RepositoryReaderImpl::ParseContent(BPackageContentHandler* contentHandler)
|
RepositoryReaderImpl::ParseContent(BRepositoryContentHandler* contentHandler)
|
||||||
{
|
{
|
||||||
AttributeHandlerContext context(ErrorOutput(), contentHandler);
|
AttributeHandlerContext context(ErrorOutput(), contentHandler);
|
||||||
PackageAttributeHandler rootAttributeHandler;
|
PackageAttributeHandler rootAttributeHandler;
|
||||||
return ParsePackageAttributesSection(&context, &rootAttributeHandler);
|
status_t result = contentHandler->HandleRepositoryInfo(fRepositoryInfo);
|
||||||
|
if (result == B_OK)
|
||||||
|
result = ParsePackageAttributesSection(&context, &rootAttributeHandler);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user