CARDS 2.4.87
Package manager for the NuTyX GNU/Linux distribution
cards_depends.h
1 //
2 // cards_depends.h
3 //
4 // Copyright (c) 2013-2017 by NuTyX team (http://nutyx.org)
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20 //
21 
22 #ifndef CARDSDEPENDS_H
23 #define CARDSDEPENDS_H
24 
25 #include "cards_argument_parser.h"
26 #include "compile_dependencies_utils.h"
27 #include "string_utils.h"
28 #include "pkgdbh.h"
29 
30 
31 #include <locale.h>
32 #include <string.h>
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 #include <sys/file.h>
36 #include <dirent.h>
37 
38 struct LevelName {
39  int l;
40  std::string name;
41 };
42 
43 class CardsDepends: public Pkgdbh
44 {
45 public:
46 
47  CardsDepends (const CardsArgumentParser& argParser);
48 
49  void parseArguments();
50 
51  virtual void treatErrors(const std::string& s) const;
52 
53  void showDependencies();
54  void showLevel();
55 
56  std::vector<std::string>& getDependencies();
57  std::vector<std::string>& getNeededDependencies();
58  std::vector<LevelName>& getLevel();
59 
60  int deptree();
61 
62 private:
63  /*
64  * Populate the List of dependance for each found package.
65  * We need to check if each dependance exist if yes add the index reference to the list
66  * if not printout a warning message
67  * We check for TWO deps files, it's need because some binaries need manual add of deps like
68  * xorg-server: xorg-font, may be some perl module, some icons theme what ever those are not
69  * found automatically
70  * kde: all the necessary apps
71  * xfce4: same
72  */
73  depList *readDependenciesList(itemList *filesList, unsigned int nameIndex);
74 
75  int depends();
76  int level();
77 
78  std::vector<std::string> m_dependenciesList;
79  std::vector<std::string> m_neededDependenciesList;
80  std::vector<LevelName> m_levelList;
81  std::set<std::string> m_missingDepsList;
82 
83  const CardsArgumentParser& m_argParser;
84  const char* m_packageName;
85  error m_actualError;
86 };
87 #endif
88 // vim:set ts=2 :
Definition: cards_depends.h:43
Definition: libcards.h:481
Definition: compile_dependencies_utils.h:45
Definition: cards_argument_parser.h:27
Definition: cards_depends.h:38
Definition: libcards.h:1495