author | drw <drw> | 2004-09-09 14:15:52 (UTC) |
---|---|---|
committer | drw <drw> | 2004-09-09 14:15:52 (UTC) |
commit | 317734f41201bf25fa3a1b38c2867bb9557053b9 (patch) (unidiff) | |
tree | 7ce5e9d735483415f42b15ae6939e37e8fc35a0c | |
parent | 4e798036b423bcb8800f125357591e48b84594c8 (diff) | |
download | opie-317734f41201bf25fa3a1b38c2867bb9557053b9.zip opie-317734f41201bf25fa3a1b38c2867bb9557053b9.tar.gz opie-317734f41201bf25fa3a1b38c2867bb9557053b9.tar.bz2 |
Fix for too much verbosity while performing ipkg functions. Thanks to Seb for fix
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index eca5861..1978ad5 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -1,148 +1,150 @@ | |||
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 <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
37 | 37 | ||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | 39 | ||
40 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 40 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
41 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 41 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
42 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 42 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
43 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 43 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
44 | 44 | ||
45 | OIpkg *oipkg; | 45 | OIpkg *oipkg; |
46 | 46 | ||
47 | // Ipkg callback functions | 47 | // Ipkg callback functions |
48 | 48 | ||
49 | int fsignalIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) | 49 | int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) |
50 | { | 50 | { |
51 | oipkg->ipkgMessage( msg ); | 51 | if ( conf && ( conf->verbosity < level ) ) |
52 | return 0; | 52 | return 0; |
53 | else | ||
54 | oipkg->ipkgMessage( msg ); | ||
53 | } | 55 | } |
54 | 56 | ||
55 | char *fIpkgResponse( char */*question*/ ) | 57 | char *fIpkgResponse( char */*question*/ ) |
56 | { | 58 | { |
57 | return 0x0; | 59 | return 0x0; |
58 | } | 60 | } |
59 | 61 | ||
60 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) | 62 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) |
61 | { | 63 | { |
62 | oipkg->ipkgStatus( desc ); | 64 | oipkg->ipkgStatus( desc ); |
63 | return 0; | 65 | return 0; |
64 | } | 66 | } |
65 | 67 | ||
66 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, | 68 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, |
67 | void */*userdata*/ ) | 69 | void */*userdata*/ ) |
68 | { | 70 | { |
69 | oipkg->ipkgList( desc ); | 71 | oipkg->ipkgList( desc ); |
70 | return 0; | 72 | return 0; |
71 | } | 73 | } |
72 | 74 | ||
73 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 75 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
74 | : QObject( parent, name ) | 76 | : QObject( parent, name ) |
75 | , m_config( config ) | 77 | , m_config( config ) |
76 | , m_confInfo( NULL ) | 78 | , m_confInfo( NULL ) |
77 | , m_ipkgExecOptions( 0 ) | 79 | , m_ipkgExecOptions( 0 ) |
78 | , m_ipkgExecVerbosity( 1 ) | 80 | , m_ipkgExecVerbosity( 1 ) |
79 | { | 81 | { |
80 | oipkg = this; | 82 | oipkg = this; |
81 | 83 | ||
82 | // Initialize libipkg | 84 | // Initialize libipkg |
83 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); | 85 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); |
84 | 86 | ||
85 | // Default ipkg run-time arguments | 87 | // Default ipkg run-time arguments |
86 | m_ipkgArgs.noaction = false; | 88 | m_ipkgArgs.noaction = false; |
87 | m_ipkgArgs.force_defaults = true; | 89 | m_ipkgArgs.force_defaults = true; |
88 | } | 90 | } |
89 | 91 | ||
90 | OIpkg::~OIpkg() | 92 | OIpkg::~OIpkg() |
91 | { | 93 | { |
92 | // Upon destruction, ensure that items in config list are deleted with list | 94 | // Upon destruction, ensure that items in config list are deleted with list |
93 | if ( m_confInfo ) | 95 | if ( m_confInfo ) |
94 | m_confInfo->setAutoDelete( true ); | 96 | m_confInfo->setAutoDelete( true ); |
95 | 97 | ||
96 | // Free up libipkg resources | 98 | // Free up libipkg resources |
97 | ipkg_deinit( &m_ipkgArgs ); | 99 | ipkg_deinit( &m_ipkgArgs ); |
98 | } | 100 | } |
99 | 101 | ||
100 | OConfItemList *OIpkg::configItems() | 102 | OConfItemList *OIpkg::configItems() |
101 | { | 103 | { |
102 | // Retrieve all configuration items | 104 | // Retrieve all configuration items |
103 | return filterConfItems(); | 105 | return filterConfItems(); |
104 | } | 106 | } |
105 | 107 | ||
106 | OConfItemList *OIpkg::servers() | 108 | OConfItemList *OIpkg::servers() |
107 | { | 109 | { |
108 | // Retrieve only servers | 110 | // Retrieve only servers |
109 | return filterConfItems( OConfItem::Source ); | 111 | return filterConfItems( OConfItem::Source ); |
110 | } | 112 | } |
111 | 113 | ||
112 | OConfItemList *OIpkg::destinations() | 114 | OConfItemList *OIpkg::destinations() |
113 | { | 115 | { |
114 | // Retrieve only destinations | 116 | // Retrieve only destinations |
115 | return filterConfItems( OConfItem::Destination ); | 117 | return filterConfItems( OConfItem::Destination ); |
116 | } | 118 | } |
117 | 119 | ||
118 | OConfItemList *OIpkg::options() | 120 | OConfItemList *OIpkg::options() |
119 | { | 121 | { |
120 | // Retrieve only destinations | 122 | // Retrieve only destinations |
121 | return filterConfItems( OConfItem::Option ); | 123 | return filterConfItems( OConfItem::Option ); |
122 | } | 124 | } |
123 | 125 | ||
124 | void OIpkg::setConfigItems( OConfItemList *configList ) | 126 | void OIpkg::setConfigItems( OConfItemList *configList ) |
125 | { | 127 | { |
126 | if ( m_confInfo ) | 128 | if ( m_confInfo ) |
127 | delete m_confInfo; | 129 | delete m_confInfo; |
128 | 130 | ||
129 | m_confInfo = configList; | 131 | m_confInfo = configList; |
130 | 132 | ||
131 | // Write out new /etc/ipkg.conf | 133 | // Write out new /etc/ipkg.conf |
132 | QFile confFile( IPKG_CONF ); | 134 | QFile confFile( IPKG_CONF ); |
133 | if ( confFile.open( IO_WriteOnly ) ) | 135 | if ( confFile.open( IO_WriteOnly ) ) |
134 | { | 136 | { |
135 | QTextStream confStream( &confFile ); | 137 | QTextStream confStream( &confFile ); |
136 | confStream << "# Generated by Opie Package Manager\n\n"; | 138 | confStream << "# Generated by Opie Package Manager\n\n"; |
137 | 139 | ||
138 | OConfItemListIterator it( *m_confInfo ); | 140 | OConfItemListIterator it( *m_confInfo ); |
139 | for ( ; it.current(); ++it ) | 141 | for ( ; it.current(); ++it ) |
140 | { | 142 | { |
141 | OConfItem *item = it.current(); | 143 | OConfItem *item = it.current(); |
142 | 144 | ||
143 | // Only write out valid conf items | 145 | // Only write out valid conf items |
144 | if ( item->type() != OConfItem::NotDefined ) | 146 | if ( item->type() != OConfItem::NotDefined ) |
145 | { | 147 | { |
146 | QString confLine; | 148 | QString confLine; |
147 | if ( !item->active() ) | 149 | if ( !item->active() ) |
148 | confLine = "#"; | 150 | confLine = "#"; |