blob: 2fe75bcc600f67d663e2b6c69278a06a05623e70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include <qpe/config.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <qstringlist.h>
#include "packagelistlocal.h"
PackageListLocal::PackageListLocal()
: PackageList()
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
statusDir = cfg.readEntry( "statusDir", "" );
listsDir = cfg.readEntry( "listsDir", "" );
if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() )
{
statusDir="/usr/lib/ipkg/";
listsDir="/usr/lib/ipkg/lists/";
cfg.writeEntry( "statusDir", statusDir );
cfg.writeEntry( "listsDir", listsDir );
}
}
PackageListLocal::PackageListLocal(PackageManagerSettings* s)
: PackageList(s)
{
PackageListLocal();
}
PackageListLocal::~PackageListLocal()
{
}
void PackageListLocal::parseStatus()
{
QStringList dests = settings->getDestinationUrls();
QStringList destnames = settings->getDestinationNames();
QStringList::Iterator name = destnames.begin();
for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
{
pvDebug( 2,"Status: "+*dir+statusDir+"/status");
readFileEntries( *dir+statusDir+"/status", *name );
++name;
};
}
void PackageListLocal::parseList()
{
QStringList srvs = settings->getActiveServers();
for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
{
pvDebug( 2, "List: "+listsDir+"/"+*it);
readFileEntries( listsDir+"/"+*it );
}
}
void PackageListLocal::update()
{
pvDebug( 2, "parseStatus");
parseStatus();
pvDebug( 2, "parseList "+listsDir);
parseList();
pvDebug( 2, "finished parsing");
}
|