Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r44281:1cd8af4dff37 Date: 2011-05-18 16:24 +0200 http://bitbucket.org/pypy/pypy/changeset/1cd8af4dff37/
Log: merge heads diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -36,6 +36,10 @@ class PyPyCNotFound(Exception): pass +def fix_permissions(basedir): + if sys.platform != 'win32': + os.system("chmod -R a+rX %s" % basedir) + def package(basedir, name='pypy-nightly', rename_pypy_c='pypy', copy_to_dir = None, override_pypy_c = None): basedir = py.path.local(basedir) @@ -93,6 +97,7 @@ archive = bindir.join(target) shutil.copy(str(source), str(archive)) old_dir = os.getcwd() + fix_permissions(builddir) try: os.chdir(str(builddir)) # @@ -117,7 +122,7 @@ zf.close() else: archive = str(builddir.join(name + '.tar.bz2')) - e = os.system('tar cvjf ' + archive + " " + name) + e = os.system('tar --owner=root --group=root --numeric-owner -cvjf ' + archive + " " + name) if e: raise OSError('"tar" returned exit status %r' % e) finally: diff --git a/pypy/tool/release/test/test_package.py b/pypy/tool/release/test/test_package.py --- a/pypy/tool/release/test/test_package.py +++ b/pypy/tool/release/test/test_package.py @@ -10,9 +10,11 @@ if sys.platform == 'win32': basename = 'pypy-c.exe' rename_pypy_c = 'pypy-c' + exe_name_in_archive = 'pypy-c.exe' else: basename = 'pypy-c' rename_pypy_c = 'pypy' + exe_name_in_archive = 'bin/pypy' pypy_c = py.path.local(pypydir).join('translator', 'goal', basename) if not pypy_c.check(): os.system("echo faked_pypy_c> %s" % (pypy_c,)) @@ -25,10 +27,7 @@ prefix = builddir.join(test) cpyver = '%d.%d' % CPYTHON_VERSION[:2] assert prefix.join('lib-python', cpyver, 'test').check() - if sys.platform == 'win32': - assert prefix.join('pypy-c.exe').check() - else: - assert prefix.join('bin', 'pypy').check() + assert prefix.join(exe_name_in_archive).check() assert prefix.join('lib_pypy', 'syslog.py').check() assert not prefix.join('lib_pypy', 'py').check() assert not prefix.join('lib_pypy', 'ctypes_configure').check() @@ -39,7 +38,14 @@ assert zh.open('%s/lib_pypy/syslog.py' % test) else: th = tarfile.open(str(builddir.join('%s.tar.bz2' % test))) - assert th.getmember('%s/lib_pypy/syslog.py' % test) + syslog = th.getmember('%s/lib_pypy/syslog.py' % test) + exe = th.getmember('%s/%s' % (test, exe_name_in_archive)) + assert syslog.mode == 0644 + assert exe.mode == 0755 + assert exe.uname == '' + assert exe.gname == '' + assert exe.uid == 0 + assert exe.gid == 0 # the headers file could be not there, because they are copied into # trunk/include only during translation @@ -66,3 +72,26 @@ test_dir_structure(test='testzipfile') finally: package.USE_ZIPFILE_MODULE = prev + +def test_fix_permissions(tmpdir): + def check(f, mode): + assert f.stat().mode & 0777 == mode + # + mydir = tmpdir.join('mydir').ensure(dir=True) + bin = tmpdir.join('bin') .ensure(dir=True) + file1 = tmpdir.join('file1').ensure(file=True) + file2 = mydir .join('file2').ensure(file=True) + pypy = bin .join('pypy') .ensure(file=True) + # + mydir.chmod(0700) + bin.chmod(0700) + file1.chmod(0600) + file2.chmod(0640) + pypy.chmod(0700) + # + package.fix_permissions(tmpdir) + check(mydir, 0755) + check(bin, 0755) + check(file1, 0644) + check(file2, 0644) + check(pypy, 0755) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit