package_repo: Removes dependency to package

* Move StandardErrorOutput to libpackage and into proper namespace to
  avoid "package_repo" having to reuse the "package" source file.
* package_repo: Fix incorrect includes of "package.h".
This commit is contained in:
Ingo Weinhold 2013-04-01 23:06:33 +00:00
parent 479ca8169c
commit 0816749e41
14 changed files with 69 additions and 54 deletions

View File

@ -0,0 +1,29 @@
/*
* Copyright 2009-2013, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__STANDARD_ERROR_OUTPUT_H_
#define _PACKAGE__HPKG__STANDARD_ERROR_OUTPUT_H_
#include <package/hpkg/ErrorOutput.h>
namespace BPackageKit {
namespace BHPKG {
class BStandardErrorOutput : public BErrorOutput {
public:
virtual void PrintErrorVarArgs(const char* format,
va_list args);
};
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__STANDARD_ERROR_OUTPUT_H_

View File

@ -11,7 +11,6 @@ BinCommand package :
package.cpp
PackageWriterListener.cpp
PackageWritingUtils.cpp
StandardErrorOutput.cpp
:
package be

View File

@ -1,16 +0,0 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "StandardErrorOutput.h"
#include <stdio.h>
void
StandardErrorOutput::PrintErrorVarArgs(const char* format, va_list args)
{
vfprintf(stderr, format, args);
}

View File

@ -1,21 +0,0 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef STANDARD_ERROR_OUTPUT_H
#define STANDARD_ERROR_OUTPUT_H
#include <package/hpkg/ErrorOutput.h>
using BPackageKit::BHPKG::BErrorOutput;
class StandardErrorOutput : public BErrorOutput {
virtual void PrintErrorVarArgs(const char* format,
va_list args);
};
#endif // STANDARD_ERROR_OUTPUT_H

View File

@ -22,7 +22,6 @@
#include "package.h"
#include "PackageWriterListener.h"
#include "PackageWritingUtils.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG;

View File

@ -22,7 +22,6 @@
#include "package.h"
#include "PackageWriterListener.h"
#include "PackageWritingUtils.h"
#include "StandardErrorOutput.h"
using BPackageKit::BHPKG::BPackageWriterListener;

View File

@ -17,9 +17,9 @@
#include <package/hpkg/PackageEntry.h>
#include <package/hpkg/PackageEntryAttribute.h>
#include <package/hpkg/PackageReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include "package.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG;
@ -182,7 +182,7 @@ command_dump(int argc, const char* const* argv)
const char* packageFileName = argv[optind++];
// open package
StandardErrorOutput errorOutput;
BStandardErrorOutput errorOutput;
BPackageReader packageReader(&errorOutput);
status_t error = packageReader.Init(packageFileName);
if (error != B_OK)

View File

@ -30,10 +30,10 @@
#include <package/hpkg/PackageEntry.h>
#include <package/hpkg/PackageEntryAttribute.h>
#include <package/hpkg/PackageReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include <package/BlockBufferCacheNoLock.h>
#include "package.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG;
@ -688,7 +688,7 @@ command_extract(int argc, const char* const* argv)
const char* packageFileName = argv[optind++];
// open package
StandardErrorOutput errorOutput;
BStandardErrorOutput errorOutput;
BPackageReader packageReader(&errorOutput);
status_t error = packageReader.Init(packageFileName);
if (error != B_OK)

View File

@ -17,11 +17,11 @@
#include <package/hpkg/PackageEntryAttribute.h>
#include <package/hpkg/PackageInfoAttributeValue.h>
#include <package/hpkg/PackageReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include <package/PackageInfo.h>
#include "package.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG;
@ -320,7 +320,7 @@ command_list(int argc, const char* const* argv)
const char* packageFileName = argv[optind++];
// open package
StandardErrorOutput errorOutput;
BStandardErrorOutput errorOutput;
BPackageReader packageReader(&errorOutput);
status_t error = packageReader.Init(packageFileName);
if (error != B_OK)

View File

@ -5,13 +5,10 @@ UsePrivateHeaders kernel shared ;
DEFINES += B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT ;
# TODO: Remove when it is complete!
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src bin package ] ;
BinCommand package_repo :
command_create.cpp
command_list.cpp
package_repo.cpp
StandardErrorOutput.cpp
:
package be
$(TARGET_LIBSUPC++)

View File

@ -19,8 +19,7 @@
#include <package/PackageInfo.h>
#include <package/RepositoryInfo.h>
#include "package.h"
#include "StandardErrorOutput.h"
#include "package_repo.h"
using BPackageKit::BHPKG::BRepositoryWriterListener;

View File

@ -14,11 +14,11 @@
#include <package/hpkg/PackageInfoAttributeValue.h>
#include <package/hpkg/RepositoryContentHandler.h>
#include <package/hpkg/RepositoryReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include <package/PackageInfo.h>
#include <package/RepositoryInfo.h>
#include "package.h"
#include "StandardErrorOutput.h"
#include "package_repo.h"
using namespace BPackageKit::BHPKG;
@ -287,7 +287,7 @@ command_list(int argc, const char* const* argv)
const char* repositoryFileName = argv[optind++];
// open repository
StandardErrorOutput errorOutput;
BStandardErrorOutput errorOutput;
BRepositoryReader repositoryReader(&errorOutput);
status_t error = repositoryReader.Init(repositoryFileName);
if (error != B_OK)

View File

@ -71,6 +71,10 @@ SharedLibrary libpackage.so
ValidateChecksumJob.cpp
$(HPKG_SOURCES)
# hpkg, but only libpackage
StandardErrorOutput.cpp
:
libshared.a be z $(TARGET_LIBSTDC++)
;

View File

@ -0,0 +1,26 @@
/*
* Copyright 2009-2013, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include <package/hpkg/StandardErrorOutput.h>
#include <stdio.h>
namespace BPackageKit {
namespace BHPKG {
void
BStandardErrorOutput::PrintErrorVarArgs(const char* format, va_list args)
{
vfprintf(stderr, format, args);
}
} // namespace BHPKG
} // namespace BPackageKit