]>
cygwin.com Git - cygwin-apps/setup.git/blob - cygpackage.cc
2 * Copyright (c) 2001, Robert Collins.
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.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 /* this is the parent class for all package operations.
20 static const char *cvsid
=
24 #include "cygpackage.h"
30 #include "io_stream.h"
33 #include "package_version.h"
34 #include "cygpackage.h"
36 /* this constructor creates an invalid package - further details MUST be provided */
37 cygpackage::cygpackage ():
45 status (package_installed
),
46 type (package_binary
),
50 memset( getfilenamebuffer
, '\0', _MAX_PATH
);
52 /* FIXME: query the install database for the currently installed
58 cygpackage::createInstance (String
const &pkgname
)
60 cygpackage
*temp
= new cygpackage
;
62 return packageversion(temp
);
66 cygpackage::createInstance (String
const &pkgname
, String
const &filename
,
67 size_t const fs
, String
const &version
,
68 package_status_t
const newstatus
,
69 package_type_t
const newtype
)
71 cygpackage
*temp
= new cygpackage
;
74 temp
->status
= newstatus
;
77 temp
->setCanonicalVersion (version
);
78 return packageversion(temp
);
81 /* tell the version */
83 cygpackage::setCanonicalVersion (String
const &version
)
86 char *start
= strchr (canonical
.cstr_oneuse(), '-');
91 while ((next
= strchr (curr
+ 1, '-')))
93 /* curr = last - in the version string */
95 char tvendor
[version
.size() +1];
96 strcpy (tvendor
, version
.cstr_oneuse());
97 tvendor
[curr
- start
] = '\0';
107 cygpackage::~cygpackage ()
112 /* helper functions */
115 cygpackage::destroy ()
120 cygpackage::getfirstfile ()
125 io_stream::open (String ("cygfile:///etc/setup/") + name
+ ".lst.gz", "rb");
126 listdata
= compress::decompress (listfile
);
129 return listdata
->gets (getfilenamebuffer
, sizeof (getfilenamebuffer
));
133 cygpackage::getnextfile ()
136 return listdata
->gets (getfilenamebuffer
, sizeof (getfilenamebuffer
));
141 cygpackage::uninstall ()
146 io_stream::remove (String("cygfile:///etc/setup/") + name
+ ".lst.gz");
156 cygpackage::Vendor_version ()
162 cygpackage::Package_version ()
168 cygpackage::Canonical_version ()
174 cygpackage::set_sdesc (String
const &desc
)
180 cygpackage::set_ldesc (String
const &desc
)
186 package_stability_t
cygpackage::Stability ()
This page took 0.042634 seconds and 5 git commands to generate.