Author: ks156
Date: 2009-03-11 11:18:50 +0100 (Wed, 11 Mar 2009)
New Revision: 3946
Modified:
software_suite_v2/tuxware/installers/unix/branches/refactoring/misc/installedFileDB.py
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
Log:
* Added directives to uninstall the unused files or directories
Modified:
software_suite_v2/tuxware/installers/unix/branches/refactoring/misc/installedFileDB.py
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/misc/installedFileDB.py
2009-03-11 09:21:17 UTC (rev 3945)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/misc/installedFileDB.py
2009-03-11 10:18:50 UTC (rev 3946)
@@ -18,14 +18,26 @@
lines = stream.split('\n')
# Search for file to remove
for line in lines:
+ try:
+ l = line.split("|")
+ currentEntry = {
+ 'md5Tag' : l[0],
+ 'name' : l[1],
+ 'destination' : l[2],
+ 'source' : l[3],
+ 'command' : l[4],
+ 'fileSize' : l[5],
+ }
+ except:
+ pass
remove = True
for entry in data:
- if line.find(entry['destination']) != -1 and \
- line.find(entry['md5Tag']) != -1:
+ dest = currentEntry['destination']
+ if entry['destination'] == dest:
tempList.append(entry)
remove = False
if remove:
- toRemove.append(line)
+ toRemove.append(currentEntry)
f.close()
f = open("/etc/tuxdroid/software.db")
Modified:
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
2009-03-11 09:21:17 UTC (rev 3945)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
2009-03-11 10:18:50 UTC (rev 3946)
@@ -86,31 +86,55 @@
toInstall = data
toRemove = []
- # Kill the services
- for service in processToKillList:
- os.system("pkill -f %s"%service)
+ # Check if new updates are available
+ if len(toInstall) == 0:
+ print ""
+ print "No new update available"
+ else:
- # Install or update the new software
- for entry in toInstall:
- # Copy the new files
- if entry['command'] == "COPY":
- dest = entry['destination'].replace("$PREFIX", TUXDROID_PREFIX)
- path, filename = os.path.split(dest)
- if not os.path.isdir(path):
- os.system("mkdir -p %s"%path)
-
- URLDownloadToFile(entry['source'], dest)
- elif entry['command'] == "INST":
- os.system("mkdir -p /tmp/tuxdroid_upd")
- dest = entry['destination'].replace("$PREFIX", TUXDROID_PREFIX)
- path = os.path.split(dest)[0]
- filename = os.path.split(entry['source'])[1]
- URLDownloadToFile(entry['source'], "/tmp/tuxdroid_upd/%s"%filename)
- os.system("tar -xf /tmp/tuxdroid_upd/%s -C /tmp/tuxdroid_upd/ &&\
- cd /tmp/tuxdroid_upd/%s && /bin/bash install.sh %s &&\
- rm -rf /tmp/tuxdroid_upd/" \
- %(filename, filename.split("-")[0], dest))
+ # Kill the services
+ for service in processToKillList:
+ os.system("pkill -f %s"%service)
+ # Install or update the new software
+ for item in toInstall:
+ print item['name']
+ # Copy the new files
+ if item['command'] == "COPY":
+ dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
+ path, filename = os.path.split(dest)
+ if not os.path.isdir(path):
+ os.system("mkdir -p %s"%path)
+
+ URLDownloadToFile(item['source'], dest)
+
+ elif item['command'] == "INST":
+ os.system("mkdir -p /tmp/tuxdroid_upd")
+ dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
+ path = os.path.split(dest)[0]
+ filename = os.path.split(item['source'])[1]
+
+ URLDownloadToFile(item['source'],
"/tmp/tuxdroid_upd/%s"%filename)
+
+ os.system("tar -xf /tmp/tuxdroid_upd/%s -C /tmp/tuxdroid_upd/
&&\
+ cd /tmp/tuxdroid_upd/%s && /bin/bash install.sh %s &&\
+ rm -rf /tmp/tuxdroid_upd/" \
+ %(filename, filename.split("-")[0], dest))
+
+ # Uninstall the ununsed stuff
+
+ for item in toRemove:
+ dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
+ if item['command'] == "COPY":
+ if os.path.isfile(dest):
+ os.system("rm %s"%dest)
+ elif item['command'] == "INST":
+ if os.path.isdir(dest):
+ print item
+ os.system("cd %s && /bin/bash uninstall.sh"%dest)
+ if os.path.isdir(dest):
+ RMDirs(dest)
+
writeDb(data)
if __name__ == "__main__":
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn