Skip to content

Commit e401342

Browse files
author
Robert Strong
committed
Mac v2 signing - Bug 1059567 - Packaging changes for the move of removed-files file from Contents/MacOS to Contents/Resources. r=bbondy, r=nthomas
--HG-- rename : tools/update-packaging/test/from-mac/Contents/MacOS/application.ini => tools/update-packaging/test/from-mac/Contents/Resources/application.ini rename : tools/update-packaging/test/from-mac/Contents/MacOS/distribution/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/from-mac/Contents/Resources/distribution/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/from-mac/Contents/Resources/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/readme.txt => tools/update-packaging/test/from-mac/Contents/Resources/readme.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/removed.txt => tools/update-packaging/test/from-mac/Contents/Resources/removed.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/same.txt => tools/update-packaging/test/from-mac/Contents/Resources/same.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/searchplugins/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/from-mac/Contents/Resources/searchplugins/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/from-mac/Contents/MacOS/update-settings.ini => tools/update-packaging/test/from-mac/Contents/Resources/update-settings.ini rename : tools/update-packaging/test/from-mac/Contents/MacOS/{foodir/channel-prefs.js => tools/update-packaging/test/from-mac/Contents/Resources/{foodir/channel-prefs.js rename : tools/update-packaging/test/from-mac/Contents/MacOS/{foodir/force.txt => tools/update-packaging/test/from-mac/Contents/Resources/{foodir/force.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/application.ini => tools/update-packaging/test/to-mac/Contents/Resources/application.ini rename : tools/update-packaging/test/to-mac/Contents/MacOS/distribution/extensions/added/file.txt => tools/update-packaging/test/to-mac/Contents/Resources/distribution/extensions/added/file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/distribution/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/to-mac/Contents/Resources/distribution/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/extensions/added/file.txt => tools/update-packaging/test/to-mac/Contents/Resources/extensions/added/file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/extensions/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/to-mac/Contents/Resources/extensions/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/readme.txt => tools/update-packaging/test/to-mac/Contents/Resources/readme.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/removed-files => tools/update-packaging/test/to-mac/Contents/Resources/removed-files rename : tools/update-packaging/test/to-mac/Contents/MacOS/same.txt => tools/update-packaging/test/to-mac/Contents/Resources/same.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/searchplugins/added/file.txt => tools/update-packaging/test/to-mac/Contents/Resources/searchplugins/added/file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/searchplugins/diff/diff-patch-larger-than-file.txt => tools/update-packaging/test/to-mac/Contents/Resources/searchplugins/diff/diff-patch-larger-than-file.txt rename : tools/update-packaging/test/to-mac/Contents/MacOS/update-settings.ini => tools/update-packaging/test/to-mac/Contents/Resources/update-settings.ini rename : tools/update-packaging/test/to-mac/Contents/MacOS/{foodir/channel-prefs.js => tools/update-packaging/test/to-mac/Contents/Resources/{foodir/channel-prefs.js rename : tools/update-packaging/test/to-mac/Contents/MacOS/{foodir/force.txt => tools/update-packaging/test/to-mac/Contents/Resources/{foodir/force.txt
1 parent 2230b39 commit e401342

32 files changed

+128
-145
lines changed

browser/installer/removed-files.in

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -52,51 +52,66 @@
5252
#
5353
# Example: path/to/dir/*
5454

55+
# Due to Apple Mac OS X packaging requirements files that are in the same
56+
# directory on other platforms must be located in different directories on
57+
# Mac OS X. The following defines allow specifying the Mac OS X bundle
58+
# location which also work on other platforms.
59+
#
60+
# @DIR_MACOS@
61+
# Equals Contents/MacOS/ on Mac OX X and is an empty string on other platforms.
62+
#
63+
# @DIR_RESOURCES@
64+
# Equals Contents/Resources/ on Mac OX X and is an empty string on other
65+
# platforms.
66+
5567
# File Removals
5668
# This is located under the "distribution/" directory and it was added before
5769
# Firefox 27
58-
distribution/extensions/testpilot@labs.mozilla.com.xpi
70+
@DIR_MACOS@distribution/extensions/testpilot@labs.mozilla.com.xpi
5971

6072
# Some users are ending up with unpacked chrome instead of omni.ja. This
6173
# causes updates to break badly, see bug 1063052. Removing the toplevel
6274
# chrome.manifest causes us to use the updated omni.ja.
6375
#ifndef MOZ_GTK
64-
chrome.manifest
76+
@DIR_MACOS@chrome.manifest
77+
#ifdef XP_MACOSX
78+
@DIR_RESOURCES@chrome.manifest
79+
#endif
6580
#endif
6681

6782
# Directory removals
68-
chrome/
83+
@DIR_MACOS@chrome/
6984
#ifdef XP_UNIX
7085
#ifndef XP_MACOSX
7186
chrome/icons/
7287
chrome/icons/default/
7388
#endif
7489
#endif
75-
chrome/overlayinfo/
76-
components/
77-
defaults/autoconfig/
78-
defaults/profile/
79-
defaults/profile/chrome/
80-
defaults/profile/US/*
81-
defaults/profile/extensions/
82-
defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
83-
distribution/
84-
distribution/extensions/
85-
extensions/
86-
extensions/inspector@mozilla.org/*
87-
extensions/reporter@mozilla.org/*
88-
extensions/talkback@mozilla.org/*
89-
extensions/testpilot@labs.mozilla.com/*
90-
extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/*
91-
extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
92-
greprefs/
93-
jssubloader/
94-
modules/
90+
@DIR_MACOS@chrome/overlayinfo/
91+
@DIR_MACOS@components/
92+
@DIR_MACOS@defaults/autoconfig/
93+
@DIR_MACOS@defaults/profile/
94+
@DIR_MACOS@defaults/profile/chrome/
95+
@DIR_MACOS@defaults/profile/US/*
96+
@DIR_MACOS@defaults/profile/extensions/
97+
@DIR_MACOS@defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
98+
@DIR_MACOS@distribution/
99+
@DIR_MACOS@distribution/extensions/
100+
@DIR_MACOS@extensions/
101+
@DIR_MACOS@extensions/inspector@mozilla.org/*
102+
@DIR_MACOS@extensions/reporter@mozilla.org/*
103+
@DIR_MACOS@extensions/talkback@mozilla.org/*
104+
@DIR_MACOS@extensions/testpilot@labs.mozilla.com/*
105+
@DIR_MACOS@extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/*
106+
@DIR_MACOS@extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/*
107+
@DIR_MACOS@greprefs/
108+
@DIR_MACOS@jssubloader/
109+
@DIR_MACOS@modules/
95110
#ifdef XP_MACOSX
96-
plugins/Default Plugin.plugin/*
97-
plugins/JavaEmbeddingPlugin.bundle/*
98-
plugins/MRJPlugin.plugin/*
99-
../Plug-Ins/PrintPDE.plugin/*
111+
@DIR_MACOS@plugins/Default Plugin.plugin/*
112+
@DIR_MACOS@plugins/JavaEmbeddingPlugin.bundle/*
113+
@DIR_MACOS@plugins/MRJPlugin.plugin/*
114+
Contents/Plug-Ins/PrintPDE.plugin/*
100115
#endif
101-
searchplugins/*
102-
webapprt/components/
116+
@DIR_MACOS@searchplugins/*
117+
@DIR_MACOS@webapprt/components/

toolkit/mozapps/installer/packager.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,12 @@ endif
608608

609609
DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX) -DBIN_SUFFIX=$(BIN_SUFFIX)
610610

611+
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
612+
DEFINES += -DDIR_MACOS=Contents/MacOS/ -DDIR_RESOURCES=Contents/Resources/
613+
else
614+
DEFINES += -DDIR_MACOS= -DDIR_RESOURCES=
615+
endif
616+
611617
ifdef MOZ_FOLD_LIBS
612618
DEFINES += -DMOZ_FOLD_LIBS=1
613619
endif

tools/update-packaging/common.sh

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,9 @@ append_remove_instructions() {
130130
filev3="$3"
131131

132132
if [ -f "$dir/removed-files" ]; then
133-
prefix=
134133
listfile="$dir/removed-files"
135-
elif [ -f "$dir/Contents/MacOS/removed-files" ]; then
136-
prefix=Contents/MacOS/
137-
listfile="$dir/Contents/MacOS/removed-files"
134+
elif [ -f "$dir/Contents/Resources/removed-files" ]; then
135+
listfile="$dir/Contents/Resources/removed-files"
138136
fi
139137
if [ -n "$listfile" ]; then
140138
# Map spaces to pipes so that we correctly handle filenames with spaces.
@@ -149,33 +147,20 @@ append_remove_instructions() {
149147
if [ -n "$f" ]; then
150148
# Exclude comments
151149
if [ ! $(echo "$f" | grep -c '^#') = 1 ]; then
152-
# Normalize the path to the root of the Mac OS X bundle if necessary
153-
fixedprefix="$prefix"
154-
if [ $prefix ]; then
155-
if [ $(echo "$f" | grep -c '^\.\./') = 1 ]; then
156-
if [ $(echo "$f" | grep -c '^\.\./\.\./') = 1 ]; then
157-
f=$(echo $f | sed -e 's:^\.\.\/\.\.\/::')
158-
fixedprefix=""
159-
else
160-
f=$(echo $f | sed -e 's:^\.\.\/::')
161-
fixedprefix=$(echo "$prefix" | sed -e 's:[^\/]*\/$::')
162-
fi
163-
fi
164-
fi
165150
if [ $(echo "$f" | grep -c '\/$') = 1 ]; then
166-
notice " rmdir \"$fixedprefix$f\""
167-
echo "rmdir \"$fixedprefix$f\"" >> $filev2
168-
echo "rmdir \"$fixedprefix$f\"" >> $filev3
151+
notice " rmdir \"$f\""
152+
echo "rmdir \"$f\"" >> $filev2
153+
echo "rmdir \"$f\"" >> $filev3
169154
elif [ $(echo "$f" | grep -c '\/\*$') = 1 ]; then
170155
# Remove the *
171156
f=$(echo "$f" | sed -e 's:\*$::')
172-
notice " rmrfdir \"$fixedprefix$f\""
173-
echo "rmrfdir \"$fixedprefix$f\"" >> $filev2
174-
echo "rmrfdir \"$fixedprefix$f\"" >> $filev3
157+
notice " rmrfdir \"$f\""
158+
echo "rmrfdir \"$f\"" >> $filev2
159+
echo "rmrfdir \"$f\"" >> $filev3
175160
else
176-
notice " remove \"$fixedprefix$f\""
177-
echo "remove \"$fixedprefix$f\"" >> $filev2
178-
echo "remove \"$fixedprefix$f\"" >> $filev3
161+
notice " remove \"$f\""
162+
echo "remove \"$f\"" >> $filev2
163+
echo "remove \"$f\"" >> $filev3
179164
fi
180165
fi
181166
fi

tools/update-packaging/make_incremental_update.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,6 @@ num_removes=0
144144
for ((i=0; $i<$num_oldfiles; i=$i+1)); do
145145
f="${oldfiles[$i]}"
146146

147-
# This file is created by Talkback, so we can ignore it
148-
if [ "$f" = "readme.txt" ]; then
149-
continue 1
150-
fi
151-
152-
# removed-files is excluded by make_incremental_updates.py so it is excluded
153-
# here for consistency.
154-
if [ `basename $f` = "removed-files" ]; then
155-
continue 1
156-
fi
157-
158147
# If this file exists in the new directory as well, then check if it differs.
159148
if [ -f "$newdir/$f" ]; then
160149

@@ -219,12 +208,6 @@ num_newfiles=${#newfiles[*]}
219208
for ((i=0; $i<$num_newfiles; i=$i+1)); do
220209
f="${newfiles[$i]}"
221210

222-
# removed-files is excluded by make_incremental_updates.py so it is excluded
223-
# here for consistency.
224-
if [ `basename $f` = "removed-files" ]; then
225-
continue 1
226-
fi
227-
228211
# If we've already tested this file, then skip it
229212
for ((j=0; $j<$num_oldfiles; j=$j+1)); do
230213
if [ "$f" = "${oldfiles[j]}" ]; then

tools/update-packaging/make_incremental_updates.py

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class PatchInfo:
2222
archive_files = list of files to include in this patch
2323
manifestv2 = set of manifest version 2 patch instructions
2424
manifestv3 = set of manifest version 3 patch instructions
25-
file_exclusion_list =
25+
file_exclusion_list =
2626
files to exclude from this patch. names without slashes will be
2727
excluded anywhere in the directory hiearchy. names with slashes
2828
will only be excluded at that exact path
@@ -154,7 +154,7 @@ def build_marfile_entry_hash(self, root_path):
154154
dirname_set.add(dirname)
155155

156156
return mar_entry_hash, filename_set, dirname_set
157-
157+
158158

159159
class MarFileEntry:
160160
"""Represents a file inside a Mozilla Archive Format (MAR)
@@ -163,7 +163,7 @@ class MarFileEntry:
163163
foo.mar/dir/bar.txt extracted into /tmp/foo:
164164
abs_path=/tmp/foo/dir/bar.txt
165165
name = dir/bar.txt
166-
"""
166+
"""
167167
def __init__(self, root, name):
168168
"""root = path the the top of the mar
169169
name = relative path within the mar"""
@@ -211,10 +211,10 @@ def bunzip_file(filename):
211211
if not filename.endswith(".bz2"):
212212
os.rename(filename, filename+".bz2")
213213
filename=filename+".bz2"
214-
exec_shell_cmd('bzip2 -d "' + filename+'"')
214+
exec_shell_cmd('bzip2 -d "' + filename+'"')
215215

216216

217-
def extract_mar(filename, work_dir):
217+
def extract_mar(filename, work_dir):
218218
""" Extracts the marfile intot he work_dir
219219
assumes work_dir already exists otherwise will throw osError"""
220220
print "Extracting "+filename+" to "+work_dir
@@ -280,7 +280,7 @@ def create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, pa
280280
# Copy the pre-calculated file into our new patch work aread
281281
copy_file(src_file_abs_path, os.path.join(patch_info.work_dir, file_in_manifest_name))
282282
patch_info.archive_files.append('"'+file_in_manifest_name+'"')
283-
283+
284284
def create_add_patch_for_file(to_marfile_entry, patch_info):
285285
""" Copy the file to the working dir, add the add instruction, and add it to the list of archive files """
286286
copy_file(to_marfile_entry.abs_path, os.path.join(patch_info.work_dir, to_marfile_entry.name))
@@ -293,36 +293,28 @@ def create_add_if_not_patch_for_file(to_marfile_entry, patch_info):
293293
patch_info.append_add_if_not_instruction(to_marfile_entry.name)
294294
patch_info.archive_files.append('"'+to_marfile_entry.name+'"')
295295

296-
def process_explicit_remove_files(dir_path, patch_info):
296+
def process_explicit_remove_files(dir_path, patch_info):
297297
""" Looks for a 'removed-files' file in the dir_path. If the removed-files does not exist
298298
this will throw. If found adds the removed-files
299299
found in that file to the patch_info"""
300300

301301
# Windows and linux have this file at the root of the dir
302302
list_file_path = os.path.join(dir_path, "removed-files")
303-
prefix=""
304303
if not os.path.exists(list_file_path):
305-
# On Mac removed-files contains relative paths from Contents/MacOS/
306-
prefix= "Contents/MacOS"
307-
list_file_path = os.path.join(dir_path, prefix+"/removed-files")
304+
list_file_path = os.path.join(dir_path, "Contents/Resources/removed-files")
308305

309306
if (os.path.exists(list_file_path)):
310-
list_file = bz2.BZ2File(list_file_path,"r") # throws if doesn't exist
307+
list_file = open(list_file_path,"r") # throws if doesn't exist
311308

312309
lines = []
313310
for line in list_file:
314311
lines.append(line.strip())
312+
list_file.close()
315313

316314
lines.sort(reverse=True)
317315
for line in lines:
318316
# Exclude any blank and comment lines.
319317
if line and not line.startswith("#"):
320-
if prefix != "":
321-
if line.startswith("../"):
322-
line = line.replace("../../", "")
323-
line = line.replace("../", "Contents/")
324-
else:
325-
line = os.path.join(prefix,line)
326318
# Python on windows uses \ for path separators and the update
327319
# manifests expects / for path separators on all platforms.
328320
line = line.replace("\\", "/")
@@ -336,7 +328,7 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
336328
# Create a hashtable of the from and to directories
337329
from_dir_hash,from_file_set,from_dir_set = patch_info.build_marfile_entry_hash(from_dir_path)
338330
to_dir_hash,to_file_set,to_dir_set = patch_info.build_marfile_entry_hash(to_dir_path)
339-
# Create a list of the forced updates
331+
# Create a list of the forced updates
340332
forced_list = forced_updates.strip().split('|')
341333
# Require that the precomplete file is included in the complete update
342334
if "precomplete" not in to_file_set:
@@ -364,7 +356,7 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
364356
print 'Forcing "'+filename+'"'
365357
# This filename is in the forced list, explicitly add
366358
create_add_patch_for_file(to_dir_hash[filename], patch_info)
367-
else:
359+
else:
368360
if from_marfile_entry.sha() != to_marfile_entry.sha():
369361
# Not the same - calculate a patch
370362
create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, patch_info)
@@ -404,27 +396,27 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
404396
if not os.path.exists(patch_file_dir):
405397
os.makedirs(patch_file_dir)
406398
shutil.copy2(os.path.join(patch_info.work_dir,"output.mar"), patch_filename)
399+
407400
return patch_filename
408401

409402
def usage():
410403
print "-h for help"
411404
print "-f for patchlist_file"
412405

413-
def get_buildid(work_dir, platform):
406+
def get_buildid(work_dir):
414407
""" extracts buildid from MAR
415-
TODO: this should handle 1.8 branch too
416408
"""
417-
if platform == 'mac':
418-
ini = '%s/Contents/MacOS/application.ini' % work_dir
419-
else:
420-
ini = '%s/application.ini' % work_dir
409+
ini = '%s/application.ini' % work_dir
421410
if not os.path.exists(ini):
422-
print 'WARNING: application.ini not found, cannot find build ID'
423-
return ''
411+
ini = '%s/Contents/Resources/application.ini' % work_dir
412+
if not os.path.exists(ini):
413+
print 'WARNING: application.ini not found, cannot find build ID'
414+
return ''
415+
424416
file = bz2.BZ2File(ini)
425417
for line in file:
426-
if line.find('BuildID') == 0:
427-
return line.strip().split('=')[1]
418+
if line.find('BuildID') == 0:
419+
return line.strip().split('=')[1]
428420
print 'WARNING: cannot find build ID in application.ini'
429421
return ''
430422

@@ -457,7 +449,7 @@ def create_partial_patches(patches):
457449
try:
458450
work_dir_root = tempfile.mkdtemp('-fastmode', 'tmp', os.getcwd())
459451
print "Building patches using work dir: %s" % (work_dir_root)
460-
452+
461453
# Iterate through every patch set in the patch file
462454
patch_num = 1
463455
for patch in patches:
@@ -475,7 +467,7 @@ def create_partial_patches(patches):
475467
os.mkdir(work_dir_from)
476468
extract_mar(from_filename,work_dir_from)
477469
from_decoded = decode_filename(from_filename)
478-
from_buildid = get_buildid(work_dir_from, from_decoded['platform'])
470+
from_buildid = get_buildid(work_dir_from)
479471
from_shasum = sha.sha(open(from_filename).read()).hexdigest()
480472
from_size = str(os.path.getsize(to_filename))
481473

@@ -484,13 +476,13 @@ def create_partial_patches(patches):
484476
os.mkdir(work_dir_to)
485477
extract_mar(to_filename, work_dir_to)
486478
to_decoded = decode_filename(from_filename)
487-
to_buildid = get_buildid(work_dir_to, to_decoded['platform'])
479+
to_buildid = get_buildid(work_dir_to)
488480
to_shasum = sha.sha(open(to_filename).read()).hexdigest()
489481
to_size = str(os.path.getsize(to_filename))
490482

491483
mar_extract_time = time.time()
492484

493-
partial_filename = create_partial_patch(work_dir_from, work_dir_to, patch_filename, shas, PatchInfo(work_dir, ['update.manifest','updatev2.manifest','updatev3.manifest','removed-files'],['/readme.txt']),forced_updates,['channel-prefs.js','update-settings.ini'])
485+
partial_filename = create_partial_patch(work_dir_from, work_dir_to, patch_filename, shas, PatchInfo(work_dir, ['update.manifest','updatev2.manifest','updatev3.manifest'],[]),forced_updates,['channel-prefs.js','update-settings.ini'])
494486
partial_buildid = to_buildid
495487
partial_shasum = sha.sha(open(partial_filename).read()).hexdigest()
496488
partial_size = str(os.path.getsize(partial_filename))
@@ -499,11 +491,11 @@ def create_partial_patches(patches):
499491
'to_filename': os.path.basename(to_filename),
500492
'from_filename': os.path.basename(from_filename),
501493
'partial_filename': os.path.basename(partial_filename),
502-
'to_buildid':to_buildid,
503-
'from_buildid':from_buildid,
504-
'to_sha1sum':to_shasum,
505-
'from_sha1sum':from_shasum,
506-
'partial_sha1sum':partial_shasum,
494+
'to_buildid':to_buildid,
495+
'from_buildid':from_buildid,
496+
'to_sha1sum':to_shasum,
497+
'from_sha1sum':from_shasum,
498+
'partial_sha1sum':partial_shasum,
507499
'to_size':to_size,
508500
'from_size':from_size,
509501
'partial_size':partial_size,

0 commit comments

Comments
 (0)