1
// dump_packages.h -*-c++-*-
3
// Copyright (C) 2007 Daniel Burrows
5
// This program is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU General Public License as
7
// published by the Free Software Foundation; either version 2 of
8
// the License, or (at your option) any later version.
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program; see the file COPYING. If not, write to
17
// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
// Boston, MA 02111-1307, USA.
20
#ifndef DUMP_PACKAGES_H
21
#define DUMP_PACKAGES_H
23
#include <apt-pkg/pkgcache.h>
28
/** \brief Functions to write information about packages to a stream
29
* in Packages-file format.
31
* \file dump_packages.h
38
/** \brief Write the given Packages file entry to the given
41
* \param vf the Packages file entry to write.
42
* \param out the stream to which to write the entry.
44
void dump_verfile(const pkgCache::VerFileIterator &vf,
47
/** \brief Write all the entries associated with the given
50
* \param ver the version whose entries should be written.
51
* \param out the stream to which the entries should be written.
53
void dump_version(const pkgCache::VerIterator &ver,
56
/** \brief Write all the entries associated with the given
59
* \param versions the versions whose Packages entries should
61
* \param out the stream to which the Packages entries
64
void dump_versions(const std::vector<pkgCache::VerIterator> &versions,
67
/** \brief Write all the entries associated with the given
68
* packages, dropping outgoing dependencies.
70
* Dependencies that point to a package not in the given set
71
* will be stripped from the output file. This is used to
72
* drop irrelevant dependencies when generating resolver test
75
void dump_truncated_packages(const std::set<pkgCache::PkgIterator> &versions,
80
/** Make a truncated state snapshot in the given directory.
84
* - $(Dir::State::lists)/
85
* - $(Dir::State::status)/
86
* - $(Dir::Etc::sourceparts)/
87
* - $(Dir::Etc::vendorlist)
88
* - $(Dir::Etc::vendorparts)/
90
* - $(Dir::Etc::parts)/
91
* - $(Dir::Etc::preferences)
93
* Dir::State::* are truncated copies; the others are copied
96
* \todo check that outDir doesn't exist.
98
* \note This calls _error in many places; instead it should
99
* throw exceptions (all else aside, _error isn't
102
* \param out_dir the target directory, which should not
104
* \param visited_packages the packages that should
105
* be contained in the truncated cache.
107
void make_truncated_state_copy(const std::string &out_dir,
108
const std::set<pkgCache::PkgIterator> &visited_packages);