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
=== modified file 'softwarecenter/db/update.py'
--- softwarecenter/db/update.py 2012-09-28 10:11:34 +0000
+++ softwarecenter/db/update.py 2012-10-18 09:18:22 +0000
@@ -1103,7 +1103,8 @@
1103 return sca.good_data1103 return sca.good_data
11041104
11051105
1106def rebuild_database(pathname, debian_sources=True, appstream_sources=False):1106def rebuild_database(pathname, debian_sources=True, appstream_sources=False,
1107 appinfo_dir=None):
1107 #cache = apt.Cache(memonly=True)1108 #cache = apt.Cache(memonly=True)
1108 cache = get_pkg_info()1109 cache = get_pkg_info()
1109 cache.open()1110 cache.open()
@@ -1140,7 +1141,7 @@
1140 db = xapian.WritableDatabase(rebuild_path, xapian.DB_CREATE_OR_OVERWRITE)1141 db = xapian.WritableDatabase(rebuild_path, xapian.DB_CREATE_OR_OVERWRITE)
11411142
1142 if debian_sources:1143 if debian_sources:
1143 update(db, cache)1144 update(db, cache, appinfo_dir)
1144 if appstream_sources:1145 if appstream_sources:
1145 if os.path.exists('./data/app-stream/appdata.xml'):1146 if os.path.exists('./data/app-stream/appdata.xml'):
1146 update_from_appstream_xml(db, cache,1147 update_from_appstream_xml(db, cache,
11471148
=== modified file 'utils/update-software-center'
--- utils/update-software-center 2012-07-23 11:48:24 +0000
+++ utils/update-software-center 2012-10-18 09:18:22 +0000
@@ -99,13 +99,18 @@
99 parser.add_option("--use-packagekit", action="store_true",99 parser.add_option("--use-packagekit", action="store_true",
100 help="use PackageKit backend (experimental)", 100 help="use PackageKit backend (experimental)",
101 default=False)101 default=False)
102 parser.add_option("--app-install-desktop-dir", "", default=None)
103 parser.add_option("--target-db-path", "", default=None)
102 (options, args) = parser.parse_args()104 (options, args) = parser.parse_args()
103105
104 #logging.basicConfig(level=logging.INFO)106 #logging.basicConfig(level=logging.INFO)
105 if options.debug:107 if options.debug:
106 LOG.setLevel(logging.DEBUG)108 LOG.setLevel(logging.DEBUG)
107109
108 if options.local:110 # setup directories
111 if options.target_db_path:
112 xapian_base_path = options.target_db_path
113 elif options.local:
109 if not os.path.exists('./data'):114 if not os.path.exists('./data'):
110 LOG.error("trying to update local database, ./data does not exist")115 LOG.error("trying to update local database, ./data does not exist")
111 sys.exit(-1)116 sys.exit(-1)
@@ -167,7 +172,8 @@
167 if options.appstream_only:172 if options.appstream_only:
168 result = rebuild_database(pathname, debian_sources=False, appstream_sources=True)173 result = rebuild_database(pathname, debian_sources=False, appstream_sources=True)
169 else:174 else:
170 result = rebuild_database(pathname)175 result = rebuild_database(
176 pathname, appinfo_dir=options.app_install_desktop_dir)
171 if result:177 if result:
172 print "Software catalog update was successful."178 print "Software catalog update was successful."
173 else:179 else:
174180
=== modified file 'utils/update-software-center-agent'
--- utils/update-software-center-agent 2012-10-10 11:30:37 +0000
+++ utils/update-software-center-agent 2012-10-18 09:18:22 +0000
@@ -58,6 +58,7 @@
58 help="ignore the local cache when updating")58 help="ignore the local cache when updating")
59 parser.add_option("--datadir", "", default=None)59 parser.add_option("--datadir", "", default=None)
60 parser.add_option("--pretend-distro", "", default=None)60 parser.add_option("--pretend-distro", "", default=None)
61 parser.add_option("--target-db-path", "", default=None)
61 (options, args) = parser.parse_args()62 (options, args) = parser.parse_args()
6263
63 logging.basicConfig(level=logging.INFO)64 logging.basicConfig(level=logging.INFO)
@@ -78,7 +79,10 @@
78 cache = apt.Cache(memonly=True)79 cache = apt.Cache(memonly=True)
7980
80 # setup path81 # setup path
81 pathname = XAPIAN_BASE_PATH_SOFTWARE_CENTER_AGENT+".tmp"82 pathname = options.target_db_path + ".tmp"
83 if not pathname:
84 pathname = XAPIAN_BASE_PATH_SOFTWARE_CENTER_AGENT+".tmp"
85
82 if not os.path.exists(pathname):86 if not os.path.exists(pathname):
83 try:87 try:
84 os.makedirs(pathname)88 os.makedirs(pathname)

Subscribers

People subscribed via source and target branches