]>
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
=
29 #include "io_stream.h"
32 #include "package_version.h"
33 #include "cygpackage.h"
35 /* this constructor creates an invalid package - further details MUST be provided */
36 cygpackage::cygpackage (String
const &pkgname
):
44 status (package_installed
),
45 type (package_binary
),
49 memset( getfilenamebuffer
, '\0', _MAX_PATH
);
51 /* FIXME: query the install database for the currently installed
56 /* create a package given explicit details - perhaps should be modified to take the
57 filename and do it's own parsing? */
58 cygpackage::cygpackage (String
const &pkgname
, String
const &filename
, size_t const fs
,
59 String
const &version
, package_status_t
const newstatus
,
60 package_type_t
const newtype
):
71 memset( getfilenamebuffer
, '\0', _MAX_PATH
);
72 set_canonical_version (version
);
75 /* tell the version */
77 cygpackage::set_canonical_version (String
const &version
)
80 char *start
= strchr (canonical
.cstr_oneuse(), '-');
85 while ((next
= strchr (curr
+ 1, '-')))
87 /* curr = last - in the version string */
89 char tvendor
[version
.size() +1];
90 strcpy (tvendor
, version
.cstr_oneuse());
91 tvendor
[curr
- start
] = '\0';
102 cygpackage::~cygpackage ()
107 /* helper functions */
110 cygpackage::destroy ()
115 cygpackage::getfirstfile ()
120 io_stream::open (String ("cygfile:///etc/setup/") + name
+ ".lst.gz", "rb");
121 listdata
= compress::decompress (listfile
);
124 return listdata
->gets (getfilenamebuffer
, sizeof (getfilenamebuffer
));
128 cygpackage::getnextfile ()
131 return listdata
->gets (getfilenamebuffer
, sizeof (getfilenamebuffer
));
136 cygpackage::uninstall ()
141 io_stream::remove (String("cygfile:///etc/setup/") + name
+ ".lst.gz");
151 cygpackage::Vendor_version ()
157 cygpackage::Package_version ()
163 cygpackage::Canonical_version ()
169 cygpackage::set_sdesc (String
const &desc
)
175 cygpackage::set_ldesc (String
const &desc
)
181 package_stability_t
cygpackage::Stability ()
This page took 0.041827 seconds and 5 git commands to generate.