fixed: package may get build with bad permissions

This commit is contained in:
Nick Bolton 2014-04-10 08:40:55 +00:00
parent 5b16d557d8
commit 66a59428ea

View File

@ -1078,7 +1078,6 @@ class InternalCommands:
metaDir = '%s/%s/DEBIAN' % (debDir, package) metaDir = '%s/%s/DEBIAN' % (debDir, package)
os.makedirs(metaDir) os.makedirs(metaDir)
os.chmod(metaDir, 0o0755)
templateFile = open(resDir + '/deb/control.in') templateFile = open(resDir + '/deb/control.in')
template = templateFile.read() template = templateFile.read()
@ -1097,27 +1096,30 @@ class InternalCommands:
targetBin = '%s/%s/usr/bin' % (debDir, package) targetBin = '%s/%s/usr/bin' % (debDir, package)
targetShare = '%s/%s/usr/share' % (debDir, package) targetShare = '%s/%s/usr/share' % (debDir, package)
targetApplications = "%s/applications" % targetShare
targetIcons = "%s/icons" % targetShare
targetDocs = "%s/doc/%s" % (targetShare, self.project)
os.makedirs(targetBin) os.makedirs(targetBin)
os.makedirs("%s/applications" % targetShare) os.makedirs(targetApplications)
os.makedirs("%s/icons" % targetShare) os.makedirs(targetIcons)
os.makedirs("%s/doc/%s" % (targetShare, self.project)) os.makedirs(targetDocs)
for root, dirs, files in os.walk(debDir):
for d in dirs:
os.chmod(os.path.join(root, d), 0o0755)
binFiles = ['synergy', 'synergyc', 'synergys', 'synergyd', 'syntool'] binFiles = ['synergy', 'synergyc', 'synergys', 'synergyd', 'syntool']
for f in binFiles: for f in binFiles:
shutil.copy("%s/%s" % (binDir, f), targetBin) shutil.copy("%s/%s" % (binDir, f), targetBin)
target = "%s/%s" % (targetBin, f)
err = os.system("strip %s/%s" % (targetBin, f)) os.chmod(target, 0o0755)
err = os.system("strip " + target)
if err != 0: if err != 0:
raise Exception('strip failed: ' + str(err)) raise Exception('strip failed: ' + str(err))
shutil.copy( shutil.copy("%s/synergy.desktop" % resDir, targetApplications)
"%s/synergy.desktop" % resDir, shutil.copy("%s/synergy.ico" % resDir, targetIcons)
"%s/applications" % targetShare)
shutil.copy(
"%s/synergy.ico" % resDir,
"%s/icons" % targetShare)
docTarget = "%s/doc/%s" % (targetShare, self.project) docTarget = "%s/doc/%s" % (targetShare, self.project)
@ -1128,6 +1130,10 @@ class InternalCommands:
os.system("gzip -9 %s/changelog" % docTarget) os.system("gzip -9 %s/changelog" % docTarget)
if err != 0: if err != 0:
raise Exception('gzip failed: ' + str(err)) raise Exception('gzip failed: ' + str(err))
for root, dirs, files in os.walk(targetShare):
for f in files:
os.chmod(os.path.join(root, f), 0o0644)
target = '../../bin/%s.deb' % package target = '../../bin/%s.deb' % package