From: "Wiktor W Brodlo" <wiktor@brodlo.net>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/anaconda:master commit in: gentoo/
Date: Sat, 25 Jun 2011 01:42:14 +0000 (UTC) [thread overview]
Message-ID: <607de627ad6a60288f14dd89f38458d701d738e3.wiktor@gentoo> (raw)
commit: 607de627ad6a60288f14dd89f38458d701d738e3
Author: wiktor w brodlo <wiktor <AT> brodlo <DOT> net>
AuthorDate: Sat Jun 25 01:40:54 2011 +0000
Commit: Wiktor W Brodlo <wiktor <AT> brodlo <DOT> net>
CommitDate: Sat Jun 25 01:40:54 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/anaconda.git;a=commit;h=607de627
Portage install method version 1 ;-)
---
gentoo/__init__.py | 126 +++++++--------------------------------------------
1 files changed, 18 insertions(+), 108 deletions(-)
diff --git a/gentoo/__init__.py b/gentoo/__init__.py
index 629cba8..1cb23d9 100644
--- a/gentoo/__init__.py
+++ b/gentoo/__init__.py
@@ -1,8 +1,9 @@
#
-# gentoo.py: Gentoo Linux Anaconda install method backend
+# gentoo/__init__.py: Gentoo Portage Anaconda install method backend
#
#
-# Copyright (C) 2010 Fabio Erculiani
+# Copyright (C) 2011 wiktor w brodlo <wiktor@brodlo.net>
+# Copyright (C) 2011 Gentoo Foundation
#
# 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
@@ -21,113 +22,22 @@
import os
import sys
-# add Entropy module path to PYTHONPATH
-sys.path.insert(0, '/usr/lib/entropy/libraries')
+class Portage:
-# Entropy Interface
-from entropy.client.interfaces import Client
-from entropy.output import nocolor
-from entropy.fetchers import UrlFetcher
-import entropy.tools
+ def __init__(self, terminal):
+ self.term = terminal
+ # chroot into the new installation if not already there
+ self.term.run_command("chroot "+os.environ["ANACONDA_PRODUCTPATH"]+" 2> /dev/null")
-class Entropy(Client):
+ # Syncs the Portage tree and updates Portage if an update is available
+ def sync(self):
+ self.term.run_command("emerge --sync")
+ self.term.run_command("emerge --update portage")
- def init_singleton(self):
- self._progress = None
- self.oldcount = []
- Client.init_singleton(self, xcache = False,
- url_fetcher = InstallerUrlFetcher)
- nocolor()
+ # Installs a package atom
+ def install(self, atom):
+ terminal.run_command("emerge "+atom)
- def connect_progress(self, progress):
- self._progress = progress
-
- def output(self, text, header = "", footer = "", back = False,
- importance = 0, level = "info", count = None, percent = False):
-
- if not self._progress:
- return
-
- if not self.oldcount:
- self.oldcount = [0,100]
-
- progress_text = text
- if count:
- try:
- self.oldcount = int(count[0]),int(count[1])
- except:
- self.oldcount = [0,100]
- if not percent:
- count_str = "(%s/%s) " % (str(count[0]),str(count[1]),)
- progress_text = count_str+progress_text
-
- percentage = float(self.oldcount[0])/self.oldcount[1] * 100
- percentage = round(percentage, 2)
- self._progress.set_fraction(percentage)
- self._progress.set_text(progress_text)
-
- def is_installed(self, package_name):
- match = self.installed_repository().atomMatch(package_name)
- if match[0] != -1:
- return True
- return False
-
- @staticmethod
- def is_corecd():
- if os.path.isfile("/etc/gentoo-edition"):
- f = open("/etc/gentoo-edition","r")
- cnt = f.readline().strip()
- f.close()
- if cnt.lower().find("core") != -1:
- return True
- return False
-
- @staticmethod
- def is_gentoo_mce():
- with open("/proc/cmdline", "r") as cmd_f:
- args = cmd_f.readline().strip().split()
- for tstr in ("mceinstall", "gentoomce"):
- if tstr in args:
- return True
- return False
-
-# in this way, any singleton class that tries to directly load Client
-# gets Entropy in change
-Client.__singleton_class__ = Entropy
-
-class InstallerUrlFetcher(UrlFetcher):
-
- gui_last_avg = 0
-
- def handle_statistics(self, th_id, downloaded_size, total_size,
- average, old_average, update_step, show_speed, data_transfer,
- time_remaining, time_remaining_secs):
- self.__average = average
- self.__downloadedsize = downloaded_size
- self.__remotesize = total_size
- self.__datatransfer = data_transfer
-
- def output(self):
- """ backward compatibility """
- return self.update()
-
- def update(self):
-
- myavg = abs(int(round(float(self.__average), 1)))
- if abs((myavg - InstallerUrlFetcher.gui_last_avg)) < 1:
- return
-
- if (myavg > InstallerUrlFetcher.gui_last_avg) or (myavg < 2) or \
- (myavg > 97):
-
- cur_prog = float(self.__average)/100
- cur_prog_str = str(int(self.__average))
-
- human_dt = entropy.tools.bytes_into_human(self.__datatransfer)
- prog_str = "%s/%s kB @ %s" % (
- str(round(float(self.__downloadedsize)/1024, 1)),
- str(round(self.__remotesize, 1)),
- str(human_dt) + "/sec",
- )
- Entropy().output(prog_str)
- InstallerUrlFetcher.gui_last_avg = myavg
+ # Updates world
+ def update_world(self):
+ terminal.run_command("emerge --deep --newuse --update world")
next reply other threads:[~2011-06-25 1:42 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-25 1:42 Wiktor W Brodlo [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-06-26 19:05 [gentoo-commits] proj/anaconda:master commit in: gentoo/ Wiktor W Brodlo
2011-06-26 21:03 Wiktor W Brodlo
2011-06-26 21:03 Wiktor W Brodlo
2011-06-26 21:08 Wiktor W Brodlo
2011-06-26 23:28 Wiktor W Brodlo
2011-06-26 23:40 Wiktor W Brodlo
2011-06-27 0:03 Wiktor W Brodlo
2011-06-27 0:05 Wiktor W Brodlo
2011-06-27 0:20 Wiktor W Brodlo
2011-06-27 13:49 Wiktor W Brodlo
2011-06-27 18:27 Wiktor W Brodlo
2011-06-27 19:20 Wiktor W Brodlo
2011-07-04 16:59 Wiktor W Brodlo
2011-07-04 20:52 Wiktor W Brodlo
2011-07-04 20:56 Wiktor W Brodlo
2011-07-04 21:02 Wiktor W Brodlo
2011-07-04 21:19 Wiktor W Brodlo
2011-07-04 22:24 Wiktor W Brodlo
2011-07-04 22:34 Wiktor W Brodlo
2011-07-04 22:47 Wiktor W Brodlo
2011-07-05 12:53 Wiktor W Brodlo
2011-07-05 13:20 Wiktor W Brodlo
2011-07-05 13:22 Wiktor W Brodlo
2011-07-05 13:29 Wiktor W Brodlo
2011-07-05 13:55 Wiktor W Brodlo
2011-07-05 14:07 Wiktor W Brodlo
2011-07-05 14:31 Wiktor W Brodlo
2011-07-05 15:38 Wiktor W Brodlo
2011-07-05 16:09 Wiktor W Brodlo
2011-07-05 18:48 Wiktor W Brodlo
2011-07-05 20:45 Wiktor W Brodlo
2011-07-06 11:19 Wiktor W Brodlo
2011-07-06 11:51 Wiktor W Brodlo
2011-07-06 14:31 Wiktor W Brodlo
2011-07-06 16:42 Wiktor W Brodlo
2011-07-06 18:20 Wiktor W Brodlo
2011-07-06 20:46 Wiktor W Brodlo
2011-07-07 2:31 Wiktor W Brodlo
2011-07-07 14:08 Wiktor W Brodlo
2011-07-07 15:40 Wiktor W Brodlo
2011-07-07 23:57 Wiktor W Brodlo
2011-07-08 0:49 Wiktor W Brodlo
2011-07-08 1:42 Wiktor W Brodlo
2011-07-08 2:35 Wiktor W Brodlo
2011-07-08 3:28 Wiktor W Brodlo
2011-07-08 14:48 Wiktor W Brodlo
2011-07-08 15:27 Wiktor W Brodlo
2011-07-08 15:56 Wiktor W Brodlo
2011-07-08 17:19 Wiktor W Brodlo
2011-07-08 17:54 Wiktor W Brodlo
2011-07-08 22:07 Wiktor W Brodlo
2011-07-10 3:18 Wiktor W Brodlo
2011-07-10 12:13 Wiktor W Brodlo
2011-07-10 15:36 Wiktor W Brodlo
2011-07-11 17:53 Wiktor W Brodlo
2011-07-11 17:53 Wiktor W Brodlo
2011-07-11 17:53 Wiktor W Brodlo
2011-07-12 1:09 Wiktor W Brodlo
2011-07-12 3:31 Wiktor W Brodlo
2011-07-21 20:53 Wiktor W Brodlo
2011-07-21 21:14 Wiktor W Brodlo
2011-07-21 22:02 Wiktor W Brodlo
2011-07-21 22:18 Wiktor W Brodlo
2011-08-11 12:58 Wiktor W Brodlo
2011-08-17 0:25 Wiktor W Brodlo
2011-08-21 0:03 Wiktor W Brodlo
2011-08-21 0:03 Wiktor W Brodlo
2011-08-21 0:03 Wiktor W Brodlo
2011-08-21 0:34 Wiktor W Brodlo
2011-08-21 1:13 Wiktor W Brodlo
2011-08-21 1:20 Wiktor W Brodlo
2011-08-21 1:30 Wiktor W Brodlo
2011-08-22 4:28 Wiktor W Brodlo
2011-08-22 4:28 Wiktor W Brodlo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=607de627ad6a60288f14dd89f38458d701d738e3.wiktor@gentoo \
--to=wiktor@brodlo.net \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox