[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: node-like file conflicts

* Dmitrijs Ledkovs <xnox@debian.org>, 2012-08-07, 22:47:
Does this include search across all components of standard $PATH

Yes, modulo bugs (see my other message in this thread).

and across all packages?

Yes, on i386 and amd64. If you check kfreebsd-* there's also this one:

ztest: zfsutils zutils

There might be even more if you assume that you can co-install Linux and kFreeBSD binaries (yay, multi-arch world!).

How did you run this check?

I used a script (attached) to analyse Contents-*.gz files, which you can find on your favourite mirror. Then I manually filtered some false-positives.

Jakub Wilk

# Copyright © 2012 Jakub Wilk <jwilk@debian.org>

# Redistribution and use in source and compiled forms, with or without
# modification, are permitted under any circumstances. No warranty.

import argparse
import collections
import functools
import gzip
import re

interesting = re.compile(br'^((?:usr/)?s?bin/|usr/games/)([^/\s]+)\s+(\S+)').match

def main():
    ap = argparse.ArgumentParser()
    ap.add_argument('files', metavar='FILE', nargs='+')
    options = ap.parse_args()
    data = collections.defaultdict(
        lambda: collections.defaultdict(set)
    for filename in options.files:
        if filename.endswith('.gz'):
            file = gzip.open(filename)
            file = open(filename, 'rb')
        with file:
            for line in file:
                if line.startswith(b'FILE'):
            for line in file:
                match = interesting(line)
                if match is not None:
                    path, command, packages = (s.decode('UTF-8') for s in match.groups())
                    packages = set(p.split('/')[-1] for p in packages.split(','))
                    data[command][path] |= packages
    for command, paths in data.items():
        if len(paths) > 1:
            packages = functools.reduce(set.union, paths.values(), set())
            if len(packages) > 1:
                print('{command}: {packages}'.format(
                    packages=' '.join(sorted(packages))

if __name__ == '__main__':

# vim:ts=4 sw=4 et

Reply to: