<build>package: attribute iteration, license dir

PackageWriterImpl:
* Iterate through attributes using fs_read_attr_dir() instead of
  readdir(). Makes it work correctly on the build platform.
* On the build platform look up the system licenses in their source
  directory rather than based on find_directory().
This commit is contained in:
Ingo Weinhold
2011-07-17 16:54:11 +02:00
parent abd5edcb5f
commit e272fb5dec
2 changed files with 17 additions and 2 deletions
+11
View File
@@ -7,6 +7,17 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ;
USES_BE_API on libpackage_build.so = true ;
{
# The package writer needs to know where the license files are located.
local dataDir = [ FDirName $(HAIKU_TOP) data system data ] ;
local defines = [ FDefines
HAIKU_BUILD_SYSTEM_DATA_DIRECTORY="\\\"$(dataDir)\\\""
] ;
ObjectC++Flags PackageWriterImpl.cpp : $(defines) ;
}
HPKG_SOURCES =
BlockBufferCache.cpp
BlockBufferCacheImpl.cpp
+6 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2009-2011, Ingo Weinhold, [email protected].
* Copyright 2011, Oliver Tappe <[email protected]>
* Distributed under the terms of the MIT License.
*/
@@ -336,7 +336,11 @@ PackageWriterImpl::_CheckLicenses()
{
BPath systemLicensePath;
status_t result
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
= find_directory(B_SYSTEM_DATA_DIRECTORY, &systemLicensePath);
#else
= systemLicensePath.SetTo(HAIKU_BUILD_SYSTEM_DATA_DIRECTORY);
#endif
if (result != B_OK) {
fListener->PrintError("unable to find system data path!\n");
return result;
@@ -706,7 +710,7 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
if (DIR* attrDir = fs_fopen_attr_dir(fd)) {
CObjectDeleter<DIR, int> attrDirCloser(attrDir, fs_close_attr_dir);
while (dirent* entry = readdir(attrDir)) {
while (dirent* entry = fs_read_attr_dir(attrDir)) {
attr_info attrInfo;
if (fs_stat_attr(fd, entry->d_name, &attrInfo) < 0) {
fListener->PrintError(