CARDS 2.4.87
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 #include "pkg.h"
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() { clearPackagesList(); }
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);
127  std::string getPortVersion (const std::string& portName);
128 
133  int getBasePackageRelease (const std::string& packageName);
134 
138  int getPortRelease(const std::string& portName);
142  bool checkPortExist(const std::string& portName);
143 
147  std::set<std::string> getListOfPackagesFromCollection(const std::string& collectionName);
148 
152  time_t getBinaryBuildTime (const std::string& portName);
153 
158  std::set<std::string> getBinaryPackageList();
159 
164  std::set<Pkg*> getListOfPackages();
169  std::vector<RepoInfo> getRepoInfo();
175  unsigned int getPortsList();
176 
177  bool getBinaryPackageInfo(const std::string& packageName);
178  bool getPortInfo(const std::string& portName);
179 
180 protected:
185  int parseConfig(const char *fileName);
186 
200 
212 
225 
232 
233 
234  bool m_parsePkgRepoCollectionFile;
235  bool m_parseCollectionDirectory;
236  bool m_parsePackagePkgfileFile;
237 
238  std::vector<PortsDirectory>::iterator m_PortsDirectory_i;
239  std::vector<BasePackageInfo>::iterator m_BasePackageInfo_i;
240  std::vector<PortFilesList>::iterator m_PortFilesList_i;
241 
242  std::vector<PortFilesList> m_portFilesList;
243 
244  std::string m_packageFileName;
245  std::string m_packageFileNameSignature;
246  std::string m_configFileName;
247  Config m_config;
248 
249  std::vector<PortsDirectory> m_portsDirectoryList;
250 private:
251  void clearPackagesList();
252  std::set<Pkg*> m_packagesList;
253 };
254 #endif /* PKGREPO_H */
255 // vim:set ts=2 :
std::set< Pkg * > getListOfPackages()
Definition: pkgrepo.cxx:401
Definition: libcards.h:930
Definition: libcards.h:879
std::vector< RepoInfo > getRepoInfo()
Definition: pkgrepo.cxx:432
void parseCollectionDirectory()
Definition: pkgrepo.cxx:164
std::string getBasePackageVersion(const std::string &packageName)
time_t getBinaryBuildTime(const std::string &portName)
Definition: libcards.h:924
void parsePackagePkgfileFile()
Definition: pkgrepo.cxx:277
Definition: libcards.h:916
std::set< std::string > getBinaryPackageList()
Definition: pkgrepo.cxx:365
Definition: libcards.h:897
void parseCurrentPackagePkgRepoFile()
Definition: pkgrepo.cxx:192
std::set< std::string > getListOutOfDate()
Definition: pkgrepo.cxx:260
unsigned int getPortsList()
Definition: pkgrepo.cxx:462
int getBasePackageRelease(const std::string &packageName)
Definition: file_utils.h:69
bool checkPortExist(const std::string &portName)
std::string getBasePackageName(const std::string &packageName)
std::string getPortDir(const std::string &portName)
Definition: pkgrepo.cxx:569
std::string getPortVersion(const std::string &portName)
int getPortRelease(const std::string &portName)
std::string getBasePortName(const std::string &portName)
std::set< std::string > getListOfPackagesFromCollection(const std::string &collectionName)
void parsePkgRepoCollectionFile()
Definition: pkgrepo.cxx:44