]> git.ipfire.org Git - pakfire.git/commitdiff
Drop python implementation of repository cache
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 20 Jan 2018 13:11:50 +0000 (14:11 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 20 Jan 2018 13:12:17 +0000 (14:12 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/pakfire/repository/cache.py [deleted file]
src/pakfire/repository/remote.py

index 1b7af8691dbd44360f4ad74c63434f08fd543847..9e2ff901d2bd2b781870e54ca577458731427e30 100644 (file)
@@ -157,7 +157,6 @@ pakfire_packagesdir = $(pythondir)/pakfire/packages
 pakfire_repository_PYTHON = \
        src/pakfire/repository/__init__.py \
        src/pakfire/repository/base.py \
-       src/pakfire/repository/cache.py \
        src/pakfire/repository/database.py \
        src/pakfire/repository/local.py \
        src/pakfire/repository/metadata.py \
diff --git a/src/pakfire/repository/cache.py b/src/pakfire/repository/cache.py
deleted file mode 100644 (file)
index 23641fe..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/python
-###############################################################################
-#                                                                             #
-# 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 <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-
-import os
-import stat
-import time
-
-import pakfire.util as util
-from pakfire.constants import *
-
-class RepositoryCache(object):
-       """
-               An object that is able to cache all data that is loaded from a
-               remote repository.
-       """
-       path = REPO_CACHE_DIR
-
-       def __init__(self, pakfire, repo):
-               self.pakfire = pakfire
-               self.repo = repo
-
-               self.__created = None
-
-       @property
-       def created(self):
-               """
-                       Tells us, if the cache was already created.
-               """
-               if self.__created is None:
-                       self.__created = os.path.exists(self.path)
-
-               return self.__created
-
-       def abspath(self, path, create=True):
-               if create:
-                       self.create()
-
-               return os.path.join(self.path, path)
-
-       def create(self):
-               """
-                       Create all necessary directories.
-               """
-               # Do nothing, if the cache has already been created.
-               if self.created:
-                       return
-
-               if not os.path.exists(self.path):
-                       os.makedirs(self.path)
-
-               self.__created = True
-
-       def exists(self, filename):
-               """
-                       Returns True if a file exists and False if it doesn't.
-               """
-               return os.path.exists(self.abspath(filename))
-
-       def age(self, filename):
-               """
-                       Returns the age of a downloaded file in minutes.
-                       i.e. the time from download until now.
-               """
-               if not self.exists(filename):
-                       return None
-
-               filename = self.abspath(filename)
-
-               # Creation time of the file
-               ctime = os.stat(filename)[stat.ST_CTIME]
-
-               return (time.time() - ctime) / 60
-
-       def open(self, filename, *args, **kwargs):
-               filename = self.abspath(filename)
-
-               # Create directory if not existant.
-               dirname = os.path.dirname(filename)
-               if not os.path.exists(dirname):
-                       os.makedirs(dirname)
-
-               return open(filename, *args, **kwargs)
-
-       def hash1(self, filename):
-               """
-                       Return hash of the file in the cache.
-               """
-               return util.calc_hash1(self.abspath(filename))
-
-       def verify(self, filename, hash1):
-               """
-                       Return a bool that indicates if a file matches the given hash.
-               """
-               return self.hash1(filename) == hash1
-
-       def remove(self, filename):
-               """
-                       Remove a file from cache.
-               """
-               if not self.exists(filename):
-                       return
-
-               filename = self.abspath(filename)
-               os.unlink(filename)
-
-       def destroy(self):
-               """
-                       Remove all files from this cache.
-               """
-               if self.created:
-                       util.rm(self.path)
index 4ad4b221a867f6f25877bb9032ab307e12321f2e..6d64253a8b9f7b8f8b950fac22b77d386d81c7e5 100644 (file)
@@ -30,7 +30,6 @@ from .. import http
 from .. import util
 
 from . import base
-from . import cache
 from . import metadata
 
 from ..constants import *