Show More
@@ -0,0 +1,60 b'' | |||||
|
1 | # fixpax - fix ownership in bdist_mpkg output | |||
|
2 | # | |||
|
3 | # Copyright 2015 Matt Mackall <mpm@selenic.com> | |||
|
4 | # | |||
|
5 | # This software may be used and distributed according to the terms of the | |||
|
6 | # MIT license (http://opensource.org/licenses/MIT) | |||
|
7 | ||||
|
8 | """Set file ownership to 0 in an Archive.pax.gz. | |||
|
9 | Suitable for fixing files bdist_mpkg output: | |||
|
10 | *.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz | |||
|
11 | """ | |||
|
12 | ||||
|
13 | import sys, os, gzip | |||
|
14 | ||||
|
15 | def fixpax(iname, oname): | |||
|
16 | i = gzip.GzipFile(iname) | |||
|
17 | o = gzip.GzipFile(oname, "w") | |||
|
18 | ||||
|
19 | while True: | |||
|
20 | magic = i.read(6) | |||
|
21 | dev = i.read(6) | |||
|
22 | ino = i.read(6) | |||
|
23 | mode = i.read(6) | |||
|
24 | i.read(6) # uid | |||
|
25 | i.read(6) # gid | |||
|
26 | nlink = i.read(6) | |||
|
27 | rdev = i.read(6) | |||
|
28 | mtime = i.read(11) | |||
|
29 | namesize = i.read(6) | |||
|
30 | filesize = i.read(11) | |||
|
31 | name = i.read(int(namesize, 8)) | |||
|
32 | data = i.read(int(filesize, 8)) | |||
|
33 | ||||
|
34 | o.write(magic) | |||
|
35 | o.write(dev) | |||
|
36 | o.write(ino) | |||
|
37 | o.write(mode) | |||
|
38 | o.write("000000") | |||
|
39 | o.write("000000") | |||
|
40 | o.write(nlink) | |||
|
41 | o.write(rdev) | |||
|
42 | o.write(mtime) | |||
|
43 | o.write(namesize) | |||
|
44 | o.write(filesize) | |||
|
45 | o.write(name) | |||
|
46 | o.write(data) | |||
|
47 | ||||
|
48 | if name.startswith("TRAILER!!!"): | |||
|
49 | o.write(i.read()) | |||
|
50 | break | |||
|
51 | ||||
|
52 | o.close() | |||
|
53 | i.close() | |||
|
54 | ||||
|
55 | if __name__ == '__main__': | |||
|
56 | for iname in sys.argv[1:]: | |||
|
57 | print 'fixing file ownership in %s' % iname | |||
|
58 | oname = sys.argv[1] + '.tmp' | |||
|
59 | fixpax(iname, oname) | |||
|
60 | os.rename(oname, iname) |
@@ -140,6 +140,7 b' osx:' | |||||
140 | (echo "Missing bdist_mpkg (easy_install bdist_mpkg)"; false) |
|
140 | (echo "Missing bdist_mpkg (easy_install bdist_mpkg)"; false) | |
141 | rm -rf dist/mercurial-*.mpkg |
|
141 | rm -rf dist/mercurial-*.mpkg | |
142 | python -m bdist_mpkg.script_bdist_mpkg setup.py -- |
|
142 | python -m bdist_mpkg.script_bdist_mpkg setup.py -- | |
|
143 | python contrib/fixpax.py dist/mercurial-*.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz | |||
143 | mkdir -p packages/osx |
|
144 | mkdir -p packages/osx | |
144 | N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" -ov packages/osx/$$N.dmg |
|
145 | N=`cd dist && echo mercurial-*.mpkg | sed 's,\.mpkg$$,,'` && hdiutil create -srcfolder dist/$$N.mpkg/ -scrub -volname "$$N" -ov packages/osx/$$N.dmg | |
145 | rm -rf dist/mercurial-*.mpkg |
|
146 | rm -rf dist/mercurial-*.mpkg |
General Comments 0
You need to be logged in to leave comments.
Login now