sys.exit(1)

output_filename = sys.argv[1]
input_filenames = sys.argv[2:]

package_interval_sets = []
for input_filename in input_filenames:
    for line in open(input_filename):
        # Ignore blank lines
        if not line.strip():
            continue
        # Allow comments starting with '#'
        if line.startswith('#'):
            continue
        line = line.rstrip('\n')
        interval_set = package_version_interval.parse_interval_set(line)
        should_append_interval_set = True
        for i in range(len(package_interval_sets)):
            if package_interval_sets[i].implies(interval_set):
                should_append_interval_set = False
                break
            if interval_set.implies(package_interval_sets[i]):
                should_append_interval_set = False
                package_interval_sets[i] = interval_set
                break
        if should_append_interval_set:
            package_interval_sets.append(interval_set)

with open(output_filename, 'w') as output_file:
    lines = [
        interval_set.formatted() + '\n'
Пример #2
0
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                        cwd=sysroot)
exit_code = proc.wait()
(stdout, stderr) = proc.communicate()
if exit_code != 0:
  print 'dpkg-shlibdeps failed with exit code ' + str(exit_code)
  print 'stderr was ' + stderr
  sys.exit(1)

deps_str = stdout.replace('shlibs:Depends=', '').replace('\n', '')
deps = deps_str.split(', ')
interval_sets = []
if deps_str != '':
  for dep in deps:
    interval_sets.append(package_version_interval.parse_interval_set(dep))

script_dir = os.path.dirname(os.path.abspath(__file__))
deps_file = os.path.join(script_dir, 'dist_package_versions.json')
distro_package_versions = json.load(open(deps_file))

ret_code = 0
if distro_check:
  for distro in distro_package_versions:
    for interval_set in interval_sets:
      dep_satisfiable = False
      for interval in interval_set.intervals:
        package = interval.package
        if package not in distro_package_versions[distro]:
          continue
        distro_version = deb_version.DebVersion(
  sys.exit(1)

output_filename = sys.argv[1]
input_filenames = sys.argv[2:]

package_interval_sets = []
for input_filename in input_filenames:
  for line in open(input_filename):
    # Ignore blank lines
    if not line.strip():
      continue
    # Allow comments starting with '#'
    if line.startswith('#'):
      continue
    line = line.rstrip('\n')
    interval_set = package_version_interval.parse_interval_set(line)
    should_append_interval_set = True
    for i in range(len(package_interval_sets)):
      if package_interval_sets[i].implies(interval_set):
        should_append_interval_set = False
        break
      if interval_set.implies(package_interval_sets[i]):
        should_append_interval_set = False
        package_interval_sets[i] = interval_set
        break
    if should_append_interval_set:
      package_interval_sets.append(interval_set)

with open(output_filename, 'w') as output_file:
  lines = [interval_set.formatted() + '\n'
           for interval_set in package_interval_sets]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                        cwd=sysroot)
(stdout, stderr) = proc.communicate()
exit_code = proc.wait()
if exit_code != 0:
  print 'dpkg-shlibdeps failed with exit code ' + str(exit_code)
  print 'stderr was ' + stderr
  sys.exit(1)

deps_str = stdout.replace('shlibs:Depends=', '').replace('\n', '')
deps = deps_str.split(', ')
interval_sets = []
if deps_str != '':
  for dep in deps:
    interval_sets.append(package_version_interval.parse_interval_set(dep))

script_dir = os.path.dirname(os.path.abspath(__file__))
deps_file = os.path.join(script_dir, 'dist_package_versions.json')
distro_package_versions = json.load(open(deps_file))

ret_code = 0
if distro_check:
  for distro in distro_package_versions:
    for interval_set in interval_sets:
      dep_satisfiable = False
      for interval in interval_set.intervals:
        package = interval.package
        if package not in distro_package_versions[distro]:
          continue
        distro_version = deb_version.DebVersion(
    package_version_interval.parse_dep('libfoo (= 10)'))
assert package_version_interval.parse_dep('libfoo (= 10)').implies(
    package_version_interval.parse_dep('libfoo (>> 1)'))
assert not package_version_interval.parse_dep('libfoo (>> 1)').implies(
    package_version_interval.parse_dep('libfoo (= 10)'))
assert package_version_interval.parse_dep('libfoo (= 1)').implies(
    package_version_interval.parse_dep('libfoo (>= 1)'))
assert not package_version_interval.parse_dep('libfoo (>= 1)').implies(
    package_version_interval.parse_dep('libfoo (= 1)'))
assert not package_version_interval.parse_dep('libfoo (= 1)').implies(
    package_version_interval.parse_dep('libfoo (>> 1)'))
assert not package_version_interval.parse_dep('libfoo (>> 1)').implies(
    package_version_interval.parse_dep('libfoo (= 1)'))

# PackageVersionIntervalSet.implies() test.
assert (package_version_interval.parse_interval_set('libfoo | libbar').implies(
    package_version_interval.parse_interval_set('libfoo | libbar')))
assert (package_version_interval.parse_interval_set('libfoo').implies(
    package_version_interval.parse_interval_set('libfoo | libbar')))
assert not (
    package_version_interval.parse_interval_set('libfoo | libbar').implies(
    package_version_interval.parse_interval_set('libfoo')))
assert (package_version_interval.parse_interval_set('libbar').implies(
    package_version_interval.parse_interval_set('libfoo | libbar')))
assert not (
    package_version_interval.parse_interval_set('libfoo | libbar').implies(
    package_version_interval.parse_interval_set('libbar')))
assert (package_version_interval.parse_interval_set(
    'libfoo (>> 2) | libbar (>> 2)').implies(
    package_version_interval.parse_interval_set(
        'libfoo (>> 1) | libbar (>> 1)')))