Changeset 3678
- Timestamp:
- Feb 20, 2017, 2:49:53 PM (4 years ago)
- Location:
- lliurex-store/trunk/fuentes
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/lliurex-store-cli/usr/share/lliurex-store/files/blacklist.json
r3669 r3678 5 5 "zero-lliurex-pmb-installer", 6 6 "zero-lliurex-pmb", 7 "opac" 7 "opac", 8 "jb*" 8 9 ] 9 10 } -
lliurex-store/trunk/fuentes/lliurex-store-cli/usr/share/lliurex-store/files/error.json
r3661 r3678 5 5 "3":"package not installed", 6 6 "4":"package already installed", 7 "303":"permission denied", 8 "265":"unreachable network" 7 "5":"install failed", 8 "6":"remove failed", 9 "264":"already installed", 10 "265":"unreachable network", 11 "303":"permission denied" 9 12 } -
lliurex-store/trunk/fuentes/lliurex-store-cli/usr/share/lliurex-store/lliurex-store-cli.py
r3669 r3678 25 25 results=store.get_result(action) 26 26 status=store.get_status(action) 27 processed=[] 27 28 print ("") 28 29 for action in results.keys(): … … 35 36 print(color.DARKCYAN+u'Package'+': '+color.END + data['package']) 36 37 print(u'Name'+': '+data['name']) 38 print(u'ID'+': '+data['id']) 37 39 print(u'Version'+': '+data['version']) 38 40 print(u'License'+': '+data['license']) … … 54 56 elif action=='search': 55 57 #Only print name and summary 56 print(color.DARKCYAN+data['package']+color.END+": "+data['summary']) 58 if data['package'] not in data['id'] or data['package'] in processed: 59 print(color.DARKCYAN+data['package']+color.END+" ("+data['id']+"): "+data['summary']) 60 else: 61 print(color.DARKCYAN+data['package']+color.END+": "+data['summary']) 62 processed.append(data['package']) 63 57 64 elif action=='list': 58 65 #Print package, summary and status -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/debManager.py
r3663 r3678 42 42 self.count=len(applist) 43 43 self._set_status(-1) 44 processedPkg=[] 44 45 #1.- If the app doesn't exist cancel the action 45 46 for appInfo in applist: 46 app=self._resolve_App(appInfo['package']) 47 if app: 48 if action=='install': 49 self._install_App(app) 50 if action=='remove': 51 self._log("Removing "+appInfo['package']) 52 self._get_App_Dependencies(appInfo,app) 53 self._log("Dependencies to remove"+str(appInfo['depends'])) 54 self._remove_App(app) 55 if action=='pkginfo': 56 self._get_App_Dependencies(appInfo,app) 57 self.progress=self.progress+(self.partialProgress/self.count) 47 if appInfo['package'] not in processedPkg: 48 processedPkg.append(appInfo['package']) 49 app=self._resolve_App(appInfo['package']) 50 if app: 51 if action=='install': 52 self._install_App(app) 53 if action=='remove': 54 self._log("Removing "+appInfo['package']) 55 self._get_App_Dependencies(appInfo,app) 56 self._log("Dependencies to remove"+str(appInfo['depends'])) 57 self._remove_App(app) 58 if action=='pkginfo': 59 self._get_App_Dependencies(appInfo,app) 60 self.progress=self.progress+(self.partialProgress/self.count) 58 61 self.progress=100 59 62 return(self.result) … … 80 83 self._set_status(0) 81 84 except Exception as e: 85 print(str(e)) 82 86 self._debug("Install error: "+str(e.code)) 83 87 self._set_status(e.code) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/loadStore.py
r3669 r3678 87 87 blacklist=json.loads(blFile) 88 88 blApps=blacklist[flavour] 89 blRegEx=[] 89 90 for blApp in blApps: 90 91 self._debug("Blacklisted app: "+blApp) 91 app=store.get_app_by_pkgname(blApp) 92 if app: 93 self._debug("Removed "+str(app)) 94 store.remove_app(app) 92 if blApp[-1]!='*': 93 app=store.get_app_by_pkgname(blApp) 94 if app: 95 self._debug("Removed "+str(app)) 96 store.remove_app(app) 97 else: 98 self._debug("App "+blApp+" from blacklist not found in store. Assigned to RE blacklist") 99 blRegEx.append(blApp) 95 100 else: 96 self._debug("App "+blApp+" from blacklist not found in store") 101 blRegEx.append(blApp[:-1]) 102 if blRegEx: 103 self._debug("Attempting to remove apps by RE match") 104 for app in store.get_apps(): 105 for blApp in blRegEx: 106 if blApp.lower() in app.get_id_filename().lower(): 107 store.remove_app(app) 108 self._debug("Removed "+str(app.get_id()) +" as matches with "+blApp) 97 109 else: 98 110 self._debug('No blacklist to check') -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/searchManager.py
r3656 r3678 70 70 applist.append(app) 71 71 self._debug("App direct match found: "+app.get_id()) 72 else:73 74 75 self.result['data']=applist72 # else: 73 # for app in self._get_apps_by_match(tokens): 74 # applist.append(app) 75 applist=self._get_apps_by_match(tokens,applist) 76 76 if len(applist): 77 77 self._set_status(0) 78 78 else: 79 self._set_status(1) 79 applist=self._get_app_by_pkgname(tokens) 80 if len(applist): 81 self._set_status(0) 82 else: 83 self._set_status(1) 84 self.result['data']=applist 80 85 return(applist) 81 86 … … 144 149 return(app) 145 150 146 def _get_apps_by_match(self,tokens ):147 148 applist=[]149 apps_in_store=self.store.get_apps()150 if apps_in_store:151 auxDict={}152 count_apps=len(apps_in_store)153 self.progress=0154 inc=100.0/count_apps155 for app in apps_in_store:156 self.progress=self.progress+inc157 if app not in self.applist:158 for token in tokens:159 score=app.search_matches(token)160 if score >=self.precision:161 if score in auxDict:162 auxDict[score].append(app)163 else:164 auxDict[score]=[app]165 for match in sorted(auxDict):166 for app in auxDict[match]:151 def _get_apps_by_match(self,tokens,applist=[]): 152 #Add items witch match >= self.precision 153 apps_in_store=self.store.get_apps() 154 if apps_in_store: 155 auxDict={} 156 count_apps=len(apps_in_store) 157 self.progress=0 158 inc=100.0/count_apps 159 for app in apps_in_store: 160 self.progress=self.progress+inc 161 if app not in self.applist: 162 for token in tokens: 163 score=app.search_matches(token) 164 if score>=self.precision: 165 if score in auxDict: 166 auxDict[score].append(app) 167 else: 168 auxDict[score]=[app] 169 for match in sorted(auxDict): 170 for app in auxDict[match]: 171 if app not in applist: 167 172 self._debug("Adding app "+app.get_id() + " with score: "+str(match)) 168 applist.insert(0,app) 169 return(applist) 173 applist.insert(1,app) 174 return(applist) 175 176 def _get_app_by_pkgname(self,tokens): 177 applist=[] 178 apps_in_store=self.store.get_apps() 179 if apps_in_store: 180 count_apps=len(apps_in_store) 181 self.progress=0 182 inc=100.0/count_apps 183 for app in apps_in_store: 184 self.progress=self.progress+inc 185 if app not in self.applist: 186 for token in tokens: 187 if app.get_pkgname_default()==token: 188 applist.append(app) 189 190 return(applist) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/zmdManager.py
r3275 r3678 17 17 self.progress=0 18 18 self.n4dclient='' 19 self.result=[] 19 self.result={} 20 self.result['data']={} 21 self.result['status']={} 20 22 #def __init__ 21 23 … … 51 53 #def execute_action 52 54 55 def _set_status(self,status,msg=''): 56 self.result['status']={'status':status,'msg':msg} 57 53 58 def _callback(self,zmdLauncher): 54 59 inc=1 … … 80 85 appInfo=self._get_Zmd_Info(appInfo) 81 86 if appInfo['status']=='Installed': 82 self. result=[{appInfo['name']:" installed succesfully"}]87 self._set_status(0) 83 88 else: 84 self. result=[{appInfo['name']:" failed to install"}]89 self._set_status(5) 85 90 except Exception as e: 86 91 appInfo=self._get_Zmd_Info(appInfo) 87 92 self._debug(str(e)) 88 93 if appInfo['status']=='Installed': 89 self.result=[{appInfo['name']:" installed succesfully"}] 94 self._set_status(0) 95 self.result['data'].update({appInfo['name']:u'installed'}) 90 96 else: 91 self.result=[{appInfo['name']:" failed to install"}] 97 self.result['data'].update({appInfo['name']:u'not installed'}) 98 self._set_status(5) 92 99 #def _install_Zmd 93 100 … … 146 153 appInfo=self._get_Zmd_Info(appInfo) 147 154 if appInfo['status']=='Installed': 148 self. result=[{appInfo['name']:" failed to remove"}]155 self._set_status(6) 149 156 else: 150 self.result=[{appInfo['name']:" removed succesfully"}] 157 self._set_status(0) 158 self.result['data'].update({appInfo['name']:u'removed'}) 151 159 os.remove(zeroScript) 152 160 #def _remove_Zmd … … 160 168 if n4dvars[key]['state']==1: 161 169 appInfo['status']='Installed' 162 self.result.append(appInfo)163 170 return(appInfo) 164 171 #def _get_Zmd_Info
Note: See TracChangeset
for help on using the changeset viewer.