1 : #ifndef EPT_DEBTAGS_PKGIDINDEXER_H
2 : #define EPT_DEBTAGS_PKGIDINDEXER_H
3 :
4 : /** @file
5 : * @author Enrico Zini <enrico@enricozini.org>
6 : * Rebuild and maintain the map from package IDs to package names
7 : */
8 :
9 : /*
10 : * Copyright (C) 2003-2007 Enrico Zini <enrico@debian.org>
11 : *
12 : * This program is free software; you can redistribute it and/or modify
13 : * it under the terms of the GNU General Public License as published by
14 : * the Free Software Foundation; either version 2 of the License, or
15 : * (at your option) any later version.
16 : *
17 : * This program is distributed in the hope that it will be useful,
18 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 : * GNU General Public License for more details.
21 : *
22 : * You should have received a copy of the GNU General Public License
23 : * along with this program; if not, write to the Free Software
24 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 : */
26 :
27 : #include <ept/popcon/maint/sourcedir.h>
28 : #include <string>
29 :
30 : namespace ept {
31 : namespace popcon {
32 :
33 : struct InfoStruct
34 : {
35 : size_t submissions;
36 : };
37 :
38 : struct PopconIndexer
39 7 : {
40 : SourceDir mainSource;
41 : SourceDir userSource;
42 : time_t ts_main_src;
43 : time_t ts_user_src;
44 : time_t ts_main_sco;
45 : time_t ts_user_sco;
46 : time_t ts_main_idx;
47 : time_t ts_user_idx;
48 :
49 28 : time_t sourceTimestamp() const
50 : {
51 28 : time_t res = ts_main_src;
52 28 : if (ts_user_src > res) res = ts_user_src;
53 28 : return res;
54 :
55 : }
56 : bool needsRebuild() const;
57 : bool rebuild(const std::string& scofname, const std::string& idxfname);
58 : bool rebuildIfNeeded();
59 : bool getUpToDatePopcon(std::string& scofname, std::string& idxfname);
60 :
61 : bool userIndexIsRedundant() const;
62 : bool deleteRedundantUserIndex();
63 :
64 : void rescan();
65 :
66 : PopconIndexer();
67 :
68 : static bool obtainWorkingPopcon(std::string& scofname, std::string& idxfname);
69 : };
70 :
71 : }
72 : }
73 :
74 : // vim:set ts=4 sw=4:
75 : #endif
|