CARDS 2.3.99
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-2017 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 
28 
29 struct 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  */
47 struct 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 URL;
56  std::string contributors;
57  std::string maintainer;
58  std::string packager;
59  std::string fileDate;
60  std::string alias;
61  std::string group;
62  time_t buildDate;
63  std::vector<PortFilesList> portFilesList;
64 };
65 
66 struct PortsDirectory {
67  std::string Dir;
68  std::string Url;
69  std::vector<BasePackageInfo> basePackageList;
70 };
74 struct RepoInfo {
75  std::string branch;
76  std::string arch;
77  std::string collection;
78  std::vector<BasePackageInfo> basePackageList;
79 };
80 class Pkgrepo {
81 public:
82 
83  Pkgrepo(const std::string& fileName);
84  virtual ~Pkgrepo() {}
85  static int parseConfig(const char *fileName,
86  Config& config);
87 
98  std::set<std::string> getListOutOfDate();
99 
104  std::string getPortDir (const std::string& portName);
105 
106 
112  std::string getBasePortName (const std::string& portName);
117  std::string getBasePackageName(const std::string& packageName);
123  std::string getBasePackageVersion(const std::string& packageName);
124 
128  std::string getPortVersion (const std::string& portName);
129 
134  int getBasePackageRelease (const std::string& packageName);
135 
139  int getPortRelease(const std::string& portName);
143  bool checkPortExist(const std::string& portName);
144 
148  std::set<std::string> getListOfPackagesFromCollection(const std::string& collectionName);
149 
153  time_t getBinaryBuildTime (const std::string& portName);
154 
159  std::set<std::string> getBinaryPackageList();
164  std::vector<RepoInfo> getRepoInfo();
170  unsigned int getPortsList();
171 
172  bool getBinaryPackageInfo(const std::string& packageName);
173  bool getPortInfo(const std::string& portName);
174 
175 protected:
180  int parseConfig(const char *fileName);
181 
194  void parsePkgRepoCollectionFile();
195 
206  void parseCollectionDirectory();
207 
219  void parseCurrentPackagePkgRepoFile();
220 
226  void parsePackagePkgfileFile();
227 
228 
229  bool m_parsePkgRepoCollectionFile;
230  bool m_parseCollectionDirectory;
231  bool m_parsePackagePkgfileFile;
232 
233  std::vector<PortsDirectory>::iterator m_PortsDirectory_i;
234  std::vector<BasePackageInfo>::iterator m_BasePackageInfo_i;
235  std::vector<PortFilesList>::iterator m_PortFilesList_i;
236 
237  std::vector<PortFilesList> m_portFilesList;
238 
239  std::string m_packageFileName;
240  std::string m_packageFileNameSignature;
241  std::string m_configFileName;
242  Config m_config;
243 
244  std::vector<PortsDirectory> m_portsDirectoryList;
245 };
246 #endif /* PKGREPO_H */
247 // vim:set ts=2 :
Definition: libcards.h:865
Definition: libcards.h:814
Definition: libcards.h:859
Definition: libcards.h:851
Definition: libcards.h:832
Definition: file_utils.h:69