-rw-r--r-- | noncore/settings/packagemanager/README | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/TODO | 28 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 7 |
3 files changed, 31 insertions, 6 deletions
diff --git a/noncore/settings/packagemanager/README b/noncore/settings/packagemanager/README index 7b6305a..9324f9c 100644 --- a/noncore/settings/packagemanager/README +++ b/noncore/settings/packagemanager/README | |||
@@ -1,55 +1,55 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | /* | 2 | /* |
3 | /* Opie - Package Manager | 3 | /* Opie - Package Manager |
4 | /* ======================== | 4 | /* ======================== |
5 | /* Version 0.2.0 | 5 | /* Version 0.3.0 |
6 | /* | 6 | /* |
7 | /* A package management client for Opie | 7 | /* A package management client for Opie |
8 | /* | 8 | /* |
9 | /************************************************************************ | 9 | /************************************************************************ |
10 | 10 | ||
11 | ------------------------------------------------------- | 11 | ------------------------------------------------------- |
12 | Release Notes for Opie-PackageManager - January, 2004 | 12 | Release Notes for Opie-PackageManager - January, 2004 |
13 | ------------------------------------------------------- | 13 | ------------------------------------------------------- |
14 | 14 | ||
15 | ====================== | 15 | ====================== |
16 | = To-do = | 16 | = To-do = |
17 | ====================== | 17 | ====================== |
18 | 18 | ||
19 | - See $OPIEDIR/noncore/settings/packagemanager/TODO for more info. | 19 | - See $OPIEDIR/noncore/settings/packagemanager/TODO for more info. |
20 | 20 | ||
21 | ====================== | 21 | ====================== |
22 | = Build = | 22 | = Build = |
23 | ====================== | 23 | ====================== |
24 | 24 | ||
25 | In order to build opie-packagemanager, libipkg needs to be present on | 25 | In order to build opie-packagemanager, libipkg needs to be present on |
26 | the build system along with the appropriate headers. | 26 | the build system along with the appropriate headers. |
27 | 27 | ||
28 | - libipkg source (best to use version 109 or greater): | 28 | - libipkg source (best to use version 109 or greater): |
29 | - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C') | 29 | - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C') |
30 | - FTP: ftp://handhelds.org/linux/packages/ipkg | 30 | - FTP: ftp://handhelds.org/linux/packages/ipkg |
31 | 31 | ||
32 | - before building opie-packagemanager, define the environmental variable | 32 | - before building opie-packagemanager, define the environmental variable |
33 | IPKGDIR to point to the directory containing the ipkg source code | 33 | IPKGDIR to point to the directory containing the ipkg source code |
34 | - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C' | 34 | - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C' |
35 | 35 | ||
36 | ====================== | 36 | ====================== |
37 | = Run = | 37 | = Run = |
38 | ====================== | 38 | ====================== |
39 | 39 | ||
40 | - In order to use opie-packagemanager, libipkg must be installed | 40 | - In order to use opie-packagemanager, libipkg must be installed |
41 | on the system. | 41 | on the system. |
42 | 42 | ||
43 | ====================== | 43 | ====================== |
44 | = Credits = | 44 | = Credits = |
45 | ====================== | 45 | ====================== |
46 | 46 | ||
47 | - Opie-PackageManager is (C) 2003-2004 Dan Williams | 47 | - Opie-PackageManager is (C) 2003-2004 Dan Williams |
48 | 48 | ||
49 | ====================== | 49 | ====================== |
50 | = Links = | 50 | = Links = |
51 | ====================== | 51 | ====================== |
52 | 52 | ||
53 | - Opie Project: http://opie.handhelds.org | 53 | - Opie Project: http://opie.handhelds.org |
54 | - OpenZaurus Project: http://openzaurus.org | 54 | - OpenZaurus Project: http://openzaurus.org |
55 | - Familiar Project: http://familiar.handhelds.org | 55 | - Familiar Project: http://familiar.handhelds.org |
diff --git a/noncore/settings/packagemanager/TODO b/noncore/settings/packagemanager/TODO new file mode 100644 index 0000000..448ade3 --- a/dev/null +++ b/noncore/settings/packagemanager/TODO | |||
@@ -0,0 +1,28 @@ | |||
1 | /************************************************************************ | ||
2 | /* | ||
3 | /* Opie - Package Manager | ||
4 | /* ======================== | ||
5 | /* Version 0.3.0 | ||
6 | /* | ||
7 | /* A package management client for Opie | ||
8 | /* | ||
9 | /************************************************************************ | ||
10 | |||
11 | --------------------------------------------- | ||
12 | To-do for Opie-PackageManager - April, 2004 | ||
13 | --------------------------------------------- | ||
14 | |||
15 | ====================== | ||
16 | = Current release = | ||
17 | ====================== | ||
18 | |||
19 | 1. Save configuration information (i.e. /etc/ipkg.conf) | ||
20 | 2. Link non-root destination apps | ||
21 | 3. Implement QCOP interface for installing, removing, etc. | ||
22 | 4. Redesign configuration dialog | ||
23 | |||
24 | ====================== | ||
25 | = Future releases = | ||
26 | ====================== | ||
27 | |||
28 | 1. ??? \ No newline at end of file | ||
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index 1dc23a4..5c79ba9 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -1,229 +1,226 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkg.h" | 32 | #include "oipkg.h" |
33 | 33 | ||
34 | #include <stdlib.h> | 34 | #include <stdlib.h> |
35 | #include <string.h> | 35 | #include <string.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qmessagebox.h> | ||
40 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
41 | 40 | ||
42 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 41 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
43 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 42 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
44 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 43 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
45 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 44 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
46 | 45 | ||
47 | OIpkg *oipkg; | 46 | OIpkg *oipkg; |
48 | 47 | ||
49 | // Ipkg callback functions | 48 | // Ipkg callback functions |
50 | 49 | ||
51 | int fsignalIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) | 50 | int fsignalIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) |
52 | { | 51 | { |
53 | oipkg->ipkgMessage( msg ); | 52 | oipkg->ipkgMessage( msg ); |
54 | return 0; | 53 | return 0; |
55 | } | 54 | } |
56 | 55 | ||
57 | char *fIpkgResponse( char */*question*/ ) | 56 | char *fIpkgResponse( char */*question*/ ) |
58 | { | 57 | { |
59 | return 0x0; | 58 | return 0x0; |
60 | } | 59 | } |
61 | 60 | ||
62 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) | 61 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) |
63 | { | 62 | { |
64 | oipkg->ipkgStatus( desc ); | 63 | oipkg->ipkgStatus( desc ); |
65 | return 0; | 64 | return 0; |
66 | } | 65 | } |
67 | 66 | ||
68 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, | 67 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, |
69 | void */*userdata*/ ) | 68 | void */*userdata*/ ) |
70 | { | 69 | { |
71 | oipkg->ipkgList( desc ); | 70 | oipkg->ipkgList( desc ); |
72 | return 0; | 71 | return 0; |
73 | } | 72 | } |
74 | 73 | ||
75 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 74 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
76 | : QObject( parent, name ) | 75 | : QObject( parent, name ) |
77 | , m_config( config ) | 76 | , m_config( config ) |
78 | , m_confInfo( NULL ) | 77 | , m_confInfo( NULL ) |
79 | , m_ipkgExecOptions( 0 ) | 78 | , m_ipkgExecOptions( 0 ) |
80 | , m_ipkgExecVerbosity( 1 ) | 79 | , m_ipkgExecVerbosity( 1 ) |
81 | { | 80 | { |
82 | oipkg = this; | 81 | oipkg = this; |
83 | 82 | ||
84 | // Initialize libipkg | 83 | // Initialize libipkg |
85 | if ( ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) ) | 84 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); |
86 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) ); | ||
87 | 85 | ||
88 | // Default ipkg run-time arguments | 86 | // Default ipkg run-time arguments |
89 | m_ipkgArgs.noaction = false; | 87 | m_ipkgArgs.noaction = false; |
90 | m_ipkgArgs.force_defaults = true; | 88 | m_ipkgArgs.force_defaults = true; |
91 | } | 89 | } |
92 | 90 | ||
93 | OIpkg::~OIpkg() | 91 | OIpkg::~OIpkg() |
94 | { | 92 | { |
95 | // Upon destruction, ensure that items in config list are deleted with list | 93 | // Upon destruction, ensure that items in config list are deleted with list |
96 | if ( m_confInfo ) | 94 | if ( m_confInfo ) |
97 | m_confInfo->setAutoDelete( true ); | 95 | m_confInfo->setAutoDelete( true ); |
98 | 96 | ||
99 | // Free up libipkg resources | 97 | // Free up libipkg resources |
100 | if ( ipkg_deinit( &m_ipkgArgs ) ) | 98 | ipkg_deinit( &m_ipkgArgs ); |
101 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) ); | ||
102 | } | 99 | } |
103 | 100 | ||
104 | OConfItemList *OIpkg::configItems() | 101 | OConfItemList *OIpkg::configItems() |
105 | { | 102 | { |
106 | // Retrieve all configuration items | 103 | // Retrieve all configuration items |
107 | return filterConfItems(); | 104 | return filterConfItems(); |
108 | } | 105 | } |
109 | 106 | ||
110 | OConfItemList *OIpkg::servers() | 107 | OConfItemList *OIpkg::servers() |
111 | { | 108 | { |
112 | // Retrieve only servers | 109 | // Retrieve only servers |
113 | return filterConfItems( OConfItem::Source ); | 110 | return filterConfItems( OConfItem::Source ); |
114 | } | 111 | } |
115 | 112 | ||
116 | OConfItemList *OIpkg::destinations() | 113 | OConfItemList *OIpkg::destinations() |
117 | { | 114 | { |
118 | // Retrieve only destinations | 115 | // Retrieve only destinations |
119 | return filterConfItems( OConfItem::Destination ); | 116 | return filterConfItems( OConfItem::Destination ); |
120 | } | 117 | } |
121 | 118 | ||
122 | OConfItemList *OIpkg::options() | 119 | OConfItemList *OIpkg::options() |
123 | { | 120 | { |
124 | // Retrieve only destinations | 121 | // Retrieve only destinations |
125 | return filterConfItems( OConfItem::Option ); | 122 | return filterConfItems( OConfItem::Option ); |
126 | } | 123 | } |
127 | 124 | ||
128 | void OIpkg::setConfigItems( OConfItemList *configList ) | 125 | void OIpkg::setConfigItems( OConfItemList *configList ) |
129 | { | 126 | { |
130 | if ( m_confInfo ) | 127 | if ( m_confInfo ) |
131 | delete m_confInfo; | 128 | delete m_confInfo; |
132 | 129 | ||
133 | m_confInfo = configList; | 130 | m_confInfo = configList; |
134 | } | 131 | } |
135 | 132 | ||
136 | void OIpkg::saveSettings() | 133 | void OIpkg::saveSettings() |
137 | { | 134 | { |
138 | // Save Ipkg execution options to application configuration file | 135 | // Save Ipkg execution options to application configuration file |
139 | if ( m_config ) | 136 | if ( m_config ) |
140 | { | 137 | { |
141 | m_config->setGroup( "Ipkg" ); | 138 | m_config->setGroup( "Ipkg" ); |
142 | m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); | 139 | m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); |
143 | m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); | 140 | m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); |
144 | } | 141 | } |
145 | } | 142 | } |
146 | 143 | ||
147 | OPackageList *OIpkg::availablePackages( const QString &server ) | 144 | OPackageList *OIpkg::availablePackages( const QString &server ) |
148 | { | 145 | { |
149 | // Load Ipkg configuration info if not already cached | 146 | // Load Ipkg configuration info if not already cached |
150 | if ( !m_confInfo ) | 147 | if ( !m_confInfo ) |
151 | loadConfiguration(); | 148 | loadConfiguration(); |
152 | 149 | ||
153 | // Build new server list (caller is responsible for deleting) | 150 | // Build new server list (caller is responsible for deleting) |
154 | OPackageList *pl = new OPackageList; | 151 | OPackageList *pl = new OPackageList; |
155 | 152 | ||
156 | // Open package list file | 153 | // Open package list file |
157 | QFile f( IPKG_PKG_PATH + "/" + server ); | 154 | QFile f( IPKG_PKG_PATH + "/" + server ); |
158 | if ( !f.open( IO_ReadOnly ) ) | 155 | if ( !f.open( IO_ReadOnly ) ) |
159 | return NULL; | 156 | return NULL; |
160 | QTextStream t( &f ); | 157 | QTextStream t( &f ); |
161 | 158 | ||
162 | // Process all information in package list file | 159 | // Process all information in package list file |
163 | OPackage *package = NULL; | 160 | OPackage *package = NULL; |
164 | QString line = t.readLine(); | 161 | QString line = t.readLine(); |
165 | while ( !t.eof() ) | 162 | while ( !t.eof() ) |
166 | { | 163 | { |
167 | // Determine key/value pair | 164 | // Determine key/value pair |
168 | int pos = line.find( ':', 0 ); | 165 | int pos = line.find( ':', 0 ); |
169 | QString key; | 166 | QString key; |
170 | if ( pos > -1 ) | 167 | if ( pos > -1 ) |
171 | key = line.mid( 0, pos ); | 168 | key = line.mid( 0, pos ); |
172 | else | 169 | else |
173 | key = QString::null; | 170 | key = QString::null; |
174 | QString value = line.mid( pos+2, line.length()-pos ); | 171 | QString value = line.mid( pos+2, line.length()-pos ); |
175 | 172 | ||
176 | // Allocate new package and insert into list | 173 | // Allocate new package and insert into list |
177 | if ( package == NULL && !key.isEmpty() ) | 174 | if ( package == NULL && !key.isEmpty() ) |
178 | { | 175 | { |
179 | package = new OPackage( value ); | 176 | package = new OPackage( value ); |
180 | package->setSource( server ); | 177 | package->setSource( server ); |
181 | pl->append( package ); | 178 | pl->append( package ); |
182 | } | 179 | } |
183 | 180 | ||
184 | // Update package data | 181 | // Update package data |
185 | if ( key == "Package" ) | 182 | if ( key == "Package" ) |
186 | package->setName( value ); | 183 | package->setName( value ); |
187 | else if ( key == "Version" ) | 184 | else if ( key == "Version" ) |
188 | package->setVersion( value ); | 185 | package->setVersion( value ); |
189 | else if ( key == "Section" ) | 186 | else if ( key == "Section" ) |
190 | package->setCategory( value ); | 187 | package->setCategory( value ); |
191 | //DataManager::setAvailableCategories( value ); | 188 | //DataManager::setAvailableCategories( value ); |
192 | else if ( key.isEmpty() && value.isEmpty() ) | 189 | else if ( key.isEmpty() && value.isEmpty() ) |
193 | package = NULL; | 190 | package = NULL; |
194 | 191 | ||
195 | // Skip past all description lines | 192 | // Skip past all description lines |
196 | if ( key == "Description" ) | 193 | if ( key == "Description" ) |
197 | { | 194 | { |
198 | line = t.readLine(); | 195 | line = t.readLine(); |
199 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) | 196 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) |
200 | line = t.readLine(); | 197 | line = t.readLine(); |
201 | } | 198 | } |
202 | else | 199 | else |
203 | line = t.readLine(); | 200 | line = t.readLine(); |
204 | } | 201 | } |
205 | 202 | ||
206 | f.close(); | 203 | f.close(); |
207 | 204 | ||
208 | return pl; | 205 | return pl; |
209 | } | 206 | } |
210 | 207 | ||
211 | OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) | 208 | OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) |
212 | { | 209 | { |
213 | // Load Ipkg configuration info if not already cached | 210 | // Load Ipkg configuration info if not already cached |
214 | if ( !m_confInfo ) | 211 | if ( !m_confInfo ) |
215 | loadConfiguration(); | 212 | loadConfiguration(); |
216 | 213 | ||
217 | // Build new server list (caller is responsible for deleting) | 214 | // Build new server list (caller is responsible for deleting) |
218 | OPackageList *pl = new OPackageList; | 215 | OPackageList *pl = new OPackageList; |
219 | 216 | ||
220 | // Open status file | 217 | // Open status file |
221 | QString path = destPath; | 218 | QString path = destPath; |
222 | if ( path.right( 1 ) != "/" ) | 219 | if ( path.right( 1 ) != "/" ) |
223 | path.append( "/" ); | 220 | path.append( "/" ); |
224 | path.append( IPKG_STATUS_PATH ); | 221 | path.append( IPKG_STATUS_PATH ); |
225 | 222 | ||
226 | QFile f( path ); | 223 | QFile f( path ); |
227 | if ( !f.open( IO_ReadOnly ) ) | 224 | if ( !f.open( IO_ReadOnly ) ) |
228 | return NULL; | 225 | return NULL; |
229 | QTextStream t( &f ); | 226 | QTextStream t( &f ); |