mirror of
https://review.haiku-os.org/haiku
synced 2025-01-31 18:56:49 +01:00
* 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:
parent
405318137d
commit
2b6e6760b6
@ -8,27 +8,22 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <package/hpkg/PackageContentHandler.h>
|
||||
|
||||
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
class BPackageInfo;
|
||||
class BRepositoryInfo;
|
||||
|
||||
|
||||
namespace BHPKG {
|
||||
|
||||
|
||||
class BRepositoryContentHandler {
|
||||
class BRepositoryContentHandler : public BPackageContentHandler {
|
||||
public:
|
||||
virtual ~BRepositoryContentHandler();
|
||||
|
||||
virtual status_t HandleRepositoryInfo(
|
||||
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;
|
||||
|
||||
class BErrorOutput;
|
||||
class BPackageContentHandler;
|
||||
class BRepositoryContentHandler;
|
||||
|
||||
|
||||
class BRepositoryReader {
|
||||
@ -30,7 +30,7 @@ public:
|
||||
|
||||
status_t Init(const char* fileName);
|
||||
status_t ParseContent(
|
||||
BPackageContentHandler* contentHandler);
|
||||
BRepositoryContentHandler* contentHandler);
|
||||
|
||||
private:
|
||||
RepositoryReaderImpl* fImpl;
|
||||
|
@ -16,6 +16,9 @@ namespace BPackageKit {
|
||||
namespace BHPKG {
|
||||
|
||||
|
||||
class BRepositoryContentHandler;
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
@ -33,7 +36,7 @@ public:
|
||||
BRepositoryInfo* _repositoryInfo) const;
|
||||
|
||||
status_t ParseContent(
|
||||
BPackageContentHandler* contentHandler);
|
||||
BRepositoryContentHandler* contentHandler);
|
||||
|
||||
private:
|
||||
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.
|
||||
*/
|
||||
|
||||
@ -11,10 +11,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <package/hpkg/PackageContentHandler.h>
|
||||
#include <package/hpkg/PackageInfoAttributeValue.h>
|
||||
#include <package/hpkg/RepositoryContentHandler.h>
|
||||
#include <package/hpkg/RepositoryReader.h>
|
||||
|
||||
#include <package/PackageInfo.h>
|
||||
#include <package/RepositoryInfo.h>
|
||||
|
||||
@ -25,7 +24,7 @@
|
||||
using namespace BPackageKit::BHPKG;
|
||||
using namespace BPackageKit;
|
||||
|
||||
struct RepositoryContentListHandler : BPackageContentHandler {
|
||||
struct RepositoryContentListHandler : BRepositoryContentHandler {
|
||||
RepositoryContentListHandler(bool verbose)
|
||||
:
|
||||
fLevel(0),
|
||||
@ -195,6 +194,26 @@ struct RepositoryContentListHandler : BPackageContentHandler {
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <new>
|
||||
|
||||
#include <package/hpkg/ErrorOutput.h>
|
||||
#include <package/hpkg/PackageContentHandler.h>
|
||||
#include <package/hpkg/RepositoryContentHandler.h>
|
||||
#include <package/hpkg/RepositoryReaderImpl.h>
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ BRepositoryReader::Init(const char* fileName)
|
||||
|
||||
|
||||
status_t
|
||||
BRepositoryReader::ParseContent(BPackageContentHandler* contentHandler)
|
||||
BRepositoryReader::ParseContent(BRepositoryContentHandler* contentHandler)
|
||||
{
|
||||
if (fImpl == NULL)
|
||||
return B_NO_INIT;
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include <ByteOrder.h>
|
||||
#include <Message.h>
|
||||
|
||||
#include <package/hpkg/HPKGDefsPrivate.h>
|
||||
|
||||
#include <package/hpkg/ErrorOutput.h>
|
||||
#include <package/hpkg/HPKGDefsPrivate.h>
|
||||
#include <package/hpkg/RepositoryContentHandler.h>
|
||||
|
||||
|
||||
namespace BPackageKit {
|
||||
@ -252,11 +252,14 @@ RepositoryReaderImpl::GetRepositoryInfo(BRepositoryInfo* _repositoryInfo) const
|
||||
|
||||
|
||||
status_t
|
||||
RepositoryReaderImpl::ParseContent(BPackageContentHandler* contentHandler)
|
||||
RepositoryReaderImpl::ParseContent(BRepositoryContentHandler* contentHandler)
|
||||
{
|
||||
AttributeHandlerContext context(ErrorOutput(), contentHandler);
|
||||
PackageAttributeHandler rootAttributeHandler;
|
||||
return ParsePackageAttributesSection(&context, &rootAttributeHandler);
|
||||
status_t result = contentHandler->HandleRepositoryInfo(fRepositoryInfo);
|
||||
if (result == B_OK)
|
||||
result = ParsePackageAttributesSection(&context, &rootAttributeHandler);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user