Changeset 2932 for lliurex-up/trunk
- Timestamp:
- Nov 25, 2016, 3:04:08 PM (4 years ago)
- Location:
- lliurex-up/trunk/fuentes
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-up/trunk/fuentes/LliurexUpCore.py
r2902 r2932 15 15 self.n4d = xmlrpclib.ServerProxy('https://localhost:9779') 16 16 self.haveLliurexMirror = False 17 self.flavours = self.n4d.lliurex_version('','LliurexVersion','-v')[1].split(',')17 self.flavours = [ x.strip() for x in self.n4d.lliurex_version('','LliurexVersion','-v')[1].split(',') ] 18 18 if len(self.n4d.get_methods('MirrorManager')) > 0: 19 19 self.haveLliurexMirror = True 20 21 20 self.prepareEnvironment() 22 21 … … 55 54 for line in iter(p.stdout.readline,""): 56 55 stripedline = line.strip() 57 if stripedline.startswith("Installed") 58 installed = stripedline.replace("Installed: " )59 if stripedline.startswith("Candidate") 60 candidate = stripedline.replace("Candidate: " )56 if stripedline.startswith("Installed"): 57 installed = stripedline.replace("Installed: ","") 58 if stripedline.startswith("Candidate"): 59 candidate = stripedline.replace("Candidate: ","") 61 60 return {"installed":installed,"candidate":candidate} 62 61 … … 143 142 targetMetapackage = x[2:] 144 143 break 145 if targetMetapackage != '':146 144 return targetMetapackage 147 145 … … 202 200 packageInfo[package]['candidate'] = raw[0][1:] 203 201 packageInfo[package].pop('raw') 202 return packageInfo 203 204 if __name__ == '__main__': 205 x = LliurexUpCore() -
lliurex-up/trunk/fuentes/lliurex-up-gui/LliurexUpCore.py
r2925 r2932 15 15 self.n4d = xmlrpclib.ServerProxy('https://localhost:9779') 16 16 self.haveLliurexMirror = False 17 self.flavours = self.n4d.lliurex_version('','LliurexVersion','-v')[1].split(',') 18 17 self.flavours = [ x.strip() for x in self.n4d.lliurex_version('','LliurexVersion','-v')[1].split(',') ] 19 18 if len(self.n4d.get_methods('MirrorManager')) > 0: 20 19 self.haveLliurexMirror = True 21 22 20 self.prepareEnvironment() 23 21 … … 34 32 def writeDefaultSourceslist(self): 35 33 f = open(os.path.join(self.processSourceslist,'default'),'w') 36 f.write('deb http://lliurex.net/{version} {version} main \n'.format(version=self.defaultVersion))37 f.write('deb http://lliurex.net/{version} {version}-updates main \n'.format(version=self.defaultVersion))38 f.write('deb http://lliurex.net/{version} {version}-security main \n'.format(version=self.defaultVersion))34 f.write('deb http://lliurex.net/{version} {version} main'.format(version=self.defaultVersion)) 35 f.write('deb http://lliurex.net/{version} {version}-updates main'.format(version=self.defaultVersion)) 36 f.write('deb http://lliurex.net/{version} {version}-security main'.format(version=self.defaultVersion)) 39 37 f.close() 40 38 41 def getPackageVersionAvailable(self,package, auxoptions=""):39 def getPackageVersionAvailable(self,package,options=""): 42 40 ''' 43 41 Args : … … 50 48 Options are Apt options 51 49 ''' 52 command = "LANG=C apt-cache policy {package} {options}".format(package=package,options= auxoptions)50 command = "LANG=C apt-cache policy {package} {options}".format(package=package,options=options) 53 51 p = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE) 54 52 installed = None … … 67 65 ''' 68 66 sourceslistDefaultPath = os.path.join(self.processSourceslist,'default') 69 auxoptions = ""67 options = "" 70 68 if self.canConnectToLliurexNet(): 71 auxoptions = "-o Dir::Etc::sourcelist={sourceslistOnlyLliurex} -o Dir::Etc::sourceparts=/dev/null".format(sourceslistOnlyLliurex=sourceslistDefaultPath)72 command = "LANG=C apt-get update {options}".format(options= auxoptions)69 options = "-o Dir::Etc::sourcelist={sourceslistOnlyLliurex} -o Dir::Etc::sourceparts=/dev/null".format(sourceslistOnlyLliurex=sourceslistDefaultPath) 70 command = "LANG=C apt-get update {options}".format(options=options) 73 71 subprocess.Popen(command,shell=True).communicate() 74 result = self.getPackageVersionAvailable('lliurex up',auxoptions)72 result = self.getPackageVersionAvailable('lliurex-up',options) 75 73 76 74 if result['installed'] != result['candidate']: … … 78 76 return True 79 77 80 def installLliurexUp(self, auxoptions=""):78 def installLliurexUp(self,options=""): 81 79 ''' 82 80 Args : … … 90 88 This function install lliurex-up 91 89 ''' 92 command = "LANG=C apt-get install testdisk {options}".format(options=auxoptions) 90 #command = "LANG=C apt-get install lliurex-up {options}".format(options=options) 91 command = "LANG=C apt-get install testdisk {options}".format(options=options) 93 92 p = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE) 94 93 poutput,perror = p.communicate() … … 102 101 result.action : Action to launch 103 102 ''' 104 if self.haveLliurexMirror and ' server' in self.flavours : 105 print "Chequeando mirror" 106 self.result = self.n4d.is_update_available('','MirrorManager',self.defaultMirror) 107 return self.result 103 if self.haveLliurexMirror and 'server' in self.flavours : 104 result = self.n4d.is_update_available('','MirrorManager',self.defaultMirror) 105 return result 108 106 return None 109 107 … … 145 143 targetMetapackage = x[2:] 146 144 break 147 if targetMetapackage != '': 148 return targetMetapackage 145 return targetMetapackage 149 146 150 147 def canConnectToLliurexNet(self): … … 166 163 ''' 167 164 sourceslistDefaultPath = os.path.join(self.processSourceslist,'default') 168 auxoptions = ""165 options = "" 169 166 if self.canConnectToLliurexNet(): 170 auxoptions = "-o Dir::Etc::sourcelist={sourceslistOnlyLliurex} -o Dir::Etc::sourceparts=/dev/null".format(sourceslistOnlyLliurex=sourceslistDefaultPath)171 command = "LANG=C apt-get update {options}".format(options= auxoptions)167 options = "-o Dir::Etc::sourcelist={sourceslistOnlyLliurex} -o Dir::Etc::sourceparts=/dev/null".format(sourceslistOnlyLliurex=sourceslistDefaultPath) 168 command = "LANG=C apt-get update {options}".format(options=options) 172 169 subprocess.Popen(command,shell=True).communicate() 173 return self.getPackageVersionAvailable('lliurex-version-stamp', auxoptions)170 return self.getPackageVersionAvailable('lliurex-version-stamp',options) 174 171 175 172 def getPackagesToUpdate(self): … … 205 202 packageInfo[package].pop('raw') 206 203 207 return packageInfo 204 return packageInfo 205 206 if __name__ == '__main__': 207 x = LliurexUpCore()
Note: See TracChangeset
for help on using the changeset viewer.