]> cygwin.com Git - cygwin-apps/setup.git/blob - package_source.h
2001-11-26 Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
[cygwin-apps/setup.git] / package_source.h
1 /*
2 * Copyright (c) 2001, Robert Collins.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
16 /* this is the parent class for all package source (not source code - installation
17 * source as in http/ftp/disk file) operations.
18 */
19
20 #ifndef _PACKAGE_SOURCE_H_
21 #define _PACKAGE_SOURCE_H_
22
23 /* required to parse this file */
24 #include "list.h"
25 #include "strings.h"
26
27 /* standard binary package metadata:
28 * Name (ie mutt
29 * Vendor Version (ie 2.5.1)
30 * Package Version (ie 16)
31 * Stability
32 * Files
33 */
34
35 /* For non installed files, this class can be populated via information about
36 * what is available on the net, or by parsing a specific package file.
37 * for installed packages, this class should represent what is currently installed,
38 * - updated by what net metadata has about it.
39 * i.e. the stability of this version will change simply because the net mirrors
40 * now consider it old.
41 */
42
43 class site
44 {
45 public:
46 site (char const *newkey) {key = new char[strlen (newkey+1)];strcpy (key,newkey);};
47 ~site () {if (key) delete key;};
48 char * key;
49 };
50
51 class packagesource
52 {
53 public:
54 packagesource () : size (0), canonical(0),base (0),filename (0),cached (0) {};
55 /* how big is the source file */
56 size_t size;
57 /* The canonical name - the complete path to the source file
58 * i.e. foo/bar/package-1.tar.bz2
59 */
60 virtual const char *Canonical () {return canonical;};
61 /* The basename - without extention
62 * i.e. package-1
63 */
64 virtual const char *Base () {return base;};
65 /* The basename - with extention
66 * i.e. package-1.tar.bz2
67 */
68 virtual const char *Filename () {return filename;};
69 /* what is the cached filename, to prevent directory scanning during install */
70 virtual char const *Cached () {return cached;};
71 /* sets the canonical path, and parses and creates base and filename */
72 virtual void set_canonical (char const *);
73 list <site, char const *, strcasecmp> sites;
74 #if 0
75 /* The name from the installation cache - may be the same as Canonical */
76 virtual const char *CachedName () = 0;
77 #endif
78
79 virtual ~ packagesource ()
80 {
81 if (canonical)
82 delete canonical;
83 if (base)
84 delete base;
85 if (filename)
86 delete filename;
87 if (cached)
88 delete cached;
89 };
90
91 private:
92 char * canonical;
93 char * base;
94 char * filename;
95 char * cached;
96 };
97
98 #endif /* _PACKAGE_SOURCE_H_ */
This page took 0.04257 seconds and 6 git commands to generate.