]>
git.ipfire.org Git - pakfire.git/blob - python/pakfire/filelist.py
2 ###############################################################################
4 # Pakfire - The IPFire package management system #
5 # Copyright (C) 2011 Pakfire development team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 TYPE_REG
= tarfile
.REGTYPE
# regular file
25 TYPE_AREG
= tarfile
.AREGTYPE
# regular file
26 TYPE_LNK
= tarfile
.LNKTYPE
# link (inside tarfile)
27 TYPE_SYM
= tarfile
.SYMTYPE
# symbolic link
28 TYPE_CHR
= tarfile
.CHRTYPE
# character special device
29 TYPE_BLK
= tarfile
.BLKTYPE
# block special device
30 TYPE_DIR
= tarfile
.DIRTYPE
# directory
31 TYPE_FIFO
= tarfile
.FIFOTYPE
# fifo special device
32 TYPE_CONT
= tarfile
.CONTTYPE
# contiguous file
35 def __init__(self
, pakfire
):
36 self
.pakfire
= pakfire
38 def __cmp__(self
, other
):
39 ret
= cmp(self
.name
, other
.name
)
42 ret
= cmp(self
.pkg
, other
.pkg
)
49 return self
.name
.endswith("/")
57 def __init__(self
, pakfire
):
58 _File
.__init
__(self
, pakfire
)
75 class FileDatabase(_File
):
76 def __init__(self
, pakfire
, db
, row_id
):
77 _File
.__init
__(self
, pakfire
)
87 Lazy fetching of the database row.
89 if self
.__row
is None:
91 c
.execute("SELECT * FROM files WHERE id = ? LIMIT 1", (self
.row_id
,))
93 # Check if we got the same row.
94 #assert c.lastrowid == self.row_id
105 return self
.row
["config"] == 1
109 return self
.db
.get_package_by_id(self
.row
["pkg"])
113 return self
.row
["name"]
117 return self
.row
["size"]
121 return self
.row
["hash1"]
125 return self
.row
["type"]
129 return self
.row
["mode"]
133 return self
.row
["user"]
137 return self
.row
["group"]
141 return self
.row
["mtime"]