Kaydet (Commit) 0618c676 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Paket kurulumu öncesi tam bilgilendirme.

Şu değerler artık paket işlemleri sırasında listelenecek: indirilecek toplam paket boyutu, indirilecek paketlerden önceden indirilmiş olanı; kurulum/güncelleme sonrası gereken boş disk alanı; silme işleminden sonra diskte açılacak yer.
üst 9ae41c53
......@@ -17,12 +17,12 @@ INARY 2.0 Yol Haritası ve Yapılacaklar
/ Fix ctx.ui functions:
/ ctx.ui içindeki fonksiyonlar düzenlenmeli. Bazıları çok canavarca kullanılmış.
+ ctx.ui.notify düzenlemesi
- Paket kurulması öncesi tam bilgilendirme.
+ Paket kurulması öncesi tam bilgilendirme.
+ İndirilecek boyutu yazdır.
+ İndirilmiş boyutu yazdır.
- Eğer paket kurulacak ise toplam install.tar.xz boyutunu yazdır.
- Eğer update yapılacak ise değişecek boyutu yazdır.
- Silecek paketin ne kadar yer açacağını yazdır.
+ Eğer paket kurulacak ise toplam install.tar.xz boyutunu yazdır.
+ Eğer update yapılacak ise değişecek boyutu yazdır.
+ Silecek paketin ne kadar yer açacağını yazdır.
- Biraz daha anlaşılır paket yapılandırmaları.
- Mevcut Comar forku olan SCOM kodunda uygun düzenlemeler yaparak hangi script nerede hata
oluşturdu ise geri çevir.
......
......@@ -158,7 +158,7 @@ from inary.fetcher import fetch
from inary.operations.build import build, build_until
from inary.operations.check import check
from inary.operations.emerge import emerge
from inary.operations.helper import calculate_download_sizes, get_package_requirements
from inary.operations.helper import calculate_download_sizes, calculate_free_space_needed, get_package_requirements
from inary.operations.history import takeback, get_takeback_plan, snapshot
from inary.operations.info import info
from inary.operations.install import install, get_install_order
......
......@@ -189,7 +189,7 @@ class Install(AtomicOperation):
total_size, symbol = util.human_readable_size(util.free_space())
if util.free_space() < self.installedSize:
raise Error(_("Is there enought free space in your disk."))
ctx.ui.info(_("Free Space: {:.2f} {} ".format(total_size, symbol)), verbose=True)
ctx.ui.info(_("Free space in \'destinationdirectory\': {:.2f} {} ".format(total_size, symbol)), verbose=True)
# what to do if / is split into /usr, /var, etc.
# check scom
......
......@@ -169,7 +169,7 @@ class CLI(inary.ui.UI):
while True:
tty.tcflush(sys.stdin.fileno(), 0)
prompt = msg + util.colorize(" "+_('(yes'), 'green') + '/' + util.colorize(_('no)'), 'red')
prompt = msg + util.colorize(" "+_('(yes'), 'green') + '/' + util.colorize(_('no)'), 'red') + ": "
s = input(prompt)
if yes_expr.search(s):
......
......@@ -76,6 +76,39 @@ def expand_src_components(A):
Ap.add(x)
return Ap
def calculate_free_space_needed(order):
total_needed = 0
installdb = inary.db.installdb.InstallDB()
packagedb = inary.db.packagedb.PackageDB()
for pkg in [packagedb.get_package(name) for name in order]:
if installdb.has_package(pkg.name):
(version, release, build, distro, distro_release) = installdb.get_version_and_distro_release(pkg.name)
# inary distro upgrade should not use delta support
if distro == pkg.distribution and distro_release == pkg.distributionRelease:
delta = pkg.get_delta(release)
ignore_delta = ctx.config.values.general.ignore_delta
installed_release_size = installdb.get_package(pkg.name).installedSize
if delta and not ignore_delta:
pkg_size = delta.installedSize
else:
pkg_size = pkg.installedSize - installed_release_size
total_needed += pkg_size
else:
total_needed += int(packagedb.get_package(pkg.name).installedSize)
needed, symbol = util.human_readable_size(total_needed)
if total_needed < 0:
ctx.ui.info(_("{:.2f} {} space will be freed.").format(needed, symbol), color='cyan')
else:
ctx.ui.info(_("{:.2f} {} space will be used.").format(needed, symbol), color='cyan')
return total_needed
def calculate_download_sizes(order):
total_size = cached_size = 0
......
......@@ -74,6 +74,7 @@ def install_pkg_names(A, reinstall=False, extra=False):
ctx.ui.info(util.format_by_columns(sorted(order)))
operations.helper.calculate_download_sizes(order)
operations.helper.calculate_free_space_needed(order)
if ctx.get_option('dry_run'):
return True
......
......@@ -77,13 +77,26 @@ def remove(A, ignore_dep=False, ignore_safety=False):
order = A
ctx.ui.info(_("""The following list of packages will be removed
in the respective order to satisfy dependencies:
""") + util.strlist(order))
in the respective order to satisfy dependencies:"""), color='green')
ctx.ui.info(util.strlist(order))
if len(order) > len(A_0):
if not ctx.ui.confirm(_('Do you want to continue?')):
if not ctx.ui.confirm(_('Would you like to continue??')):
ctx.ui.warning(_('Package removal declined'))
return False
removal_size = 0
for pkg in [installdb.get_package(name) for name in order]:
removal_size += pkg.installedSize
removal_size, symbol = util.human_readable_size(removal_size)
ctx.ui.info(_('{:.2f} {} space will be freed.').format(removal_size, symbol), color='cyan')
del removal_size, symbol
if not ctx.ui.confirm(_("Would you like to continue?")):
ctx.ui.warning(_('Package removal declined'))
return False
if ctx.get_option('dry_run'):
return
......
......@@ -192,6 +192,8 @@ def upgrade(A=None, repo=None):
ctx.ui.info(util.format_by_columns(sorted(order)))
operations.helper.calculate_download_sizes(order)
operations.helper.calculate_free_space_needed(order)
needs_confirm = check_update_actions(order)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment