Changeset 3108 for lliurex-up/trunk/fuentes/LliurexUpCore.py
- Timestamp:
- Dec 19, 2016, 4:26:46 PM (4 years ago)
- File:
-
- 1 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()
Note: See TracChangeset
for help on using the changeset viewer.