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
@@ -0,0 +1,29 @@
/*
* Copyright 2009-2013, Ingo Weinhold, [email protected].
* 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_
-1
View File
@@ -11,7 +11,6 @@ BinCommand package :
package.cpp package.cpp
PackageWriterListener.cpp PackageWriterListener.cpp
PackageWritingUtils.cpp PackageWritingUtils.cpp
StandardErrorOutput.cpp
: :
package be package be
-16
View File
@@ -1,16 +0,0 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* 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);
}
-21
View File
@@ -1,21 +0,0 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* 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
-1
View File
@@ -22,7 +22,6 @@
#include "package.h" #include "package.h"
#include "PackageWriterListener.h" #include "PackageWriterListener.h"
#include "PackageWritingUtils.h" #include "PackageWritingUtils.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG; using namespace BPackageKit::BHPKG;
-1
View File
@@ -22,7 +22,6 @@
#include "package.h" #include "package.h"
#include "PackageWriterListener.h" #include "PackageWriterListener.h"
#include "PackageWritingUtils.h" #include "PackageWritingUtils.h"
#include "StandardErrorOutput.h"
using BPackageKit::BHPKG::BPackageWriterListener; using BPackageKit::BHPKG::BPackageWriterListener;
+2 -2
View File
@@ -17,9 +17,9 @@
#include <package/hpkg/PackageEntry.h> #include <package/hpkg/PackageEntry.h>
#include <package/hpkg/PackageEntryAttribute.h> #include <package/hpkg/PackageEntryAttribute.h>
#include <package/hpkg/PackageReader.h> #include <package/hpkg/PackageReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include "package.h" #include "package.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG; using namespace BPackageKit::BHPKG;
@@ -182,7 +182,7 @@ command_dump(int argc, const char* const* argv)
const char* packageFileName = argv[optind++]; const char* packageFileName = argv[optind++];
// open package // open package
StandardErrorOutput errorOutput; BStandardErrorOutput errorOutput;
BPackageReader packageReader(&errorOutput); BPackageReader packageReader(&errorOutput);
status_t error = packageReader.Init(packageFileName); status_t error = packageReader.Init(packageFileName);
if (error != B_OK) if (error != B_OK)
+2 -2
View File
@@ -30,10 +30,10 @@
#include <package/hpkg/PackageEntry.h> #include <package/hpkg/PackageEntry.h>
#include <package/hpkg/PackageEntryAttribute.h> #include <package/hpkg/PackageEntryAttribute.h>
#include <package/hpkg/PackageReader.h> #include <package/hpkg/PackageReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include <package/BlockBufferCacheNoLock.h> #include <package/BlockBufferCacheNoLock.h>
#include "package.h" #include "package.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG; using namespace BPackageKit::BHPKG;
@@ -688,7 +688,7 @@ command_extract(int argc, const char* const* argv)
const char* packageFileName = argv[optind++]; const char* packageFileName = argv[optind++];
// open package // open package
StandardErrorOutput errorOutput; BStandardErrorOutput errorOutput;
BPackageReader packageReader(&errorOutput); BPackageReader packageReader(&errorOutput);
status_t error = packageReader.Init(packageFileName); status_t error = packageReader.Init(packageFileName);
if (error != B_OK) if (error != B_OK)
+2 -2
View File
@@ -17,11 +17,11 @@
#include <package/hpkg/PackageEntryAttribute.h> #include <package/hpkg/PackageEntryAttribute.h>
#include <package/hpkg/PackageInfoAttributeValue.h> #include <package/hpkg/PackageInfoAttributeValue.h>
#include <package/hpkg/PackageReader.h> #include <package/hpkg/PackageReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include <package/PackageInfo.h> #include <package/PackageInfo.h>
#include "package.h" #include "package.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG; using namespace BPackageKit::BHPKG;
@@ -320,7 +320,7 @@ command_list(int argc, const char* const* argv)
const char* packageFileName = argv[optind++]; const char* packageFileName = argv[optind++];
// open package // open package
StandardErrorOutput errorOutput; BStandardErrorOutput errorOutput;
BPackageReader packageReader(&errorOutput); BPackageReader packageReader(&errorOutput);
status_t error = packageReader.Init(packageFileName); status_t error = packageReader.Init(packageFileName);
if (error != B_OK) if (error != B_OK)
-3
View File
@@ -5,13 +5,10 @@ UsePrivateHeaders kernel shared ;
DEFINES += B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT ; DEFINES += B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT ;
# TODO: Remove when it is complete! # TODO: Remove when it is complete!
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src bin package ] ;
BinCommand package_repo : BinCommand package_repo :
command_create.cpp command_create.cpp
command_list.cpp command_list.cpp
package_repo.cpp package_repo.cpp
StandardErrorOutput.cpp
: :
package be package be
$(TARGET_LIBSUPC++) $(TARGET_LIBSUPC++)
+1 -2
View File
@@ -19,8 +19,7 @@
#include <package/PackageInfo.h> #include <package/PackageInfo.h>
#include <package/RepositoryInfo.h> #include <package/RepositoryInfo.h>
#include "package.h" #include "package_repo.h"
#include "StandardErrorOutput.h"
using BPackageKit::BHPKG::BRepositoryWriterListener; using BPackageKit::BHPKG::BRepositoryWriterListener;
+3 -3
View File
@@ -14,11 +14,11 @@
#include <package/hpkg/PackageInfoAttributeValue.h> #include <package/hpkg/PackageInfoAttributeValue.h>
#include <package/hpkg/RepositoryContentHandler.h> #include <package/hpkg/RepositoryContentHandler.h>
#include <package/hpkg/RepositoryReader.h> #include <package/hpkg/RepositoryReader.h>
#include <package/hpkg/StandardErrorOutput.h>
#include <package/PackageInfo.h> #include <package/PackageInfo.h>
#include <package/RepositoryInfo.h> #include <package/RepositoryInfo.h>
#include "package.h" #include "package_repo.h"
#include "StandardErrorOutput.h"
using namespace BPackageKit::BHPKG; using namespace BPackageKit::BHPKG;
@@ -287,7 +287,7 @@ command_list(int argc, const char* const* argv)
const char* repositoryFileName = argv[optind++]; const char* repositoryFileName = argv[optind++];
// open repository // open repository
StandardErrorOutput errorOutput; BStandardErrorOutput errorOutput;
BRepositoryReader repositoryReader(&errorOutput); BRepositoryReader repositoryReader(&errorOutput);
status_t error = repositoryReader.Init(repositoryFileName); status_t error = repositoryReader.Init(repositoryFileName);
if (error != B_OK) if (error != B_OK)
+4
View File
@@ -71,6 +71,10 @@ SharedLibrary libpackage.so
ValidateChecksumJob.cpp ValidateChecksumJob.cpp
$(HPKG_SOURCES) $(HPKG_SOURCES)
# hpkg, but only libpackage
StandardErrorOutput.cpp
: :
libshared.a be z $(TARGET_LIBSTDC++) libshared.a be z $(TARGET_LIBSTDC++)
; ;
@@ -0,0 +1,26 @@
/*
* Copyright 2009-2013, Ingo Weinhold, [email protected].
* 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