Commit e7004659 authored by Julian Andres Klode's avatar Julian Andres Klode Committed by Lorenzo "Palinuro" Faletra

Import Debian version 2.0.2

apt (2.0.2) unstable; urgency=medium

  [ Boyuan Yang ]
  * Simplified Chinese program translation update (Closes: #955023)

  [ Frans Spiesschaert ]
  * Dutch program translation update (Closes: #955505)

  [ Marco Ippolito ]
  * Fix gramma in apt(8): "by append(+ing) a" (Closes: #955412)

  [ Chris Leick ]
  * German manpage translation update
  * Fix "string match{ing,es}" and whitespace typo in apt-patterns(7)

  [ Julian Andres Klode ]
  * test/integration/apt.pem: Regenerate with SHA2 hashes to make the
    test work with stricter gnutls in Ubuntu which rejects SHA1
  * ubuntu: http: Add non-interactive to user agent if run by systemd
    (LP: #1825000)

apt (2.0.1) unstable; urgency=medium

  [ David Kalnischkies ]
  * Don't crash pattern matching sections if pkg has no section
  * Parse last line in deb file correctly by adding a newline

  [ Julian Andres Klode ]
  * apt-helper: Add analyze-pattern helper
  * Add color highlighting to E:/W:/N: prefixes (Closes: #953527)

  [ Алексей Шилин ]
  * Russian program translation update (Closes: #953804)

apt (2.0.0) unstable; urgency=medium

  * Upload to unstable - Happy APT 2.0 day!
  * GetLock: No strerror if it's just another process holding the lock
  * Show absolute time while waiting for lock instead of %, rework message

apt (1.9.12) experimental; urgency=medium

  * pkgcache: Add operator bool() to map_pointer
  * (temporarily) unhide pkgDPkgPM again to have python-apt compile

apt (1.9.11) experimental; urgency=medium

  [ Tomáš Janoušek ]
  * bash completion: Add autopurge command

  [ Tris Emmy Wilson ]
  * apt-mark: don't lie about successful marks

  [ Julian Andres Klode ]
  * apt(8): Wait for lock (Closes: #754103)
  * policy: Implement pinning by source package (Closes: #166032)
  * Initialize libgcrypt on first use (Closes: #949074)
  * Fix various compiler warnings
  * Bump ABI to 6.0; update symbols file; cleanup ABI:
    - Merge various function overloads together
    - Make stuff that should be virtual virtual
    - Default to hidden visibility
  * Code removals:
    - Use a 32-bit djb VersionHash instead of CRC-16
    - Remove CRC-16 implementation
  * Hardening:
    - tagfile: Check if memchr() returned null before using
    - tagfile: Check out-of-bounds access to Tags vector
  * Cache improvements:
    - Type safe cache: Replace map_pointer_t with map_pointer<T>
    - Extensibility: Add d-pointers to groups, packages, versions, and files
    - Prepare for package hashtable removal: Swap locations of hashtables

  [ Nis Martensen ]
  * apt-pkg/srcrecords.cc: 'source' means 'deb-src' in error message

  [ David Kalnischkies ]
  * Parse records including empty tag names correctly

apt (1.9.10) experimental; urgency=medium

  [ David Kalnischkies ]
  * Fix remaining usec vs sec time-delta calculation typos.
    Thanks to Trent W. Buck for initial patch (Closes: #950776)

  [ Julian Andres Klode ]
  * seccomp: Allow time64 variants (>402,<415) of allowed syscalls
    (Closes: #951012)
  * debian/control: Bump libseccomp-dev Build-Depends to >= 2.4.2
  * seccomp: Allow recvmmsg_time64() and futex_time64()
  * policy: Add SetPriority() methods
  * Revert "Add a Packages-Require-Authorization Release file field"

  [ Michael Vogt ]
  * doc: remove "WIP" from apt.8.xml

apt (1.9.9) experimental; urgency=medium

  * Widen regular expressions for versioned kernel packages (LP: #1607845)
  * Implement short patterns (patterns starting with ~)

apt (1.9.8) experimental; urgency=medium

  * pkgcache.cc: Mix PACKAGE_VERSION into the cache hash
  * mmap: Do not look for empty pool unless we need to
  * apt-verbatim.ent: Update ubuntu-codename from disco to focal
  * NewGroup: Create GrpIterator after allocation (fix segfault)

apt (1.9.7) experimental; urgency=medium

  * Trim trailing whitespace (thanks lintian-brush)
  * NewProvidesAllArch: Check if group is empty before using it.
    This caused automake-1.16 to not be provided by automake anymore,
    because apt wanted to add provides to packages in an empty automake-1.16
    group. LP: #1859952
  * Fix debian-rules-uses-deprecated-systemd-override.
    We accidentally managed to restart apt-daily{,-upgrade}.service
    again because our dh_systemd_start override was being ignored
    since we switched to debhelper 12. Override dh_installsystemd
    instead.

apt (1.9.6) experimental; urgency=medium

  [ Julian Andres Klode ]
  * gitlab-ci: Do not do coverage
  * gitlab-ci: Use ccache
  * satisfy: Fix segmentation fault when called with empty argument
  * Add support for GTest 1.9, do not fail silently if its missing
  * gtests: Fix netrc parser test regression from https-only changes
  * Macro cleanup:
    - Avoid #define _error, use anonymous C++ struct instead (Closes: #948338)
    - Rename _count() macro to APT_ARRAY_SIZE()
    - Remove various unused macros like MAX/MIN/ABS/APT_CONST
    - Only define likely/unlikely if APT_COMPILING_APT set
  * Performance: Avoid extra out-of-cache hash table deduplication for
    package names, this saved about 10-16% on gencaches in memory
  * acquire: Move queue startup after calling log's Start(), fixes abort()
    calls in python-apt
  * hashes: Use Libgcrypt for hashing purposes
    - Raise buffer size for Hashes::AddFD() from 4 KiB to 64 KiB
    - Convert users of {MD5,SHA1,SHA256,SHA512}Summation to use Hashes
    - Deprecate the Summation classes and mark them for removal
    - Remove includes of (md5|sha1|sha2).h headers
  * netrc: Add warning when ignoring entries for unencrypted protocols
  * apt(8): Disable regular expressions and fnmatch

  [ David Kalnischkies ]
  * Drop g++ build-dependency to help crossbuilding (Closes: #948201)

  [ Denis Mosolov ]
  * Fix typo in README.md

apt (1.9.5) experimental; urgency=medium

  [ Julian Andres Klode ]
  * Parse 'show' arguments for the 'info' alias as well (LP: #1843812)
  * patterns: Add base class for regular expression matching
  * patterns: Add ?version
  * patterns: Add ?source-name and ?source-version
  * patterns: Add ?archive
  * patterns: Add ?origin
  * patterns: Add ?any-version
  * patterns: Implement ?narrow(...), as ?any-version(?and(...))
  * patterns: Add ?all-versions
  * patterns: Add ?section
  * netrc: Restrict auth.conf entries to https by default (Closes: #945911)

  [ Anatoly Borodin ]
  * README.md: fix dead anonscm link

  [ Алексей Шилин ]
  * Search in all available description translations (Closes: #490000)
  * strutl: Add APT::String::DisplayLength() function
  * Fix progress bar width for multibyte charsets

  [ Chris Leick ]
  * German manpage translation update

  [ David Kalnischkies ]
  * Use correct filename on IMS-hit reverify for indices
  * Remove failed trusted signature instead of index on IMS hit

  [ Anthony Papillon ]
  * Fix a mistake in man french translation

apt (1.9.4) experimental; urgency=medium

  * CMake: Pass -Werror=return-type to gcc
  * CMake: Produce a fatal error if triehash could not be found
  * apt.systemd.daily: Do not numerically check if intervals equal 0
    (LP: #1840995)
  * srvrec: Use re-entrant resolver functions
  * Pass --abort-after=1 to dpkg when using --force-depends (Closes: #935910)
    (LP: #1844634)
  * Fix use of GTest to adjust for GTest 1.9

apt (1.9.3) experimental; urgency=medium

  * Fix segfault in pkgAcquire::Enqueue() with Acquire::Queue-Mode=access
    (LP: #1839714)
  * test: Use valgrind to ensure Acquire::Queue-Mode=access does not crash
  * Add initial support for package patterns (patterns on versions WIP)

apt (1.9.2) experimental; urgency=medium

  [ Julian Andres Klode ]
  * Improve locking messaging - pid and name, "do not remove lock file"

  [ Lynn Cyrin ]
  * Change a pronoun in the readme from `he` to `they`

  [ David Kalnischkies ]
  * Distribute host-less work based on backlog of the queues
  * Show details about the package with bad Provides
  * Apply various suggestions by cppcheck

apt (1.9.1) experimental; urgency=medium

  * RFC1123StrToTime: Accept const std::string& as first argument
  * Fix pkg-config-test autopkgtest

apt (1.9.0) experimental; urgency=medium

  [ Julian Andres Klode ]
  * CMakeLists.txt: Bump C++ standard version to C++14
  * debian: Update to debhelper-compat (= 12)
  * debian/rules: Do not use dh_install --list-missing (dh 12 porting)
  * Remove all the deprecated bits, merge various function prototypes together
  * prepare-release: Add merge-translations command
  * Use system-provided triehash
  * CI: Use unstable for now, as we need triehash package
  * Tighten dependencies from apt and apt-utils on libs
  * Add test case for local-only packages pinned to never
  * acq: worker: Move CurrentSize, TotalSize, ResumePoint to CurrentItem
  * apt-helper: Support multiple hashes for a file
  * Add 'explicit' to most single argument constructors
  * Get rid of pkgExtract and pkgFLCache
  * Merge libapt-inst into libapt-pkg
  * Use debDebFile to get control file instead of dpkg-deb
  * prepare-release: Add bump-abi command
  * Change soname to libapt-pkg.so.5.90
  * CMake: Enforce "override" use on overridden methods
  * debmetaindex: Use isspace_ascii() variant to normalize Signed-By
  * README.md: Quote -j <count> as code with backticks
  * apt-mark: Add hidden showheld alias for showhold
  * Mnor wording improvements in documentation
  * Make APT::StringView public, replace std::string with it in various places
  * Introduce apt satisfy and apt-get satisfy (Closes: #275379)
  * Run unifdef -DAPT_{8,9,10,15}_CLEANER_HEADERS
  * Adjust code for missing includes, and using std::string
  * Bump cache MajorVersion to 16

  [ Corentin Noël ]
  * Add pkg-config files for the apt-pkg and apt-inst libraries
    (Closes: #439121)

  [ Simon McVittie ]
  * vendor/getinfo: Iterate through vendors in lexicographic order
    (Closes: #924662)
  * vendor/getinfo: Don't assume that Ubuntu is the last vendor
    (Closes: #924662)

  [ Martin Michlmayr ]
  * Perform minor copy-editing on the docs

  [ Ivan Krylov ]
  * Mark apt-transport-https as M-A:foreign (Closes: #905141)

  [ David Kalnischkies ]
  * Don't limit cpu-limited queues to at most 10

  [ Stephen Kitt ]
  * apt-cache: only show solutions if displayed

  [ Brian Murray ]
  * Do not include squashfs file systems in df output. (LP: #1756595)

  [ Simon Körner ]
  * http: Fix Host header in proxied https connections
parent b44474d3
Pipeline #317 failed with stages
in 47 minutes and 9 seconds
include: https://nest.parrotsec.org/parrot-organization/ci/raw/master/deb-build.yml
image: debian:unstable
variables:
DEBIAN_FRONTEND: noninteractive
CCACHE_DIR: $CI_PROJECT_DIR/.ccache
CCACHE_BASEDIR: $CI_PROJECT_DIR
cache:
paths:
- .ccache
test as root:
stage: test
script:
- adduser --home /home/travis travis --quiet --disabled-login --gecos "" --uid 1000
- rm -f /etc/dpkg/dpkg.cfg.d/excludes
- apt-get update
- apt-get install -qq build-essential expect sudo ccache
- chmod -R o+rwX $PWD
- ./prepare-release travis-ci
- sudo -u travis mkdir -p build .ccache
- sudo -u travis env -C build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja ..
- sudo -u travis --preserve-env=CCACHE_DIR,CCACHE_BASEDIR ninja -C build
- CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
- unbuffer ./test/integration/run-tests -q -j 4
test as user:
stage: test
script:
- adduser --home /home/travis travis --quiet --disabled-login --gecos "" --uid 1000
- rm -f /etc/dpkg/dpkg.cfg.d/excludes
- apt-get update
- apt-get install -qq build-essential expect sudo ccache
- chmod 755 /root
- chmod -R o+rwX $PWD
- ./prepare-release travis-ci
- sudo -u travis mkdir -p build .ccache
- sudo -u travis env -C build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja ..
- sudo -u travis --preserve-env=CCACHE_DIR,CCACHE_BASEDIR ninja -C build
- sudo -u travis CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
- sudo -u travis unbuffer ./test/integration/run-tests -q -j 4
# - Try to find GCRYPT
# Once done, this will define
#
# GCRYPT_FOUND - system has GCRYPT
# GCRYPT_INCLUDE_DIRS - the GCRYPT include directories
# GCRYPT_LIBRARIES - the GCRYPT library
find_package(PkgConfig)
pkg_check_modules(GCRYPT_PKGCONF libgcrypt)
find_path(GCRYPT_INCLUDE_DIRS
NAMES gcrypt.h
PATHS ${GCRYPT_PKGCONF_INCLUDE_DIRS}
)
find_library(GCRYPT_LIBRARIES
NAMES gcrypt
PATHS ${GCRYPT_PKGCONF_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GCRYPT DEFAULT_MSG GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES)
mark_as_advanced(GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES)
......@@ -64,6 +64,9 @@
/* The mail address to reach upstream */
#define PACKAGE_MAIL "${PACKAGE_MAIL}"
/* Guard for code that should only be emitted when compiling apt */
#define APT_COMPILING_APT
/* Various directories */
#cmakedefine CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_FULL_BINDIR}"
#cmakedefine STATE_DIR "${STATE_DIR}"
......@@ -81,10 +84,5 @@
#cmakedefine HAVE_FMV_SSE42_AND_CRC32
#cmakedefine HAVE_FMV_SSE42_AND_CRC32DI
#define APT_8_CLEANER_HEADERS
#define APT_9_CLEANER_HEADERS
#define APT_10_CLEANER_HEADERS
#define APT_15_CLEANER_HEADERS
/* unrolling is faster combined with an optimizing compiler */
#define SHA2_UNROLL_TRANSFORM
......@@ -11,6 +11,7 @@ include_directories(${PROJECT_BINARY_DIR}/include)
enable_testing()
option(WITH_DOC "Build documentation." ON)
option(WITH_TESTS "Build tests" ON)
option(USE_NLS "Localisation support." ON)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake")
......@@ -38,6 +39,12 @@ find_package(Iconv REQUIRED)
find_package(Perl REQUIRED)
find_program(TRIEHASH_EXECUTABLE NAMES triehash)
if (NOT TRIEHASH_EXECUTABLE)
message(FATAL_ERROR "Could not find triehash executable")
endif()
if(USE_NLS)
find_package(Intl REQUIRED)
link_libraries(${Intl_LIBRARIES})
......@@ -50,7 +57,7 @@ add_definitions(${LFS_DEFINITIONS})
link_libraries(${LFS_LIBRARIES})
# Set compiler flags
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
......@@ -69,7 +76,9 @@ add_optional_compile_options(Wnoexcept)
add_optional_compile_options(Wsign-promo)
add_optional_compile_options(Wundef)
add_optional_compile_options(Wdouble-promotion)
add_optional_compile_options(Wsuggest-override)
add_optional_compile_options(Werror=suggest-override)
add_optional_compile_options(Werror=return-type)
# apt-ftparchive dependencies
find_package(BerkeleyDB REQUIRED)
if (BERKELEY_DB_FOUND)
......@@ -125,6 +134,8 @@ if (SECCOMP_FOUND)
set(HAVE_SECCOMP 1)
endif()
find_package(Gcrypt REQUIRED)
# Mount()ing and stat()ing and friends
check_symbol_exists(statfs sys/vfs.h HAVE_VFS_H)
check_include_files(sys/params.h HAVE_PARAMS_H)
......@@ -178,7 +189,7 @@ if (NOT HAVE_SIGHANDLER_T)
endif()
# Handle resolving
check_function_exists(res_init HAVE_LIBC_RESOLV)
check_function_exists(res_ninit HAVE_LIBC_RESOLV)
if(HAVE_LIBC_RESOLV)
set(RESOLV_LIBRARIES)
else()
......@@ -193,7 +204,8 @@ check_cxx_target(HAVE_FMV_SSE42_AND_CRC32DI "sse4.2" "__builtin_ia32_crc32di(0,
# Configure some variables like package, version and architecture.
set(PACKAGE ${PROJECT_NAME})
set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>")
set(PACKAGE_VERSION "1.8.2")
set(PACKAGE_VERSION "2.0.2")
string(REGEX MATCH "^[0-9.]+" PROJECT_VERSION ${PACKAGE_VERSION})
if (NOT DEFINED DPKG_DATADIR)
execute_process(COMMAND ${PERL_EXECUTABLE} -MDpkg -e "print $Dpkg::DATADIR;"
......@@ -229,7 +241,6 @@ configure_file(CMake/apti18n.h.in ${PROJECT_BINARY_DIR}/include/apti18n.h)
add_subdirectory(vendor)
add_subdirectory(apt-pkg)
add_subdirectory(apt-private)
add_subdirectory(apt-inst)
add_subdirectory(cmdline)
add_subdirectory(completions)
add_subdirectory(doc)
......
FROM debian:buster
FROM debian:unstable
COPY . /tmp
WORKDIR /tmp
RUN sed -i s#://deb.debian.org#://cdn-fastly.deb.debian.org# /etc/apt/sources.list \
......
This diff is collapsed.
......@@ -8,5 +8,4 @@
<libs>
@build_path@/apt-pkg/
@build_path@/apt-inst/
</libs>
# Include apt-pkg directly, as some files have #include <system.h>
include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
# Set the version of the library
set(MAJOR 2.0)
set(MINOR 0)
set(APT_INST_MAJOR ${MAJOR} PARENT_SCOPE)
# Definition of the C++ files used to build the library - note that this
# is expanded at CMake time, so you have to rerun cmake if you add or remove
# a file (you can just run cmake . in the build directory)
file(GLOB_RECURSE library "*.cc")
file(GLOB_RECURSE headers "*.h")
# Create a library using the C++ files
add_library(apt-inst SHARED ${library})
# Link the library and set the SONAME
target_link_libraries(apt-inst PUBLIC apt-pkg ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(apt-inst PRIVATE ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(apt-inst PROPERTIES VERSION ${MAJOR}.${MINOR})
set_target_properties(apt-inst PROPERTIES SOVERSION ${MAJOR})
add_version_script(apt-inst)
# Install the library and the headers
install(TARGETS apt-inst LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/apt-pkg)
flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}")
- Replacing directories with files
dpkg permits this with the weak condition that the directory is owned only
by the package. APT requires that the directory have no files that are not
owned by the package. Replaces are specifically not checked to prevent
file list corruption.
This diff is collapsed.
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
/* ######################################################################
Archive Extraction Directory Stream
This Directory Stream implements extraction of an archive into the
filesystem. It makes the choices on what files should be unpacked and
replaces as well as guiding the actual unpacking.
When the unpacking sequence is completed one of the two functions,
Finished or Aborted must be called.
##################################################################### */
/*}}}*/
#ifndef PKGLIB_EXTRACT_H
#define PKGLIB_EXTRACT_H
#include <apt-pkg/dirstream.h>
#include <apt-pkg/filelist.h>
#include <apt-pkg/pkgcache.h>
#include <string>
class pkgExtract : public pkgDirStream
{
pkgFLCache &FLCache;
pkgCache::VerIterator Ver;
pkgFLCache::PkgIterator FLPkg;
char FileName[1024];
bool Debug;
bool HandleOverwrites(pkgFLCache::NodeIterator Nde,
bool DiverCheck = false);
bool CheckDirReplace(std::string Dir,unsigned int Depth = 0);
public:
virtual bool DoItem(Item &Itm,int &Fd) APT_OVERRIDE;
virtual bool Fail(Item &Itm,int Fd) APT_OVERRIDE;
virtual bool FinishedFile(Item &Itm,int Fd) APT_OVERRIDE;
bool Finished();
bool Aborted();
pkgExtract(pkgFLCache &FLCache,pkgCache::VerIterator Ver);
};
#endif
This diff is collapsed.
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
/* ######################################################################
File Listing - Manages a Cache of File -> Package names.
This is identical to the Package cache, except that the generator
(which is much simpler) is integrated directly into the main class,
and it has been designed to handle live updates.
The storage content of the class is maintained in a memory map and is
written directly to the file system. Performance is traded against
space to give something that performs well and remains small.
The average per file usage is 32 bytes which yields about a meg every
36k files. Directory paths are collected into a binary tree and stored
only once, this offsets the cost of the hash nodes enough to keep
memory usage slightly less than the sum of the filenames.
The file names are stored into a fixed size chained hash table that is
linked to the package name and to the directory component.
Each file node has a set of associated flags that indicate the current
state of the file.
##################################################################### */
/*}}}*/
#ifndef PKGLIB_FILELIST_H
#define PKGLIB_FILELIST_H
#include <apt-pkg/mmap.h>
#include <cstring>
#include <string>
class pkgFLCache
{
public:
struct Header;
struct Node;
struct Directory;
struct Package;
struct Diversion;
struct ConfFile;
class NodeIterator;
class DirIterator;
class PkgIterator;
class DiverIterator;
protected:
std::string CacheFile;
DynamicMMap &Map;
map_ptrloc LastTreeLookup;
unsigned long LastLookupSize;
// Helpers for the addition algorithms
map_ptrloc TreeLookup(map_ptrloc *Base,const char *Text,const char *TextEnd,
unsigned long Size,unsigned int *Count = 0,
bool Insert = false);
public:
// Pointers to the arrays of items
Header *HeaderP;
Node *NodeP;
Directory *DirP;
Package *PkgP;
Diversion *DiverP;
ConfFile *ConfP;
char *StrP;
unsigned char *AnyP;
// Quick accessors
Node *FileHash;
// Accessors
Header &Head() {return *HeaderP;};
void PrintTree(map_ptrloc Base,unsigned long Size);
// Add/Find things
PkgIterator GetPkg(const char *Name,const char *End,bool Insert);
inline PkgIterator GetPkg(const char *Name,bool Insert);
NodeIterator GetNode(const char *Name,
const char *NameEnd,
map_ptrloc Loc,
bool Insert,bool Divert);
Node *HashNode(NodeIterator const &N);
void DropNode(map_ptrloc Node);
inline DiverIterator DiverBegin();
// Diversion control
void BeginDiverLoad();
void FinishDiverLoad();
bool AddDiversion(PkgIterator const &Owner,const char *From,
const char *To);
bool AddConfFile(const char *Name,const char *NameEnd,
PkgIterator const &Owner,const unsigned char *Sum);
pkgFLCache(DynamicMMap &Map);
// ~pkgFLCache();
};
struct pkgFLCache::Header
{
// Signature information
unsigned long Signature;
short MajorVersion;
short MinorVersion;
bool Dirty;
// Size of structure values
unsigned HeaderSz;
unsigned NodeSz;
unsigned DirSz;
unsigned PackageSz;
unsigned DiversionSz;
unsigned ConfFileSz;
// Structure Counts;
unsigned int NodeCount;
unsigned int DirCount;
unsigned int PackageCount;
unsigned int DiversionCount;
unsigned int ConfFileCount;
unsigned int HashSize;
unsigned long UniqNodes;
// Offsets
map_ptrloc FileHash;
map_ptrloc DirTree;
map_ptrloc Packages;
map_ptrloc Diversions;
/* Allocation pools, there should be one of these for each structure
excluding the header */
DynamicMMap::Pool Pools[5];
bool CheckSizes(Header &Against) const;
Header();
};
/* The bit field is used to advoid incurring an extra 4 bytes x 40000,
Pointer is the most infrequently used member of the structure */
struct pkgFLCache::Node
{
map_ptrloc Dir; // Dir
map_ptrloc File; // String
unsigned Pointer:24; // Package/Diversion/ConfFile
unsigned Flags:8; // Package
map_ptrloc Next; // Node
map_ptrloc NextPkg; // Node
enum Flags {Diversion = (1<<0),ConfFile = (1<<1),
NewConfFile = (1<<2),NewFile = (1<<3),
Unpacked = (1<<4),Replaced = (1<<5)};
};
struct pkgFLCache::Directory
{
map_ptrloc Left; // Directory
map_ptrloc Right; // Directory
map_ptrloc Name; // String
};
struct pkgFLCache::Package
{
map_ptrloc Left; // Package
map_ptrloc Right; // Package
map_ptrloc Name; // String
map_ptrloc Files; // Node
};
struct pkgFLCache::Diversion
{
map_ptrloc OwnerPkg; // Package
map_ptrloc DivertFrom; // Node
map_ptrloc DivertTo; // String
map_ptrloc Next; // Diversion
unsigned long Flags;
enum Flags {Touched = (1<<0)};
};
struct pkgFLCache::ConfFile
{
map_ptrloc OwnerPkg; // Package
unsigned char MD5[16];
};
class pkgFLCache::PkgIterator
{
Package *Pkg;
pkgFLCache *Owner;
public:
inline bool end() const {return Owner == 0 || Pkg == Owner->PkgP?true:false;}
// Accessors
inline Package *operator ->() {return Pkg;}
inline Package const *operator ->() const {return Pkg;}
inline Package const &operator *() const {return *Pkg;}
inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;}
inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;}
inline unsigned long Offset() const {return Pkg - Owner->PkgP;}
inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;}
inline pkgFLCache::NodeIterator Files() const;
PkgIterator() : Pkg(0), Owner(0) {}
PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {}
};
class pkgFLCache::DirIterator
{
Directory *Dir;
pkgFLCache *Owner;
public:
// Accessors
inline Directory *operator ->() {return Dir;}
inline Directory const *operator ->() const {return Dir;}
inline Directory const &operator *() const {return *Dir;}
inline operator Directory *() {return Dir == Owner->DirP?0:Dir;}
inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;}
inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;}
DirIterator() : Dir(0), Owner(0) {}
DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {}
};
class pkgFLCache::DiverIterator
{
Diversion *Diver;
pkgFLCache *Owner;
public:
// Iteration
void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;}
inline void operator ++() {operator ++(0);}
inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;}
// Accessors
inline Diversion *operator ->() {return Diver;}
inline Diversion const *operator ->() const {return Diver;}
inline Diversion const &operator *() const {return *Diver;}
inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;}
inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;}
inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);}
inline NodeIterator DivertFrom() const;
inline NodeIterator DivertTo() const;
DiverIterator() : Diver(0), Owner(0) {};
DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {}
};
class pkgFLCache::NodeIterator
{
Node *Nde;
enum {NdePkg, NdeHash} Type;
pkgFLCache *Owner;
public:
// Iteration
void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP +
(Type == NdePkg?Nde->NextPkg:Nde->Next);}
inline void operator ++() {operator ++(0);}
inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;}
// Accessors
inline Node *operator ->() {return Nde;}
inline Node const *operator ->() const {return Nde;}
inline Node const &operator *() const {return *Nde;}
inline operator Node *() {return Nde == Owner->NodeP?0:Nde;}
inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;}
inline unsigned long Offset() const {return Nde - Owner->NodeP;}
inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);}
inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);}
inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;}
inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;}
Package *RealPackage() const;
NodeIterator() : Nde(0), Type(NdeHash), Owner(0) {};
NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {}
NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {}
NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {}
};
/* Inlines with forward references that cannot be included directly in their
respsective classes */
inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const
{return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);}
inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertTo() const
{return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);}
inline pkgFLCache::NodeIterator pkgFLCache::PkgIterator::Files() const
{return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);}
inline pkgFLCache::DiverIterator pkgFLCache::DiverBegin()
{return DiverIterator(*this,DiverP + HeaderP->Diversions);}
inline pkgFLCa