Instead of skipping packages that are ignored (which leads checkrestart to output
information in lines without any content in systemd systems), just remove
the packages from the package dictionary so that they will never be processed
again.
Javier Fernandez-Sanguino
9 years ago
207 | 207 | # Close the pipe |
208 | 208 | dpkgProc.stdout.close() |
209 | 209 | |
210 | # Remove the ignored packages from the list of packages | |
211 | if ignorelist: | |
212 | for i in ignorelist: | |
213 | try: | |
214 | del packages[i] | |
215 | except KeyError: | |
216 | continue | |
217 | ||
210 | 218 | print "(%d distinct packages)" % len(packages) |
211 | 219 | |
212 | 220 | if len(packages) == 0: |
215 | 223 | sys.exit(0) |
216 | 224 | |
217 | 225 | for package in packages.values(): |
218 | skip = False | |
219 | if ignorelist: | |
220 | for i in ignorelist: | |
221 | if i == package.name: | |
222 | skip = True | |
223 | if skip: | |
224 | continue | |
225 | 226 | dpkgQuery = ["dpkg-query", "--listfiles", package.name] |
226 | 227 | dpkgProc = subprocess.Popen(dpkgQuery, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, |
227 | 228 | env = lc_all_c_env) |
297 | 298 | # TODO - consider putting this in a --verbose option |
298 | 299 | print "These processes (%d) do not seem to have an associated init script to restart them:" %len(nonrestartable) |
299 | 300 | for package in nonrestartable: |
300 | skip = False | |
301 | if ignorelist: | |
302 | for i in ignorelist: | |
303 | if i == package.name: | |
304 | skip = True | |
305 | if skip: | |
306 | continue | |
307 | 301 | print package.name + ':' |
308 | 302 | for process in package.processes: |
309 | 303 | print "\t%s\t%s" % (process.pid,process.program) |