From 7c74d2e66fd96efe81426a9dfbf42152704fd7f8 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 12 Feb 2021 17:19:08 +0000 Subject: [PATCH] Drop unused filelist module Signed-off-by: Michael Tremer --- Makefile.am | 1 - src/pakfire/filelist.py | 159 ---------------------------------------- 2 files changed, 160 deletions(-) delete mode 100644 src/pakfire/filelist.py diff --git a/Makefile.am b/Makefile.am index 8f16add31..4727ce55b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -127,7 +127,6 @@ pakfire_PYTHON = \ src/pakfire/distro.py \ src/pakfire/downloaders.py \ src/pakfire/errors.py \ - src/pakfire/filelist.py \ src/pakfire/http.py \ src/pakfire/hub.py \ src/pakfire/i18n.py \ diff --git a/src/pakfire/filelist.py b/src/pakfire/filelist.py deleted file mode 100644 index 43627cab2..000000000 --- a/src/pakfire/filelist.py +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/python3 -############################################################################### -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2011 Pakfire development team # -# # -# 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 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### - -import tarfile - -TYPE_REG = tarfile.REGTYPE # regular file -TYPE_AREG = tarfile.AREGTYPE # regular file -TYPE_LNK = tarfile.LNKTYPE # link (inside tarfile) -TYPE_SYM = tarfile.SYMTYPE # symbolic link -TYPE_CHR = tarfile.CHRTYPE # character special device -TYPE_BLK = tarfile.BLKTYPE # block special device -TYPE_DIR = tarfile.DIRTYPE # directory -TYPE_FIFO = tarfile.FIFOTYPE # fifo special device -TYPE_CONT = tarfile.CONTTYPE # contiguous file - -TYPE_DIR_INT = int(TYPE_DIR) - -class _File(object): - def __init__(self, pakfire): - self.pakfire = pakfire - - def __cmp__(self, other): - ret = cmp(self.name, other.name) - - if not ret: - ret = cmp(self.pkg, other.pkg) - - return ret - - def is_dir(self): - # XXX TODO - # VERY POOR CHECK - return self.name.endswith("/") - - def is_config(self): - # XXX TODO - return False - - def is_datafile(self): - return False - - -class File(_File): - def __init__(self, pakfire): - _File.__init__(self, pakfire) - - self.name = "" - self.config = False - self.pkg = None - self.size = -1 - self.hash1 = None - self.type = TYPE_REG - self.mode = 0 - self.user = 0 - self.group = 0 - self.mtime = 0 - self.capabilities = None - self.datafile = False - - def is_dir(self): - return self.type == TYPE_DIR_INT \ - or self.name.endswith("/") - - def is_config(self): - return self.config - - def is_datafile(self): - return self.datafile - - -class FileDatabase(_File): - def __init__(self, pakfire, db, row_id, row=None): - _File.__init__(self, pakfire) - - self.db = db - self.row_id = row_id - self.__row = row - - @property - def row(self): - """ - Lazy fetching of the database row. - """ - if self.__row is None: - c = self.db.cursor() - c.execute("SELECT * FROM files WHERE id = ? LIMIT 1", (self.row_id,)) - - self.__row = c.fetchone() - c.close() - - return self.__row - - def is_dir(self): - return self.type == TYPE_DIR_INT \ - or self.name.endswith("/") - - def is_config(self): - return self.row["config"] == 1 - - def is_datafile(self): - return self.row["datafile"] == 1 - - @property - def pkg(self): - return self.db.get_package_by_id(self.row["pkg"]) - - @property - def name(self): - return self.row["name"] - - @property - def size(self): - return self.row["size"] - - @property - def hash1(self): - return self.row["hash1"] - - @property - def type(self): - return self.row["type"] - - @property - def mode(self): - return self.row["mode"] - - @property - def user(self): - return self.row["user"] - - @property - def group(self): - return self.row["group"] - - @property - def mtime(self): - return self.row["mtime"] - - @property - def capabilities(self): - return self.row["capabilities"] -- 2.47.2