Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 34 lines (28 sloc) 0.968 kB
b9e5431 @wesolows OS-1301 smartos-live subprojects should be told about the proto area …
wesolows authored
1 #! /usr/bin/env python2.6
35173e8 @trentm OS-708: run the manifest through the sorter to remove dups, blanks li…
trentm authored
2 # vi: expandtab ts=4 sw=4
7edf44a @joshwilsdon Initial import, moved from old illumos-extra repo.
joshwilsdon authored
3 #
4 # Takes a 'manifest' style file and outputs a sorted version, warning about
5 # any duplicates.
6 #
7
8 import os
9 import sys
35173e8 @trentm OS-708: run the manifest through the sorter to remove dups, blanks li…
trentm authored
10
11 files = {}
7edf44a @joshwilsdon Initial import, moved from old illumos-extra repo.
joshwilsdon authored
12 filename = 'manifest'
13
14 # if filename is passed as first argument, use that file instead
15 if len(sys.argv) >= 2 and os.path.isfile(sys.argv[1]):
16 filename = sys.argv[1]
17
18 for line in open(filename).readlines():
35173e8 @trentm OS-708: run the manifest through the sorter to remove dups, blanks li…
trentm authored
19 line = line.strip()
7edf44a @joshwilsdon Initial import, moved from old illumos-extra repo.
joshwilsdon authored
20 if len(line) == 0 or line[0] == '#':
ca94e51 @joshwilsdon OS-675 fix sorter to handle comments and broken lines in manifest.gen
joshwilsdon authored
21 continue
35173e8 @trentm OS-708: run the manifest through the sorter to remove dups, blanks li…
trentm authored
22 fields = line.split(' ')
ca94e51 @joshwilsdon OS-675 fix sorter to handle comments and broken lines in manifest.gen
joshwilsdon authored
23 if len(fields) < 2:
35173e8 @trentm OS-708: run the manifest through the sorter to remove dups, blanks li…
trentm authored
24 sys.stderr.write("WARNING: unexpected manifest line: '%s' (removing)\n" % line)
ca94e51 @joshwilsdon OS-675 fix sorter to handle comments and broken lines in manifest.gen
joshwilsdon authored
25 continue
35173e8 @trentm OS-708: run the manifest through the sorter to remove dups, blanks li…
trentm authored
26 if fields[1] in files and not (
27 # Don't warn about same directory with identical properties.
28 fields[0] == 'd' and files[fields[1]] == line):
29 sys.stderr.write("WARNING: duplicate entry for '%s'\n" % fields[1])
30 files[fields[1]] = line
7edf44a @joshwilsdon Initial import, moved from old illumos-extra repo.
joshwilsdon authored
31
35173e8 @trentm OS-708: run the manifest through the sorter to remove dups, blanks li…
trentm authored
32 for key in sorted(files):
7edf44a @joshwilsdon Initial import, moved from old illumos-extra repo.
joshwilsdon authored
33 print files[key].rstrip(' ')
Something went wrong with that request. Please try again.