pisi list-newest [--since yyyy-mm-dd] [--last Nth previous repo update]
faik@moon pisi $ pisi list-newest --since 2009-01-05 Packages added to pardus-2008-test since 2009-01-05: OpenSceneGraph - OpenGL üzerinde gerçek zamanlı grafikler oluşturmak için C++ manzara grafik API'si m5602 - Ali m5602 Kamera sürücüsü nvidia-drivers180 - GeForce 6xxx ve daha yeni NVIDIA ekran kartları için sürücüler pyFltk - FLTK kütüphanesi için Python bağlayıcıları smartcam - Smart Phone Web Kamera Uygulaması Packages added to contrib-2008 since 2009-01-05: ffmpegthumbnailer - Dosya yöneticileri için hafif görüntü önizleyicisi
This commit is contained in:
+10
@@ -189,6 +189,16 @@ def list_available(repo=None):
|
|||||||
"""
|
"""
|
||||||
return pisi.db.packagedb.PackageDB().list_packages(repo)
|
return pisi.db.packagedb.PackageDB().list_packages(repo)
|
||||||
|
|
||||||
|
def list_newest(repo=None, since=None):
|
||||||
|
"""
|
||||||
|
Return a list of newest packages in the given repository -> list_of_strings since
|
||||||
|
last update or before.
|
||||||
|
@param repo: Repository of the packages. If repo is None than returns a list of
|
||||||
|
all the newest packages from all the repositories.
|
||||||
|
@param since: yyyy-mm-dd formatted
|
||||||
|
"""
|
||||||
|
return pisi.db.packagedb.PackageDB().list_newest(repo, since)
|
||||||
|
|
||||||
def list_upgradable():
|
def list_upgradable():
|
||||||
"""
|
"""
|
||||||
Return a list of packages that are upgraded in the repository -> list_of_strings
|
Return a list of packages that are upgraded in the repository -> list_of_strings
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import pisi.cli.index
|
|||||||
import pisi.cli.info
|
import pisi.cli.info
|
||||||
import pisi.cli.install
|
import pisi.cli.install
|
||||||
import pisi.cli.history
|
import pisi.cli.history
|
||||||
|
import pisi.cli.listnewest
|
||||||
import pisi.cli.listavailable
|
import pisi.cli.listavailable
|
||||||
import pisi.cli.listcomponents
|
import pisi.cli.listcomponents
|
||||||
import pisi.cli.listinstalled
|
import pisi.cli.listinstalled
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
@@ -116,3 +118,15 @@ class HistoryDB(lazydb.LazyDB):
|
|||||||
hist = pisi.history.History(os.path.join(ctx.config.history_dir(), log))
|
hist = pisi.history.History(os.path.join(ctx.config.history_dir(), log))
|
||||||
hist.operation.no = int(log.split("_")[0])
|
hist.operation.no = int(log.split("_")[0])
|
||||||
yield hist.operation
|
yield hist.operation
|
||||||
|
|
||||||
|
def get_last_repo_update(self, last=-1):
|
||||||
|
repoupdates = filter(lambda l:l.endswith("repoupdate.xml"), self.__logs)
|
||||||
|
repoupdates.reverse()
|
||||||
|
if not len(repoupdates) >= 2:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if last != -1 and len(repoupdates) <= last:
|
||||||
|
return None
|
||||||
|
|
||||||
|
hist = pisi.history.History(os.path.join(ctx.config.history_dir(), repoupdates[-last]))
|
||||||
|
return hist.operation.date
|
||||||
|
|||||||
+21
-5
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2005 - 2007, TUBITAK/UEKAE
|
# Copyright (C) 2005 - 2009, TUBITAK/UEKAE
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it under
|
# 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
|
# the terms of the GNU General Public License as published by the Free
|
||||||
@@ -18,8 +18,10 @@ yes, we are cheap
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
import gzip
|
import gzip
|
||||||
import gettext
|
import gettext
|
||||||
|
import datetime
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
@@ -56,17 +58,17 @@ class PackageDB(lazydb.LazyDB):
|
|||||||
|
|
||||||
def __generate_replaces(self, doc):
|
def __generate_replaces(self, doc):
|
||||||
return [x.getTagData("Name") for x in doc.tags("Package") if x.getTagData("Replaces")]
|
return [x.getTagData("Name") for x in doc.tags("Package") if x.getTagData("Replaces")]
|
||||||
|
|
||||||
def __generate_obsoletes(self, doc):
|
def __generate_obsoletes(self, doc):
|
||||||
distribution = doc.getTag("Distribution")
|
distribution = doc.getTag("Distribution")
|
||||||
obsoletes = distribution and distribution.getTag("Obsoletes")
|
obsoletes = distribution and distribution.getTag("Obsoletes")
|
||||||
src_repo = doc.getTag("SpecFile") is not None
|
src_repo = doc.getTag("SpecFile") is not None
|
||||||
|
|
||||||
if not obsoletes or src_repo:
|
if not obsoletes or src_repo:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
return map(lambda x: x.firstChild().data(), obsoletes.tags("Package"))
|
return map(lambda x: x.firstChild().data(), obsoletes.tags("Package"))
|
||||||
|
|
||||||
def __generate_packages(self, doc):
|
def __generate_packages(self, doc):
|
||||||
return dict(map(lambda x: (x.getTagData("Name"), gzip.zlib.compress(x.toString())), doc.tags("Package")))
|
return dict(map(lambda x: (x.getTagData("Name"), gzip.zlib.compress(x.toString())), doc.tags("Package")))
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@ class PackageDB(lazydb.LazyDB):
|
|||||||
|
|
||||||
def get_obsoletes(self, repo=None):
|
def get_obsoletes(self, repo=None):
|
||||||
return self.odb.get_list_item(repo)
|
return self.odb.get_list_item(repo)
|
||||||
|
|
||||||
def get_rev_deps(self, name, repo=None):
|
def get_rev_deps(self, name, repo=None):
|
||||||
try:
|
try:
|
||||||
rvdb = self.rvdb.get_item(name, repo)
|
rvdb = self.rvdb.get_item(name, repo)
|
||||||
@@ -155,3 +157,17 @@ class PackageDB(lazydb.LazyDB):
|
|||||||
|
|
||||||
def list_packages(self, repo):
|
def list_packages(self, repo):
|
||||||
return self.pdb.get_item_keys(repo)
|
return self.pdb.get_item_keys(repo)
|
||||||
|
|
||||||
|
def list_newest(self, repo, since=None):
|
||||||
|
packages = []
|
||||||
|
historydb = pisi.db.historydb.HistoryDB()
|
||||||
|
if since:
|
||||||
|
since_date = datetime.datetime(*time.strptime(since, "%Y-%m-%d")[0:6])
|
||||||
|
else:
|
||||||
|
since_date = datetime.datetime(*time.strptime(historydb.get_last_repo_update(), "%Y-%m-%d")[0:6])
|
||||||
|
|
||||||
|
for pkg in self.list_packages(repo):
|
||||||
|
enter_date = datetime.datetime(*time.strptime(self.get_package(pkg).history[-1].date, "%Y-%m-%d")[0:6])
|
||||||
|
if enter_date >= since_date:
|
||||||
|
packages.append(pkg)
|
||||||
|
return packages
|
||||||
|
|||||||
Reference in New Issue
Block a user