Merge lp:~mvo/software-center/update-sc-cmdline-flexibility into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3255
Proposed branch: lp:~mvo/software-center/update-sc-cmdline-flexibility
Merge into: lp:software-center
Diff against target: 80 lines (+16/-5)
3 files modified
softwarecenter/db/update.py (+3/-2)
utils/update-software-center (+8/-2)
utils/update-software-center-agent (+5/-1)
To merge this branch: bzr merge lp:~mvo/software-center/update-sc-cmdline-flexibility
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+130306@code.launchpad.net

Description of the change

This branch adds some flexiblity to the update-software-center and update-software-center-agent commandline tools:

update-software-center-agent has a new --target-db-path to allow writing the xapian db that is generated from the software-center-agent.ubuntu.com data to a non-default location

update-software-center has --target-db-path as above and also --app-install-desktop-dir that can point to a directory like /usr/share/app-install/desktop or a custom test directory.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/db/update.py'
2--- softwarecenter/db/update.py 2012-09-28 10:11:34 +0000
3+++ softwarecenter/db/update.py 2012-10-18 09:18:22 +0000
4@@ -1103,7 +1103,8 @@
5 return sca.good_data
6
7
8-def rebuild_database(pathname, debian_sources=True, appstream_sources=False):
9+def rebuild_database(pathname, debian_sources=True, appstream_sources=False,
10+ appinfo_dir=None):
11 #cache = apt.Cache(memonly=True)
12 cache = get_pkg_info()
13 cache.open()
14@@ -1140,7 +1141,7 @@
15 db = xapian.WritableDatabase(rebuild_path, xapian.DB_CREATE_OR_OVERWRITE)
16
17 if debian_sources:
18- update(db, cache)
19+ update(db, cache, appinfo_dir)
20 if appstream_sources:
21 if os.path.exists('./data/app-stream/appdata.xml'):
22 update_from_appstream_xml(db, cache,
23
24=== modified file 'utils/update-software-center'
25--- utils/update-software-center 2012-07-23 11:48:24 +0000
26+++ utils/update-software-center 2012-10-18 09:18:22 +0000
27@@ -99,13 +99,18 @@
28 parser.add_option("--use-packagekit", action="store_true",
29 help="use PackageKit backend (experimental)",
30 default=False)
31+ parser.add_option("--app-install-desktop-dir", "", default=None)
32+ parser.add_option("--target-db-path", "", default=None)
33 (options, args) = parser.parse_args()
34
35 #logging.basicConfig(level=logging.INFO)
36 if options.debug:
37 LOG.setLevel(logging.DEBUG)
38
39- if options.local:
40+ # setup directories
41+ if options.target_db_path:
42+ xapian_base_path = options.target_db_path
43+ elif options.local:
44 if not os.path.exists('./data'):
45 LOG.error("trying to update local database, ./data does not exist")
46 sys.exit(-1)
47@@ -167,7 +172,8 @@
48 if options.appstream_only:
49 result = rebuild_database(pathname, debian_sources=False, appstream_sources=True)
50 else:
51- result = rebuild_database(pathname)
52+ result = rebuild_database(
53+ pathname, appinfo_dir=options.app_install_desktop_dir)
54 if result:
55 print "Software catalog update was successful."
56 else:
57
58=== modified file 'utils/update-software-center-agent'
59--- utils/update-software-center-agent 2012-10-10 11:30:37 +0000
60+++ utils/update-software-center-agent 2012-10-18 09:18:22 +0000
61@@ -58,6 +58,7 @@
62 help="ignore the local cache when updating")
63 parser.add_option("--datadir", "", default=None)
64 parser.add_option("--pretend-distro", "", default=None)
65+ parser.add_option("--target-db-path", "", default=None)
66 (options, args) = parser.parse_args()
67
68 logging.basicConfig(level=logging.INFO)
69@@ -78,7 +79,10 @@
70 cache = apt.Cache(memonly=True)
71
72 # setup path
73- pathname = XAPIAN_BASE_PATH_SOFTWARE_CENTER_AGENT+".tmp"
74+ pathname = options.target_db_path + ".tmp"
75+ if not pathname:
76+ pathname = XAPIAN_BASE_PATH_SOFTWARE_CENTER_AGENT+".tmp"
77+
78 if not os.path.exists(pathname):
79 try:
80 os.makedirs(pathname)

Subscribers

People subscribed via source and target branches