CARDS 2.4.140
Package manager for the NuTyX GNU/Linux distribution
pkgrepo.h
1//
2// pkgrepo.h
3//
4// Copyright (c) 2002 - 2005 by Johannes Winkelmann jw at tks6 dot net
5// Copyright (c) 2014 - 2020 by NuTyX team (http://nutyx.org)
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20// USA.
21//
22
23#ifndef PKGREPO_H
24#define PKGREPO_H
25
26#include "file_utils.h"
27#include "pkg.h"
28
29struct PortFilesList {
30 std::string md5SUM;
31 std::string name;
32 std::string arch;
33};
34
41/*
42 **************************************************
43 * 73193bfc1cb30fe02a880ed088ed7590#1414192958#aalib#1.4rc5##n.a#n.a#n.a#n.a#.cards.tar.xz
44 * 650ed499ce78791d45b91aaf7f91b445#1428615787#firefox#37.0.1#1#Standalone web browser from mozilla.org#http://www.mozilla.com/firefox/#n.a#pierre at nutyx dot org,tnut at nutyx dot org#.cards.tar.xz
45 *************************************************
46 */
47struct BasePackageInfo {
48 std::string md5SUM;
49 std::string s_buildDate;
50 std::string basePackageName;
51 std::string extention;
52 std::string version;
53 int release;
54 std::string description;
55 std::string categories;
56 std::string URL;
57 std::string contributors;
58 std::string maintainer;
59 std::string packager;
60 std::string fileDate;
61 std::string alias;
62 std::string set;
63 std::string group;
64 time_t buildDate;
65 std::vector<PortFilesList> portFilesList;
66};
67
68struct PortsDirectory {
69 std::string Dir;
70 std::string Url;
71 std::vector<BasePackageInfo> basePackageList;
72};
76struct RepoInfo {
77 std::string branch;
78 std::string arch;
79 std::string collection;
80 std::vector<BasePackageInfo> basePackageList;
81};
82
83class Pkgrepo
84{
85public:
86
87 Pkgrepo(const std::string& fileName);
88 virtual ~Pkgrepo() { clearPackagesList(); }
89
90 static int parseConfig(const char *fileName,
91 Config& config);
92
93 void throwError(const std::string& s) const;
94
105 std::set<std::string> getListOutOfDate();
106
111 std::string getPortDir (const std::string& portName);
112
113
119 std::string getBasePortName (const std::string& portName);
124 std::string getBasePackageName(const std::string& packageName);
130 std::string getBasePackageVersion(const std::string& packageName);
134 std::string getPortVersion (const std::string& portName);
135
140 int getBasePackageRelease (const std::string& packageName);
141
145 int getPortRelease(const std::string& portName);
149 bool checkPortExist(const std::string& portName);
150
154 std::set<std::string> getListOfPackagesFromCollection(const std::string& collectionName);
155
159 std::set<std::string> getListOfPackagesFromSet(const std::string& collectionName);
160
164 time_t getBinaryBuildTime (const std::string& portName);
165
170 std::set<std::string> getBinaryPackageList();
171
176 std::set<Pkg*> getBinaryPackageSet();
181 std::vector<RepoInfo> getRepoInfo();
187 unsigned int getPortsList();
188
189 bool getBinaryPackageInfo(const std::string& packageName);
190 bool getPortInfo(const std::string& portName);
191
192protected:
197 int parseConfig(const char *fileName);
198
212
224
237
244
245
246 bool m_parsePkgRepoCollectionFile;
247 bool m_parseCollectionDirectory;
248 bool m_parsePackagePkgfileFile;
249
250 std::vector<PortsDirectory>::iterator m_PortsDirectory_i;
251 std::vector<BasePackageInfo>::iterator m_BasePackageInfo_i;
252 std::vector<PortFilesList>::iterator m_PortFilesList_i;
253
254 std::vector<PortFilesList> m_portFilesList;
255
256 std::string m_configFileName;
257 Config m_config;
258
259 std::vector<PortsDirectory> m_portsDirectoryList;
260private:
261 error m_ErrorCond;
262 void clearPackagesList();
263 std::set<Pkg*> m_packagesList;
264};
265#endif /* PKGREPO_H */
266// vim:set ts=2 :
Definition: libcards.h:944
void parseCollectionDirectory()
std::set< std::string > getBinaryPackageList()
int parseConfig(const char *fileName)
void parsePackagePkgfileFile()
std::string getPortDir(const std::string &portName)
int getPortRelease(const std::string &portName)
bool checkPortExist(const std::string &portName)
std::string getPortVersion(const std::string &portName)
time_t getBinaryBuildTime(const std::string &portName)
void parsePkgRepoCollectionFile()
std::string getBasePackageName(const std::string &packageName)
std::set< std::string > getListOfPackagesFromCollection(const std::string &collectionName)
std::set< std::string > getListOfPackagesFromSet(const std::string &collectionName)
unsigned int getPortsList()
int getBasePackageRelease(const std::string &packageName)
void parseCurrentPackagePkgRepoFile()
std::string getBasePackageVersion(const std::string &packageName)
std::vector< RepoInfo > getRepoInfo()
std::string getBasePortName(const std::string &portName)
std::set< Pkg * > getBinaryPackageSet()
std::set< std::string > getListOutOfDate()
Definition: libcards.h:907
Definition: file_utils.h:69
Definition: libcards.h:889
Definition: libcards.h:928
Definition: libcards.h:936