Changeset 3108 for lliurex-up
- Timestamp:
- Dec 19, 2016, 4:26:46 PM (4 years ago)
- Location:
- lliurex-up/trunk/fuentes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-up/trunk/fuentes/LliurexUpCore.py
r3038 r3108 15 15 self.changelogsPath = os.path.join(self.processPath,'changelogs') 16 16 self.processSourceslist = os.path.join(self.processPath,'sourceslist') 17 self.targetMetapackagePath=os.path.join(self.processPath,"targetMetapackage") 17 18 self.previousflavourspath = os.path.join(self.processPath,'previousflavours') 18 19 19 self.preActionsPath = '/usr/share/lliurex-up/preActions' 20 self.postActionsPath = '/usr/share/lliurex-up/ PostActions'20 self.postActionsPath = '/usr/share/lliurex-up/postActions' 21 21 22 22 self.n4d = xmlrpclib.ServerProxy('https://localhost:9779') 23 23 self.haveLliurexMirror = False 24 self.metapackageRef=[] 24 25 self.previuosFlavours = [] 26 self.getTargetMetapackage() 25 27 self.flavours = [] 26 28 self.getPreviuosFlavours() … … 39 41 40 42 43 def getTargetMetapackage(self): 44 45 if os.path.exists(self.targetMetapackagePath): 46 aux = open(self.targetMetapackagePath,'r') 47 lines = aux.readlines() 48 for x in lines: 49 self.metapackageRef.append(x.strip()) 50 aux.close() 51 52 def saveTargetMetapackage(self,targetMetapackage): 53 54 aux=open(self.targetMetapackagePath,'w') 55 x=targetMetapackage.split("-")[2] 56 aux.write(x+"\n") 57 x="edu" 58 aux.write(x+"\n") 59 aux.close() 60 61 41 62 def updateFlavoursList(self): 42 63 self.flavours = [ x.strip() for x in self.n4d.lliurex_version('','LliurexVersion','-v')[1].split(',') ] … … 60 81 if not os.path.exists(self.processPath): 61 82 os.mkdir(self.processPath) 62 if not os.path.exists( processSourceslist):83 if not os.path.exists(self.processSourceslist): 63 84 os.mkdir(self.processSourceslist) 64 85 if not os.path.exists(self.changelogsPath): … … 182 203 targetMetapackage = x[2:] 183 204 break 205 206 if targetMetapackage !=None: 207 self.saveTargetMetapackage(targetMetapackage) 184 208 return targetMetapackage 185 209 … … 217 241 def postActionsScript(self): 218 242 return 'run-parts --arg="postActions" ' + self.postActionsPath 243 244 245 def installInitialFlavour(self,flavourToInstall,options=""): 246 ''' 247 Args : 248 flavourToInstall String 249 options String 250 return dictionary => result 251 result : {'returncode':Int,'stdout':String,'stderr':String} 252 253 options are Apt options 254 255 256 This function install lliurex-up 257 ''' 258 command = "LANG=C apt-get install " + flavourToInstall + "{options} ".format(options=options) 259 p = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE) 260 poutput,perror = p.communicate() 261 return {'returncode':p.returncode,'stdout':poutput,'stderrs':perror} 219 262 220 263 def getPackagesToUpdate(self): … … 255 298 256 299 300 def distUpgradeProcess(self): 301 302 return 'apt-get dist-upgrade --yes --force-yes' 303 304 305 def installFinalFlavour(self,flavourToInstall): 306 307 return 'apt-get install ' + flavourToInstall + ' --yes --force-yes' 308 309 310 257 311 if __name__ == '__main__': 258 312 x = LliurexUpCore() -
lliurex-up/trunk/fuentes/lliurex-up-gui/LliurexUpConnect.py
r3094 r3108 29 29 self.installflavour_token=os.path.join(self.llxUpCore.processPath,'installflavour_token') 30 30 self.postactions_token=os.path.join(self.llxUpCore.processPath,'postactions_token') 31 self.errorupgrade_token=os.path.join(self.llxUpCore.processPath,'errorupgrade_token') 31 32 32 33 self.checkInitialFlavour() … … 258 259 259 260 261 def installInitialFlavour(self,flavourToInstall): 262 263 try: 264 is_flavour_installed=self.llxUpCore.installInitialFlavour(flavourToInstall) 265 return is_flavour_installed 266 self.log(is_flavour_installed) 267 268 except Exception as e: 269 print str(e) 270 271 260 272 def getPackagesToUpdate(self): 261 273 … … 323 335 print str(e) 324 336 337 325 338 def distUpgradeProcess(self): 326 339 327 self.distupgrade='apt-get dist-upgrade -sV ;touch ' + self.upgrade_token + '\n' 340 self.distupgrade=self.llxUpCore.distUpgradeProcess() 341 self.distupgrade=self.distupgrade + ' ;touch ' + self.upgrade_token + '\n' 328 342 329 343 return self.distupgrade 330 344 345 346 def checkErrorDistUpgrade(self): 347 348 count=0 349 if os.path.exists(self.errorupgrade_token): 350 aux = open(self.errorupgrade_token,'r') 351 lines = aux.readlines() 352 for x in lines: 353 if 'E: ' in x: 354 count=count+1 355 aux.close() 356 357 if count==0: 358 return True 359 else: 360 return False 331 361 332 362 … … 352 382 def installFinalFlavour(self,flavourToInstall): 353 383 354 self.command='apt-get install ' + flavourToInstall + ' -sV ;touch ' + self.installflavour_token + '\n' 384 self.command=self.llxUpCore.installFinalFlavour(flavourToInstall) 385 self.command=self.command + ' ;touch ' + self.installflavour_token + '\n' 355 386 return self.command 356 387 … … 359 390 try: 360 391 self.postActions=self.llxUpCore.postActionsScript() 361 self.postActions=self.postActions + ' ;touch ' + self.postactions_token + '\n'392 self.postActions=self.postActions + ' 2> >(tee ' + self.errorupgrade_token + ') ;touch ' + self.postactions_token + '\n' 362 393 return self.postActions 363 394 -
lliurex-up/trunk/fuentes/lliurex-up-gui/LliurexUpCore.py
r3094 r3108 18 18 self.previousflavourspath = os.path.join(self.processPath,'previousflavours') 19 19 self.preActionsPath = '/usr/share/lliurex-up/preActions' 20 self.postActionsPath = '/usr/share/lliurex-up/ PostActions'20 self.postActionsPath = '/usr/share/lliurex-up/postActions' 21 21 22 22 self.n4d = xmlrpclib.ServerProxy('https://localhost:9779') … … 205 205 206 206 if targetMetapackage !=None: 207 print targetMetapackage208 207 self.saveTargetMetapackage(targetMetapackage) 209 208 return targetMetapackage … … 242 241 def postActionsScript(self): 243 242 return 'run-parts --arg="postActions" ' + self.postActionsPath 243 244 245 def installInitialFlavour(self,flavourToInstall,options=""): 246 ''' 247 Args : 248 flavourToInstall String 249 options String 250 return dictionary => result 251 result : {'returncode':Int,'stdout':String,'stderr':String} 252 253 options are Apt options 254 255 256 This function install lliurex-up 257 ''' 258 command = "LANG=C apt-get install " + flavourToInstall + "{options} ".format(options=options) 259 p = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE) 260 poutput,perror = p.communicate() 261 return {'returncode':p.returncode,'stdout':poutput,'stderrs':perror} 244 262 245 263 def getPackagesToUpdate(self): … … 280 298 281 299 300 def distUpgradeProcess(self): 301 302 return 'apt-get dist-upgrade --yes --force-yes' 303 304 305 def installFinalFlavour(self,flavourToInstall): 306 307 return 'apt-get install ' + flavourToInstall + ' --yes --force-yes' 308 309 310 282 311 if __name__ == '__main__': 283 312 x = LliurexUpCore() -
lliurex-up/trunk/fuentes/lliurex-up-gui/lliurex-up.py
r3094 r3108 201 201 os.environ['HOME'], 202 202 #["/usr/sbin/dpkg-reconfigure", "xdm"], 203 ["/bin/ sh"],203 ["/bin/bash"], 204 204 [], 205 205 GLib.SpawnFlags.DO_NOT_REAP_CHILD, … … 859 859 self.flavourToInstall=self.llxup_connect.requiresInstallFlavour() 860 860 if self.flavourToInstall != None: 861 print self.flavourToInstall 861 862 print "[Lliurex-up]: Installation of flavour is required" 863 is_flavour_installed=self.llxup_connect.installInitialFlavour(self.flavourToInstall) 864 self.checkInitialFlavourToInstall_t.done=True 862 865 else: 863 866 print "[Lliurex-up]: Installation of flavour is not required" 864 865 self.checkInitialFlavourToInstall_t.done=True 866 867 self.checkInitialFlavourToInstall_t.done=True 868 869 else: 870 print self.flavourToInstall 871 print "[Lliurex-up]: Installation of flavour is required" 872 is_flavour_installed=self.llxup_connect.installInitialFlavour(self.flavourToInstall) 873 self.checkInitialFlavourToInstall_t.done=True 867 874 868 875 def gather_packages(self): … … 1045 1052 self.pbar_label.hide() 1046 1053 self.terminal_label.set_name("CHANGELOG_FONT") 1047 msg_updgrade_running="<span><b>" + _("The system is now update") + "</b></span>" 1054 if self.llxup_connect.checkErrorDistUpgrade(): 1055 msg_updgrade_running="<span><b>" + _("The system is now update") + "</b></span>" 1056 1057 else: 1058 msg_updgrade_running="<span><b>" + _("The updated proces is endend with errors") + "</b></span>" 1059 1048 1060 self.update_button_box.set_name("UPDATE_BUTTON_END_COLOR") 1049 1061 self.terminal_label.set_markup(msg_updgrade_running)
Note: See TracChangeset
for help on using the changeset viewer.