← Back to team overview

mythbuntu-dev team mailing list archive

[Merge] lp:~tgm4883/mythbuntu/mythbuntu-common into lp:~mythbuntu-dev/mythbuntu/mythbuntu-common

 

Thomas Mashos has proposed merging lp:~tgm4883/mythbuntu/mythbuntu-common into lp:~mythbuntu-dev/mythbuntu/mythbuntu-common.

Requested reviews:
  mythbuntu-dev (mythbuntu-dev)

For more details, see:
https://code.launchpad.net/~tgm4883/mythbuntu/mythbuntu-common/+merge/85206
-- 
https://code.launchpad.net/~tgm4883/mythbuntu/mythbuntu-common/+merge/85206
Your team mythbuntu-dev is requested to review the proposed merge of lp:~tgm4883/mythbuntu/mythbuntu-common into lp:~mythbuntu-dev/mythbuntu/mythbuntu-common.
=== modified file 'debian/changelog'
--- debian/changelog	2011-12-09 05:35:05 +0000
+++ debian/changelog	2011-12-09 23:41:23 +0000
@@ -1,14 +1,26 @@
+<<<<<<< TREE
 mythbuntu-common (0.65) precise; urgency=low
+=======
+mythbuntu-common (0.64) UNRELEASED; urgency=low
+>>>>>>> MERGE-SOURCE
 
   [ Mario Limonciello ]
   * Make sure the repos database is installed.
   * Rename the repos database to repos.db instead (mythbuntu is implied by dir)
 
+<<<<<<< TREE
   [ Thomas Mashos ]
   * Make the repos page more readable
   * Don't let the repos page fail if the db in ~ got corrupted.
 
  -- Mario Limonciello <Mario_Limonciello@xxxxxxxx>  Thu, 08 Dec 2011 23:34:55 -0600
+=======
+  [ Thomas Mashos ]
+  * Add progess bar to db download for repos
+  * Copy db file to std location for -common uninstall
+
+ -- Thomas Mashos <thomas@xxxxxxxxxx>  Fri, 09 Dec 2011 15:36:57 -0800
+>>>>>>> MERGE-SOURCE
 
 mythbuntu-common (0.64) precise; urgency=low
 

=== added file 'debian/dirs'
--- debian/dirs	1970-01-01 00:00:00 +0000
+++ debian/dirs	2011-12-09 23:41:23 +0000
@@ -0,0 +1,1 @@
+/var/lib/mythbuntu

=== modified file 'debian/prerm'
--- debian/prerm	2011-12-07 16:23:16 +0000
+++ debian/prerm	2011-12-09 23:41:23 +0000
@@ -3,21 +3,17 @@
 case "$1" in
     remove|purge)
 	release=$(lsb_release -c -s)
-	RMBLDS="`cat /usr/share/mythbuntu/plugins/mythbuntu-repos.db | grep $release | cut -f 2`"
+	RMBLDS="`cat /var/lib/mythbuntu/repos.db | grep $release | cut -f 2`"
 	for version in $RMBLDS
 	do
-		## Fixes for 0.21 and 0.22 PPA's
-	        if [ "$version" = "0.21" ]; then
-	          version="fixes-0.21"
-	        elif [ "$version" = "0.22" ]; then
-	          version="trunk-0.22"
-	        elif [ "$version" = "0.24.x" ]; then
-	          version="0.24"
-	        fi
+	  if [ "$version" = "0.24.x" ]; then
+	    version="0.24"
+	  fi
 		apt-add-repository -r -y ppa:mythbuntu/$version || true
 	done
 	apt-add-repository -r -y ppa:mythbuntu/testing || true
-    apt-add-repository -r -y ppa:mythbuntu/xmltv || true
+  apt-add-repository -r -y ppa:mythbuntu/xmltv || true
+  rm /var/lib/mythbuntu/repos.db || true
 	;;
 esac
 

=== modified file 'plugins/python/mythbuntu_repos.py'
--- plugins/python/mythbuntu_repos.py	2011-12-09 05:06:41 +0000
+++ plugins/python/mythbuntu_repos.py	2011-12-09 23:41:23 +0000
@@ -31,6 +31,7 @@
 import ConfigParser
 from bzrlib.plugin import load_plugins
 from bzrlib import branch, tree
+import time
 
 class MythbuntuReposPlugin(MCCPlugin):
     """A Plugin for adding Mythbuntu Repos"""
@@ -68,22 +69,24 @@
         NumRepos = 0
         dbfiles=[
         "/usr/share/mythbuntu/repos.db",
+        "/var/lib/mythbuntu/repos.db",
         self.USERHOME+"/.mythbuntu/repos.db"
         ]
         for f in dbfiles:
-            for line in open(f).xreadlines():
-                if distro in line:
-                    line = line.strip("\n")
-                    release, version = line.split("\t")
-                    if not version in self.versions:
-                        self.versions.append(version)
-                    NumRepos += 1
-                elif "MYTHTV_RELEASE" in line:
-                    line = line.strip("\n")
-                    VerName, self.CurVer = line.split("\t")
-                elif "TRUNKPASS" in line:
-                    line = line.strip("\n")
-                    discard, self.TRUNKPASS = line.split("\t")
+            if os.path.isfile(f):
+                for line in open(f).xreadlines():
+                    if distro in line:
+                        line = line.strip("\n")
+                        release, version = line.split("\t")
+                        if not version in self.versions:
+                            self.versions.append(version)
+                        NumRepos += 1
+                    elif "MYTHTV_RELEASE" in line:
+                        line = line.strip("\n")
+                        VerName, self.CurVer = line.split("\t")
+                    elif "TRUNKPASS" in line:
+                        line = line.strip("\n")
+                        discard, self.TRUNKPASS = line.split("\t")
         self.changes = {}
         rei = 0
         while (rei <= NumRepos):
@@ -177,6 +180,7 @@
             self._markReconfigureRoot('XMLTV-Updates-Activated', self.xmltv_updates_checkbox.get_active())
         if SENDLIST == True:
             self._markReconfigureRoot('Repo-list', self.versions)
+        self._markReconfigureRoot('copy-new-db', self.USERHOME)
 
     def refresh_button_clicked(self, widget, data=None):
         """Download a new db file if requested"""
@@ -186,11 +190,15 @@
 
     def downloadFile(self):
         """Download files"""
+        self.emit_progress("Connecting to server to download DB", 0)
+        time.sleep(.5)
         # Load the bzr plugins - the "launchpad" plugin provides support for the "lp:" shortcut
+        self.emit_progress("Connecting to server to download DB", 10)
+        time.sleep(.5)
         load_plugins()
-
+        self.emit_progress("Opening BZR branch", 20)
         b = branch.Branch.open('lp:~mythbuntu-dev/mythbuntu/mythbuntu-common')
-
+        self.emit_progress("Finding latest revision", 30)
         revision_number, revision_id = b.last_revision_info()
 
         repo = b.repository
@@ -199,14 +207,18 @@
         ## Get a revisiontree (needed to get the file)
         revtree = repo.revision_tree(revision_id)
 
+        self.emit_progress("Downloading latest DB revision", 50)
         ## Download and save file
         b.lock_read()
         fileid = revtree.path2id('repos.db')
         dbfile = open(self.USERHOME+"/.mythbuntu/repos.db", "w")
         dbfile.write(revtree.get_file(fileid).read())
         dbfile.close()
+        self.emit_progress("Saving file", 80)
         b.unlock()
-        
+        self.emit_progress("New DB file download finished", 100)
+        time.sleep(2)
+        self.close_progress()
 
     #
     # Process selected activities
@@ -215,16 +227,24 @@
     def root_scripted_changes(self, reconfigure):
         """System-wide changes that need root access to be applied.
            This function is ran by the dbus backend"""
+        self.emit_progress("Opening config file", 10)
         if os.path.exists(self.CONFIGFILE):
             self.config.read("/etc/default/mythbuntu-repos")
         else:
             self.config.add_section("cfg")
+        self.emit_progress("Copying DB file", 20)
+        if "copy-new-db" in reconfigure:
+            self.emit_progress("Copying DB file", 30)
+            DIR = reconfigure["copy-new-db"]
+            shutil.copy(DIR+"/.mythbuntu/repos.db", "/var/lib/mythbuntu/repos.db")
         if "Repo-list" in reconfigure:
+            self.emit_progress("Removing old repositories", 40)
             for item in reconfigure["Repo-list"]:
                 if item.endswith(".x"):
                     item = item.strip(".x")
                     subprocess.call(["apt-add-repository", "-r", "-y", "ppa:mythbuntu/"+item])
         if "MythTV-Updates-Activated" in reconfigure:
+            self.emit_progress("Configuring MythTV Updates repo", 50)
             if reconfigure["MythTV-Updates-Activated"]:
                 repo = reconfigure["MythTV-Updates-Repo"]
                 self.config.set("cfg", "ActivateMythTVUpdates", True)
@@ -235,6 +255,7 @@
             else:
                 self.config.set("cfg", "ActivateMythTVUpdates", False)
         if "Mythbuntu-Updates-Activated" in reconfigure:
+            self.emit_progress("Configuring Mythbuntu Updates repo", 60)
             if reconfigure["Mythbuntu-Updates-Activated"]:
                 subprocess.call(["apt-add-repository", "-y", "ppa:mythbuntu/testing"])
                 self.config.set("cfg", "ActivateMythbuntuUpdates", True)
@@ -242,6 +263,7 @@
                 subprocess.call(["apt-add-repository", "-r", "-y", "ppa:mythbuntu/testing"])
                 self.config.set("cfg", "ActivateMythbuntuUpdates", False)
         if "XMLTV-Updates-Activated" in reconfigure:
+            self.emit_progress("Configuring XMLTV Updates repo", 70)
             if reconfigure["XMLTV-Updates-Activated"]:
                 subprocess.call(["apt-add-repository", "-y", "ppa:mythbuntu/xmltv"])
                 self.config.set("cfg", "ActivateXMLTVUpdates", True)
@@ -249,5 +271,8 @@
                 subprocess.call(["apt-add-repository", "-r", "-y", "ppa:mythbuntu/xmltv"])
                 self.config.set("cfg", "ActivateXMLTVUpdates", False)
         with open('/etc/default/mythbuntu-repos', 'wb') as configfile:
+            self.emit_progress("Writing config file", 80)
             self.config.write(configfile)
+        self.emit_progress("Done configuring repositories", 100)
+        time.sleep(2)