~ubuntu-branches/ubuntu/lucid/aptitude/lucid-proposed

« back to all changes in this revision

Viewing changes to src/generic/apt/dump_packages.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-05-27 10:28:10 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080527102810-pxc090mnjkr4xlek
Tags: 0.4.11.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - 03_branding.dpatch: ubuntu branding
  - 04_changelog.dpatch: take changelogs from changelogs.ubuntu.com
  - 07_hide_recommends_warning.dpatch: do not show a warning about
    missing recommends
  - 08_ubuntu_default_source.dpatch: do not clean lists directory
    on transient network failures
  - 11_gxx43.dpatch:build tests without -Werror
* Updated:
  - 03_branding.dpatch
* Disabled 07_hide_recommends warning because we do install 
  recommends now by default too

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// dump_packages.h         -*-c++-*-
 
2
//
 
3
//   Copyright (C) 2007 Daniel Burrows
 
4
//
 
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.
 
9
//
 
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.
 
14
//
 
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.
 
19
 
 
20
#ifndef DUMP_PACKAGES_H
 
21
#define DUMP_PACKAGES_H
 
22
 
 
23
#include <apt-pkg/pkgcache.h>
 
24
 
 
25
#include <set>
 
26
#include <vector>
 
27
 
 
28
/** \brief Functions to write information about packages to a stream
 
29
 *  in Packages-file format.
 
30
 *
 
31
 *  \file dump_packages.h
 
32
 */
 
33
 
 
34
namespace aptitude
 
35
{
 
36
  namespace apt
 
37
  {
 
38
    /** \brief Write the given Packages file entry to the given
 
39
     *  stream.
 
40
     *
 
41
     *  \param vf   the Packages file entry to write.
 
42
     *  \param out  the stream to which to write the entry.
 
43
     */
 
44
    void dump_verfile(const pkgCache::VerFileIterator &vf,
 
45
                      std::ostream &out);
 
46
 
 
47
    /** \brief Write all the entries associated with the given
 
48
     *  package version.
 
49
     *
 
50
     *  \param ver  the version whose entries should be written.
 
51
     *  \param out  the stream to which the entries should be written.
 
52
     */
 
53
    void dump_version(const pkgCache::VerIterator &ver,
 
54
                      std::ostream &out);
 
55
 
 
56
    /** \brief Write all the entries associated with the given
 
57
     *         package versions.
 
58
     *
 
59
     *  \param versions  the versions whose Packages entries should
 
60
     *                   be written.
 
61
     *  \param out       the stream to which the Packages entries
 
62
     *                   should be written.
 
63
     */
 
64
    void dump_versions(const std::vector<pkgCache::VerIterator> &versions,
 
65
                       std::ostream &out);
 
66
 
 
67
    /** \brief Write all the entries associated with the given
 
68
     *         packages, dropping outgoing dependencies.
 
69
     *
 
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
 
73
     *  cases.
 
74
     */
 
75
    void dump_truncated_packages(const std::set<pkgCache::PkgIterator> &versions,
 
76
                                 std::ostream &out);
 
77
 
 
78
 
 
79
 
 
80
    /** Make a truncated state snapshot in the given directory.
 
81
     *
 
82
     *  We need to copy:
 
83
     *
 
84
     *  - $(Dir::State::lists)/
 
85
     *  - $(Dir::State::status)/
 
86
     *  - $(Dir::Etc::sourceparts)/
 
87
     *  - $(Dir::Etc::vendorlist)
 
88
     *  - $(Dir::Etc::vendorparts)/
 
89
     *  - $(Dir::Etc::main)
 
90
     *  - $(Dir::Etc::parts)/
 
91
     *  - $(Dir::Etc::preferences)
 
92
     *
 
93
     * Dir::State::* are truncated copies; the others are copied
 
94
     * literally.
 
95
     *
 
96
     *  \todo check that outDir doesn't exist.
 
97
     *
 
98
     *  \note This calls _error in many places; instead it should
 
99
     *        throw exceptions (all else aside, _error isn't
 
100
     *        thread-safe!).
 
101
     *
 
102
     *  \param out_dir   the target directory, which should not
 
103
     *                   exist.
 
104
     *  \param visited_packages    the packages that should
 
105
     *                             be contained in the truncated cache.
 
106
     */
 
107
    void make_truncated_state_copy(const std::string &out_dir,
 
108
                                   const std::set<pkgCache::PkgIterator> &visited_packages);
 
109
  }
 
110
}
 
111
 
 
112
#endif