CARDS 2.4.140
Package manager for the NuTyX GNU/Linux distribution
compile_dependencies_utils.h
1//
2// compile_dependencies_utils.h
3//
4// Copyright (c) 2013 - 2020 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 COMPILE_DEPENDENCIES_UTILS_H
23#define COMPILE_DEPENDENCIES_UTILS_H
24
25#include "file_utils.h"
26
27#include <iostream>
28#include <cstdlib>
29#include <set>
30#include <string>
31#include <list>
32#include <map>
33
34#include <stdlib.h>
35#include <stdio.h>
36#include <errno.h>
37#include <locale.h>
38#include <string.h>
39#include <sys/types.h>
40#include <sys/stat.h>
41#include <sys/file.h>
42#include <dirent.h>
43
44/* depList is a dependances List */
45typedef struct
46{
47 unsigned int *depsIndex;
48 int *niveau; /* To show a nice incrementation */
49 unsigned int count;
50 unsigned int decrement; /* number of removed dep when searching them */
51 int decount;
52} depList;
53
54/* pkgInfo is the name of a package and the dependencies itemList */
55typedef struct
56{
57 unsigned int nameIndex;
58 depList *dependences;
59 int niveau;
60} pkgInfo;
61
62typedef struct
63{
64 pkgInfo **pkgs;
65 unsigned int count;
66} pkgList;
67
68
69/*
70 * depList: Create the list, Add dependence to the list, free the list
71 */
72depList *initDepsList(void);
73void addDepToDepList(depList *list, unsigned int nameIndex, int niveau);
74void freeDepList(depList *list);
75
76/*** pkgInfo: create the pkg, Add info, free the pkgInfo ***/
77pkgInfo *initPkgInfo(void);
78pkgInfo *addInfoToPkgInfo(unsigned int nameIndex);
79void freePkgInfo(pkgInfo *package);
80
81/*** pkgList: create the pkgList, add pkgs, free the pkgList ***/
82pkgList *initPkgList(void);
83void addPkgToPkgList(pkgList *list, pkgInfo *package);
84void freePkgList(pkgList *packagesList);
85
86int deps_direct (itemList *filesList, pkgList *packagesList, depList *dependenciesList,unsigned int niveau);
87int deps_direct (itemList *filesList, pkgList *packagesList, depList *dependenciesList,const char* pkgName, unsigned int niveau);
88
89void generate_level ( itemList *filesList, pkgList *packagesList, unsigned int *niveau);
90
91char *getLongPackageName(itemList *filesList, const char * packageName);
92#endif /* COMPILE_DEPENDENCIES_UTILS_H */
93// vim:set ts=2 :
Definition: compile_dependencies_utils.h:46
Definition: libcards.h:484
Definition: compile_dependencies_utils.h:56
Definition: compile_dependencies_utils.h:63