1 ////////////////////////////////////////////////////////////////////////
2 // FILE: package.h
3 // AUTHOR: Johannes Winkelmann, jw@tks6.net
4 // COPYRIGHT: (c) 2002 by Johannes Winkelmann
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
12 #ifndef _PACKAGE_H_
13 #define _PACKAGE_H_
14
15 #include <string>
16
17 struct PackageData;
18
19 /*!
20 \class Package
21 \brief representation of a package
22
23 Representation of a package from the crux ports tree
24 */
25 class Package
26 {
27 public:
28 Package( const std::string& name,
29 const std::string& path );
30
31 Package( const std::string& name,
32 const std::string& path,
33 const std::string& version,
34 const std::string& release,
35 const std::string& description,
36 const std::string& dependencies,
37 const std::string& url,
38 const std::string& packager,
39 const std::string& maintainer,
40 const std::string& hasReadme,
41 const std::string& hasPreInstall,
42 const std::string& hasPostInstall );
43
44 ~Package();
45
46 const std::string& name() const;
47 const std::string& path() const;
48 const std::string& version() const;
49 const std::string& release() const;
50 const std::string& description() const;
51 const std::string& dependencies() const;
52 const std::string& url() const;
53 const std::string& packager() const;
54 const std::string& maintainer() const;
55 const bool hasReadme() const;
56 const bool hasPreInstall() const;
57 const bool hasPostInstall() const;
58
59 std::string versionReleaseString() const;
60
61 void setDependencies( const std::string& dependencies );
62
63
64 private:
65 void load() const;
66
67 static void expandShellCommands(std::string& input,
68 const time_t& timeNow,
69 const struct utsname unameBuf);
70
71 mutable PackageData* m_data;
72 mutable bool m_loaded;
73
74 };
75
76 struct PackageData
77 {
78 PackageData( const std::string& name_,
79 const std::string& path_,
80 const std::string& version_="",
81 const std::string& release_="",
82 const std::string& description_="",
83 const std::string& dependencies_="",
84 const std::string& url_="",
85 const std::string& packager="",
86 const std::string& maintainer="",
87 const std::string& hasReadme_="",
88 const std::string& hasPreInstall_="",
89 const std::string& hasPostInstall_="");
90
91 std::string name;
92 std::string path;
93 std::string version;
94 std::string release;
95 std::string description;
96 std::string depends;
97 std::string url;
98 std::string packager;
99 std::string maintainer;
100
101 std::string versionReleaseString;
102
103 bool hasReadme;
104 bool hasPreInstall;
105 bool hasPostInstall;
106
107 void generateVersionReleaseString();
108 };
109
110 #endif /* _PACKAGE_H_ */
|