]> cygwin.com Git - cygwin-apps/setup.git/blame - package_db.h
Added dpiAwareness element to manifest
[cygwin-apps/setup.git] / package_db.h
CommitLineData
7939f6d1
RC
1/*
2 * Copyright (c) 2001, Robert Collins.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
c93bc6d0
MB
16#ifndef SETUP_PACKAGE_DB_H
17#define SETUP_PACKAGE_DB_H
7939f6d1 18
4fe323f9 19/* required to parse this file */
0cf68afd
RC
20#include <vector>
21#include <map>
d19f12fd 22#include "String++.h"
7939f6d1 23class packagemeta;
7b606ae5 24class io_stream;
3c196821 25class PackageSpecification;
7939f6d1 26
cbfc4215
RC
27typedef enum {
28 PackageDB_Install,
29 PackageDB_Download
30} PackageDBActions;
31
ad646f43
RC
32class packagedb;
33typedef std::vector <packagemeta *>::iterator PackageDBConnectedIterator;
34
7939f6d1 35/*TODO: add mutexs */
65fa35d4
DK
36
37/*TODO: add sanity. Beware, Here Be C++ Dragons:
38
39 This class is a hidden singleton. It's a singleton, but you create
40 and delete transient objects of the class, none of which have any
41 member data, but solely serve as shortcuts to access one static set
42 of shared data through an irrelevant this-pointer.
43
44 Not only that, but it's a hidden singleton that is constructed
45 the first time you access it, and constructed differently
46 based on implicit global state.
47
48 Not only that, but it has some static state of its own that also
49 controls how it gets constructed, but that could then be changed
50 afterward without invalidating the cached data, silently changing
51 its semantic interpretation.
52
53 To use this class, you must first set the packagedb::task member
54 and the cygfile:// (install dir) root path. You must only then
55 construct a packagedb, and must remember not to change the
56 task or root path any later in the execution sequence.
57
58*/
db9818d7 59
1c159e0a 60#include "libsolv.h"
db9818d7
JT
61#include <PackageTrust.h>
62
7939f6d1
RC
63class packagedb
64{
65public:
66 packagedb ();
ab67dafa 67 void init();
7c7034e8
RC
68 /* 0 on success */
69 int flush ();
0c539f7f 70 void prep();
9ca5efb3
KB
71 /* Set the database to a "no changes requested" state. */
72 void noChanges ();
0c539f7f 73
3c196821 74 packagemeta * findBinary (PackageSpecification const &) const;
2602c5c4 75 packageversion findBinaryVersion (PackageSpecification const &) const;
3c196821 76 packagemeta * findSource (PackageSpecification const &) const;
c59b92e8 77 packageversion findSourceVersion (PackageSpecification const &spec) const;
1c159e0a
JT
78 packagemeta * addBinary (const std::string &pkgname, const SolverPool::addPackageData &pkgdata);
79 packageversion addSource (const std::string &pkgname, const SolverPool::addPackageData &pkgdata);
0c539f7f 80
ad646f43
RC
81 PackageDBConnectedIterator connectedBegin();
82 PackageDBConnectedIterator connectedEnd();
0c539f7f 83
a59178eb 84 void defaultTrust (SolverTasks &q, SolverSolution::updateMode mode, bool test);
347e23de 85
263157cb 86 typedef std::map <std::string, packagemeta *> packagecollection;
08cd08c3 87 /* all seen binary packages */
263157cb 88 static packagecollection packages;
08cd08c3 89 /* all seen source packages */
263157cb 90 static packagecollection sourcePackages;
7b606ae5 91 /* all seen categories */
d19f12fd 92 typedef std::map <std::string, std::vector <packagemeta *>, casecompare_lt_op > categoriesType;
0cf68afd 93 static categoriesType categories;
cbfc4215 94 static PackageDBActions task;
d76f912c
KB
95 /* a ficitious package that requires all packages in the Base category */
96 static packageversion basepkg;
1c159e0a
JT
97
98 static SolverPool solver;
1d553f34 99 static SolverSolution solution;
1c159e0a 100
7939f6d1 101private:
0c539f7f 102 void makeBase();
45d60587 103 void makeWindows();
0c539f7f
JT
104 void read();
105 void upgrade ();
106 void fixup_source_package_ids();
107 void removeEmptyCategories();
108 void fillMissingCategory();
109 void setExistence();
110 void guessUserPicked(void);
111
7939f6d1 112 static int installeddbread; /* do we have to reread this */
f6d6c600 113 static int installeddbver;
0c539f7f
JT
114 static bool prepped;
115
ad646f43
RC
116 friend class ConnectedLoopFinder;
117 static std::vector <packagemeta *> dependencyOrderedPackages;
7939f6d1
RC
118};
119
c93bc6d0 120#endif /* SETUP_PACKAGE_DB_H */
This page took 0.166468 seconds and 6 git commands to generate.