Added interrupted upgrade repair functionality.
This commit is contained in:
		
							parent
							
								
									a73ce1aab8
								
							
						
					
					
						commit
						c143cd572c
					
				
							
								
								
									
										1
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							| @ -1,5 +1,6 @@ | |||||||
| lubuntu-update-notifier (0.5.1) lunar; urgency=medium | lubuntu-update-notifier (0.5.1) lunar; urgency=medium | ||||||
| 
 | 
 | ||||||
|  |   * Added functionality for repairing an interrupted upgrade. | ||||||
|   * Fixed an assumption in the config-file-conflict frontend. |   * Fixed an assumption in the config-file-conflict frontend. | ||||||
| 
 | 
 | ||||||
|  -- Aaron Rainbolt <arraybolt3@ubuntu.com>  Wed, 14 Dec 2022 12:32:48 -0600 |  -- Aaron Rainbolt <arraybolt3@ubuntu.com>  Wed, 14 Dec 2022 12:32:48 -0600 | ||||||
|  | |||||||
| @ -65,6 +65,8 @@ class DialogUpg(QWidget): | |||||||
|                             #stderr=subprocess.PIPE |                             #stderr=subprocess.PIPE | ||||||
|                             stderr=self.slave)''' |                             stderr=self.slave)''' | ||||||
| 
 | 
 | ||||||
|  |         self.trans3 = self.apt_client.fix_incomplete_install() | ||||||
|  |         self.repair_install() | ||||||
|         if options.fullUpgrade: |         if options.fullUpgrade: | ||||||
|             self.trans2 = self.apt_client.upgrade_system(safe_mode=False) |             self.trans2 = self.apt_client.upgrade_system(safe_mode=False) | ||||||
|             self.setWindowTitle('Full Upgrade') |             self.setWindowTitle('Full Upgrade') | ||||||
| @ -129,6 +131,12 @@ class DialogUpg(QWidget): | |||||||
|         self.progressBar.setValue(progress) |         self.progressBar.setValue(progress) | ||||||
|         self.label.setText(_("Updating cache...")) |         self.label.setText(_("Updating cache...")) | ||||||
| 
 | 
 | ||||||
|  |     def repair_progress(self, transaction, progress): | ||||||
|  |         '''upgrade progressbar during update''' | ||||||
|  |         self.progressBar.setVisible(True) | ||||||
|  |         self.progressBar.setValue(progress) | ||||||
|  |         self.label.setText(_("Repairing interrupted upgrade if necessary...")) | ||||||
|  | 
 | ||||||
|     def update_progress_download(self, transaction, uri, status, short_desc, |     def update_progress_download(self, transaction, uri, status, short_desc, | ||||||
|                                  total_size, current_size, msg): |                                  total_size, current_size, msg): | ||||||
|         '''print update info''' |         '''print update info''' | ||||||
| @ -373,6 +381,36 @@ class DialogUpg(QWidget): | |||||||
|         '''when close button is pushed, quit''' |         '''when close button is pushed, quit''' | ||||||
|         app.quit() |         app.quit() | ||||||
| 
 | 
 | ||||||
|  |     def repair_install(self): | ||||||
|  |         self.closeBtn.setVisible(False) | ||||||
|  |         try: | ||||||
|  |             self.trans3.connect('progress-changed', self.repair_progress) | ||||||
|  |             self.trans3.connect('status-changed', self.status_changed) | ||||||
|  |             self.trans3.connect('status-details-changed', | ||||||
|  |                                 self.status_details_changed) | ||||||
|  |             self.trans3.connect('config-file-conflict', | ||||||
|  |                                 self.config_file_conflict) | ||||||
|  |             self.trans3.connect('finished', self.repair_finish) | ||||||
|  |             self.trans3.connect('error', self.upgrade_error) | ||||||
|  |             self.trans3.run() | ||||||
|  | 
 | ||||||
|  |         except (NotAuthorizedError, TransactionFailed) as e: | ||||||
|  |             print("Warning: install transaction not completed successfully:" | ||||||
|  |                   + "{}".format(e)) | ||||||
|  | 
 | ||||||
|  |     def repair_finish(self, transaction, exit_state): | ||||||
|  |         '''when repair finish''' | ||||||
|  |         self.label.setText(_("Repair Finished (if repair was needed)")) | ||||||
|  |         if exit_state == EXIT_FAILED: | ||||||
|  |             error_string = get_error_string_from_enum(transaction.error.code) | ||||||
|  |             error_desc = get_error_description_from_enum( | ||||||
|  |                 transaction.error.code) | ||||||
|  |             self.plainTextEdit.setEnabled(False) | ||||||
|  |             self.plainTextEdit.moveCursor(QTextCursor.End) | ||||||
|  |             self.plainTextEdit.insertPlainText(error_string + "\n") | ||||||
|  |             self.plainTextEdit.insertPlainText(error_desc + "\n") | ||||||
|  |             self.plainTextEdit.moveCursor(QTextCursor.End) | ||||||
|  |             self.plainTextEdit.setEnabled(True) | ||||||
| 
 | 
 | ||||||
| class App(QApplication): | class App(QApplication): | ||||||
|     '''app''' |     '''app''' | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user