CARDS 2.4.140
Package manager for the NuTyX GNU/Linux distribution
pkgsync.h
1//
2// pkgsync.h
3//
4// Copyright (c) 2017 - 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#ifndef PKGSYNC_H
22#define PKGSYNC_H
23
24#include "file_utils.h"
25#include "file_download.h"
26#include "pkgrepo.h"
27
28#include <cstring>
29#include <cstdlib>
30#include <iostream>
31
32
33#include <curl/curl.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <unistd.h>
37#include <libgen.h>
38#include <dirent.h>
39
40class Pkgsync
41{
42public:
48 Pkgsync(const std::string& url,
49 const std::string& directory,
50 const std::string& repoFile);
51
52 virtual void treatErrors(const std::string& s) const;
53
54 virtual void run();
55 virtual void purge();
56 static const std::string DEFAULT_REPOFILE;
57
58 void setRootPath(const std::string& path);
59 void setConfigFile(const std::string& file);
60
61private:
62
63 unsigned int getLocalPackages(const std::string& path);
64 unsigned int getRemotePackages(const std::string& pkgrepoFile);
65
66 void deleteFolder(const std::string& folderName);
67
68 std::set<std::string> m_localPackagesList;
69 std::set<std::string> m_remotePackagesList;
70 const std::string m_baseDirectory;
71 const std::string m_remoteUrl;
72 std::string m_repoFile;
73 std::string m_root;
74 std::string m_configFile;
75 error m_actualError;
76
77
78};
79
80#endif /* PKGSYNC_H */
81// vim:set ts=2 :
Definition: libcards.h:1815