* implemented checking of licenses, such that it is no longer possible

to create a package that refers to a license that is not a system
  license or contained in the package
* added package-info flags (currently only approve_license and 
  system_package)
* adjusted package-reader/writer and pkgman accordingly

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40393 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2011-02-08 19:50:36 +00:00
parent 1b4f0abf9d
commit d77c6cd26a
13 changed files with 207 additions and 51 deletions
+23
View File
@@ -0,0 +1,23 @@
/*
* Copyright 2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__PACKAGE_FLAGS_H_
#define _PACKAGE__PACKAGE_FLAGS_H_
namespace BPackageKit {
enum {
B_PACKAGE_FLAG_APPROVE_LICENSE = 1ul << 0,
// will trigger display and approval of license before installation
B_PACKAGE_FLAG_SYSTEM_PACKAGE = 1ul << 1,
// marks package as system package (i.e. belonging into /boot/system)
};
} // namespace BPackageKit
#endif // _PACKAGE__PACKAGE_FLAGS_H_
+7
View File
@@ -10,6 +10,7 @@
#include <String.h>
#include <package/PackageArchitecture.h>
#include <package/PackageFlags.h>
#include <package/PackageInfoAttributes.h>
#include <package/PackageResolvable.h>
#include <package/PackageResolvableExpression.h>
@@ -55,6 +56,8 @@ public:
const BString& Vendor() const;
const BString& Packager() const;
uint32 Flags() const;
BPackageArchitecture Architecture() const;
const BPackageVersion& Version() const;
@@ -79,6 +82,8 @@ public:
void SetVendor(const BString& vendor);
void SetPackager(const BString& packager);
void SetFlags(uint32 flags);
void SetArchitecture(
BPackageArchitecture architecture);
@@ -128,6 +133,8 @@ private:
BString fVendor;
BString fPackager;
uint32 fFlags;
BPackageArchitecture fArchitecture;
BPackageVersion fVersion;
@@ -33,6 +33,7 @@ enum BPackageInfoAttributeIndex {
// contains a patch for
B_PACKAGE_INFO_REPLACES, // list of resolvables that this package
// will replace (upon update)
B_PACKAGE_INFO_FLAGS,
//
B_PACKAGE_INFO_ENUM_COUNT,
};
+1 -2
View File
@@ -34,8 +34,7 @@ public:
uint64 uncompressedStringsSize,
uint64 uncompressedMainSize,
uint64 uncompressedTOCSize) = 0;
virtual void OnPackageAttributesSizeInfo(
uint32 stringCount,
virtual void OnPackageAttributesSizeInfo(uint32 stringCount,
uint32 uncompressedSize) = 0;
virtual void OnPackageSizeInfo(uint32 headerSize,
uint64 heapSize, uint64 tocSize,
@@ -61,6 +61,8 @@ private:
const char* name, size_t nameLength,
bool isImplicit);
status_t _CheckLicenses();
void _WriteTOC(hpkg_header& header);
int32 _WriteTOCSections(uint64& _attributeTypesSize,
uint64& _stringsSize, uint64& _mainSize);
@@ -114,6 +116,8 @@ private:
StringCache fStringCache;
AttributeTypeTable* fAttributeTypes;
BPackageInfo fPackageInfo;
};
@@ -129,6 +129,7 @@ enum HPKGPackageAttributeID {
HPKG_PACKAGE_ATTRIBUTE_DESCRIPTION,
HPKG_PACKAGE_ATTRIBUTE_VENDOR,
HPKG_PACKAGE_ATTRIBUTE_PACKAGER,
HPKG_PACKAGE_ATTRIBUTE_FLAGS,
HPKG_PACKAGE_ATTRIBUTE_ARCHITECTURE,
HPKG_PACKAGE_ATTRIBUTE_VERSION_MAJOR,
HPKG_PACKAGE_ATTRIBUTE_VERSION_MINOR,