mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
bug 896223 - Remove the version 1 manifest from the mar creation scripts. r=nthomas
This commit is contained in:
parent
46a7d98005
commit
376e960b5a
@ -77,8 +77,7 @@ make_patch_instruction() {
|
||||
|
||||
append_remove_instructions() {
|
||||
dir="$1"
|
||||
filev1="$2"
|
||||
filev2="$3"
|
||||
filev2="$2"
|
||||
if [ -f "$dir/removed-files" ]; then
|
||||
prefix=
|
||||
listfile="$dir/removed-files"
|
||||
@ -122,7 +121,6 @@ append_remove_instructions() {
|
||||
echo "rmrfdir \"$fixedprefix$f\"" >> $filev2
|
||||
else
|
||||
notice " remove: $fixedprefix$f"
|
||||
echo "remove \"$fixedprefix$f\"" >> $filev1
|
||||
echo "remove \"$fixedprefix$f\"" >> $filev2
|
||||
fi
|
||||
fi
|
||||
|
@ -43,9 +43,8 @@ if [ $(echo "$targetdir" | grep -c '\/$') = 1 ]; then
|
||||
targetdir=$(echo "$targetdir" | sed -e 's:\/$::')
|
||||
fi
|
||||
workdir="$targetdir.work"
|
||||
updatemanifestv1="$workdir/update.manifest"
|
||||
updatemanifestv2="$workdir/updatev2.manifest"
|
||||
targetfiles="update.manifest updatev2.manifest"
|
||||
targetfiles="updatev2.manifest"
|
||||
|
||||
mkdir -p "$workdir"
|
||||
|
||||
@ -67,16 +66,21 @@ list_files files
|
||||
|
||||
popd
|
||||
|
||||
# Add the type of update to the beginning of version 2 update manifest.
|
||||
> $updatemanifestv2
|
||||
notice ""
|
||||
notice "Adding file add instructions to file 'update.manifest'"
|
||||
> $updatemanifestv1
|
||||
notice "Adding type instruction to file 'updatev2.manifest'"
|
||||
notice " type: complete"
|
||||
echo "type \"complete\"" >> $updatemanifestv2
|
||||
|
||||
notice ""
|
||||
notice "Adding file add instructions to file 'updatev2.manifest'"
|
||||
num_files=${#files[*]}
|
||||
|
||||
for ((i=0; $i<$num_files; i=$i+1)); do
|
||||
f="${files[$i]}"
|
||||
|
||||
make_add_instruction "$f" >> $updatemanifestv1
|
||||
make_add_instruction "$f" >> $updatemanifestv2
|
||||
|
||||
dir=$(dirname "$f")
|
||||
mkdir -p "$workdir/$dir"
|
||||
@ -86,24 +90,11 @@ for ((i=0; $i<$num_files; i=$i+1)); do
|
||||
targetfiles="$targetfiles \"$f\""
|
||||
done
|
||||
|
||||
# Add the type of update to the beginning of and cat the contents of the version
|
||||
# 1 update manifest to the version 2 update manifest.
|
||||
> $updatemanifestv2
|
||||
notice ""
|
||||
notice "Adding type instruction to file 'updatev2.manifest'"
|
||||
notice " type: complete"
|
||||
echo "type \"complete\"" >> $updatemanifestv2
|
||||
|
||||
notice ""
|
||||
notice "Concatenating file 'update.manifest' to file 'updatev2.manifest'"
|
||||
cat $updatemanifestv1 >> $updatemanifestv2
|
||||
|
||||
# Append remove instructions for any dead files.
|
||||
notice ""
|
||||
notice "Adding file and directory remove instructions from file 'removed-files'"
|
||||
append_remove_instructions "$targetdir" "$updatemanifestv1" "$updatemanifestv2"
|
||||
append_remove_instructions "$targetdir" "$updatemanifestv2"
|
||||
|
||||
$BZIP2 -z9 "$updatemanifestv1" && mv -f "$updatemanifestv1.bz2" "$updatemanifestv1"
|
||||
$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
|
||||
|
||||
eval "$MAR -C \"$workdir\" -c output.mar $targetfiles"
|
||||
|
@ -86,9 +86,8 @@ if [ $(echo "$newdir" | grep -c '\/$') = 1 ]; then
|
||||
newdir=$(echo "$newdir" | sed -e 's:\/$::')
|
||||
fi
|
||||
workdir="$newdir.work"
|
||||
updatemanifestv1="$workdir/update.manifest"
|
||||
updatemanifestv2="$workdir/updatev2.manifest"
|
||||
archivefiles="update.manifest updatev2.manifest"
|
||||
archivefiles="updatev2.manifest"
|
||||
|
||||
mkdir -p "$workdir"
|
||||
|
||||
@ -121,9 +120,15 @@ list_files newfiles
|
||||
|
||||
popd
|
||||
|
||||
# Add the type of update to the beginning of version 2 update manifest.
|
||||
notice ""
|
||||
notice "Adding file patch and add instructions to file 'update.manifest'"
|
||||
> $updatemanifestv1
|
||||
notice "Adding type instruction to file 'updatev2.manifest'"
|
||||
> $updatemanifestv2
|
||||
notice " type: partial"
|
||||
echo "type \"partial\"" >> $updatemanifestv2
|
||||
|
||||
notice ""
|
||||
notice "Adding file patch and add instructions to file 'updatev2.manifest'"
|
||||
|
||||
num_oldfiles=${#oldfiles[*]}
|
||||
remove_array=
|
||||
@ -151,7 +156,7 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
|
||||
mkdir -p `dirname "$workdir/$f"`
|
||||
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
|
||||
copy_perm "$newdir/$f" "$workdir/$f"
|
||||
make_add_instruction "$f" 1 >> $updatemanifestv1
|
||||
make_add_instruction "$f" 1 >> $updatemanifestv2
|
||||
archivefiles="$archivefiles \"$f\""
|
||||
continue 1
|
||||
fi
|
||||
@ -170,12 +175,12 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
|
||||
fullsize=$(get_file_size "$workdir/$f")
|
||||
|
||||
if [ $patchsize -lt $fullsize ]; then
|
||||
make_patch_instruction "$f" >> $updatemanifestv1
|
||||
make_patch_instruction "$f" >> $updatemanifestv2
|
||||
mv -f "$patchfile" "$workdir/$f.patch"
|
||||
rm -f "$workdir/$f"
|
||||
archivefiles="$archivefiles \"$f.patch\""
|
||||
else
|
||||
make_add_instruction "$f" >> $updatemanifestv1
|
||||
make_add_instruction "$f" >> $updatemanifestv2
|
||||
rm -f "$patchfile"
|
||||
archivefiles="$archivefiles \"$f\""
|
||||
fi
|
||||
@ -190,7 +195,7 @@ done
|
||||
|
||||
# Newly added files
|
||||
notice ""
|
||||
notice "Adding file add instructions to file 'update.manifest'"
|
||||
notice "Adding file add instructions to file 'updatev2.manifest'"
|
||||
num_newfiles=${#newfiles[*]}
|
||||
|
||||
for ((i=0; $i<$num_newfiles; i=$i+1)); do
|
||||
@ -215,34 +220,22 @@ for ((i=0; $i<$num_newfiles; i=$i+1)); do
|
||||
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
|
||||
copy_perm "$newdir/$f" "$workdir/$f"
|
||||
|
||||
make_add_instruction "$f" >> "$updatemanifestv1"
|
||||
make_add_instruction "$f" >> "$updatemanifestv2"
|
||||
archivefiles="$archivefiles \"$f\""
|
||||
done
|
||||
|
||||
notice ""
|
||||
notice "Adding file remove instructions to file 'update.manifest'"
|
||||
notice "Adding file remove instructions to file 'updatev2.manifest'"
|
||||
for ((i=0; $i<$num_removes; i=$i+1)); do
|
||||
f="${remove_array[$i]}"
|
||||
notice " remove: $f"
|
||||
echo "remove \"$f\"" >> $updatemanifestv1
|
||||
echo "remove \"$f\"" >> $updatemanifestv2
|
||||
done
|
||||
|
||||
# Add the type of update to the beginning of and cat the contents of the version
|
||||
# 1 update manifest to the version 2 update manifest.
|
||||
notice ""
|
||||
notice "Adding type instruction to file 'updatev2.manifest'"
|
||||
> $updatemanifestv2
|
||||
notice " type: partial"
|
||||
echo "type \"partial\"" >> $updatemanifestv2
|
||||
|
||||
notice ""
|
||||
notice "Concatenating file 'update.manifest' to file 'updatev2.manifest'"
|
||||
cat $updatemanifestv1 >> $updatemanifestv2
|
||||
|
||||
# Append remove instructions for any dead files.
|
||||
# Add remove instructions for any dead files.
|
||||
notice ""
|
||||
notice "Adding file and directory remove instructions from file 'removed-files'"
|
||||
append_remove_instructions "$newdir" "$updatemanifestv1" "$updatemanifestv2"
|
||||
append_remove_instructions "$newdir" "$updatemanifestv2"
|
||||
|
||||
notice ""
|
||||
notice "Adding directory remove instructions for directories that no longer exist"
|
||||
@ -257,7 +250,6 @@ for ((i=0; $i<$num_olddirs; i=$i+1)); do
|
||||
fi
|
||||
done
|
||||
|
||||
$BZIP2 -z9 "$updatemanifestv1" && mv -f "$updatemanifestv1.bz2" "$updatemanifestv1"
|
||||
$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
|
||||
|
||||
eval "$MAR -C \"$workdir\" -c output.mar $archivefiles"
|
||||
|
@ -20,7 +20,6 @@ class PatchInfo:
|
||||
""" Represents the meta-data associated with a patch
|
||||
work_dir = working dir where files are stored for this patch
|
||||
archive_files = list of files to include in this patch
|
||||
manifestv1 = set of manifest version 1 patch instructions
|
||||
manifestv2 = set of manifest version 2 patch instructions
|
||||
file_exclusion_list =
|
||||
files to exclude from this patch. names without slashes will be
|
||||
@ -30,7 +29,6 @@ class PatchInfo:
|
||||
def __init__(self, work_dir, file_exclusion_list, path_exclusion_list):
|
||||
self.work_dir=work_dir
|
||||
self.archive_files=[]
|
||||
self.manifestv1=[]
|
||||
self.manifestv2=[]
|
||||
self.file_exclusion_list=file_exclusion_list
|
||||
self.path_exclusion_list=path_exclusion_list
|
||||
@ -46,10 +44,8 @@ class PatchInfo:
|
||||
if m:
|
||||
# Directory immediately following extensions is used for the test
|
||||
testdir = m.group(1)
|
||||
self.manifestv1.append('add-if "'+testdir+'" "'+filename+'"')
|
||||
self.manifestv2.append('add-if "'+testdir+'" "'+filename+'"')
|
||||
else:
|
||||
self.manifestv1.append('add "'+filename+'"')
|
||||
self.manifestv2.append('add "'+filename+'"')
|
||||
|
||||
def append_patch_instruction(self, filename, patchname):
|
||||
@ -66,10 +62,8 @@ class PatchInfo:
|
||||
m = re.match("((?:|.*/)distribution/extensions)/", filename)
|
||||
if m:
|
||||
testdir = m.group(1)
|
||||
self.manifestv1.append('patch-if "'+testdir+'" "'+patchname+'" "'+filename+'"')
|
||||
self.manifestv2.append('patch-if "'+testdir+'" "'+patchname+'" "'+filename+'"')
|
||||
else:
|
||||
self.manifestv1.append('patch "'+patchname+'" "'+filename+'"')
|
||||
self.manifestv2.append('patch "'+patchname+'" "'+filename+'"')
|
||||
|
||||
def append_remove_instruction(self, filename):
|
||||
@ -83,20 +77,9 @@ class PatchInfo:
|
||||
filename = filename[:-1]
|
||||
self.manifestv2.append('rmrfdir "'+filename+'"')
|
||||
else:
|
||||
self.manifestv1.append('remove "'+filename+'"')
|
||||
self.manifestv2.append('remove "'+filename+'"')
|
||||
|
||||
def create_manifest_files(self):
|
||||
""" Createst the v1 manifest file in the root of the work_dir """
|
||||
manifest_file_path = os.path.join(self.work_dir,"update.manifest")
|
||||
manifest_file = open(manifest_file_path, "wb")
|
||||
manifest_file.writelines(string.join(self.manifestv1, '\n'))
|
||||
manifest_file.writelines("\n")
|
||||
manifest_file.close()
|
||||
|
||||
bzip_file(manifest_file_path)
|
||||
self.archive_files.append('"update.manifest"')
|
||||
|
||||
""" Createst the v2 manifest file in the root of the work_dir """
|
||||
manifest_file_path = os.path.join(self.work_dir,"updatev2.manifest")
|
||||
manifest_file = open(manifest_file_path, "wb")
|
||||
|
@ -9,6 +9,6 @@ mkdir -p "$workdir"
|
||||
cp "$1" "$workdir"
|
||||
cd "$workdir"
|
||||
mar -x "$1"
|
||||
mv update.manifest update.manifest.bz2
|
||||
bzip2 -d update.manifest.bz2
|
||||
cat update.manifest
|
||||
mv updatev2.manifest updatev2.manifest.bz2
|
||||
bzip2 -d updatev2.manifest.bz2
|
||||
cat updatev2.manifest
|
||||
|
@ -1,4 +1,8 @@
|
||||
#!/bin/bash
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#
|
||||
# Code shared by update packaging scripts.
|
||||
# Author: Darin Fisher
|
||||
@ -74,8 +78,7 @@ make_patch_instruction() {
|
||||
|
||||
append_remove_instructions() {
|
||||
dir="$1"
|
||||
filev1="$2"
|
||||
filev2="$3"
|
||||
filev2="$2"
|
||||
if [ -f "$dir/removed-files" ]; then
|
||||
prefix=
|
||||
listfile="$dir/removed-files"
|
||||
@ -105,7 +108,7 @@ append_remove_instructions() {
|
||||
fixedprefix=""
|
||||
else
|
||||
f=$(echo $f | sed -e 's:^\.\.\/::')
|
||||
fixedprefix=$(echo "$prefix" | sed -e 's:^[^\/]*\/::')
|
||||
fixedprefix=$(echo "$prefix" | sed -e 's:[^\/]*\/$::')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -119,7 +122,6 @@ append_remove_instructions() {
|
||||
echo "rmrfdir \"$fixedprefix$f\"" >> $filev2
|
||||
else
|
||||
notice " remove: $fixedprefix$f"
|
||||
echo "remove \"$fixedprefix$f\"" >> $filev1
|
||||
echo "remove \"$fixedprefix$f\"" >> $filev2
|
||||
fi
|
||||
fi
|
||||
|
@ -29,8 +29,6 @@ cp "$2" "$todir"
|
||||
cd "$fromdir"
|
||||
mar -x "$1"
|
||||
rm "$1"
|
||||
mv update.manifest update.manifest.bz2
|
||||
bzip2 -d update.manifest.bz2
|
||||
mv updatev2.manifest updatev2.manifest.bz2
|
||||
bzip2 -d updatev2.manifest.bz2
|
||||
ls $lsargs > files.txt
|
||||
@ -38,8 +36,6 @@ ls $lsargs > files.txt
|
||||
cd "$todir"
|
||||
mar -x "$2"
|
||||
rm "$2"
|
||||
mv update.manifest update.manifest.bz2
|
||||
bzip2 -d update.manifest.bz2
|
||||
mv updatev2.manifest updatev2.manifest.bz2
|
||||
bzip2 -d updatev2.manifest.bz2
|
||||
ls $lsargs > files.txt
|
||||
|
@ -1,4 +1,8 @@
|
||||
#!/bin/bash
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#
|
||||
# This tool generates full update packages for the update system.
|
||||
# Author: Darin Fisher
|
||||
@ -40,9 +44,8 @@ if [ $(echo "$targetdir" | grep -c '\/$') = 1 ]; then
|
||||
targetdir=$(echo "$targetdir" | sed -e 's:\/$::')
|
||||
fi
|
||||
workdir="$targetdir.work"
|
||||
updatemanifestv1="$workdir/update.manifest"
|
||||
updatemanifestv2="$workdir/updatev2.manifest"
|
||||
targetfiles="update.manifest updatev2.manifest"
|
||||
targetfiles="updatev2.manifest"
|
||||
|
||||
mkdir -p "$workdir"
|
||||
|
||||
@ -64,16 +67,21 @@ list_files files
|
||||
|
||||
popd
|
||||
|
||||
# Add the type of update to the beginning of version 2 update manifest.
|
||||
> $updatemanifestv2
|
||||
notice ""
|
||||
notice "Adding file add instructions to file 'update.manifest'"
|
||||
> $updatemanifestv1
|
||||
notice "Adding type instruction to file 'updatev2.manifest'"
|
||||
notice " type: complete"
|
||||
echo "type \"complete\"" >> $updatemanifestv2
|
||||
|
||||
notice ""
|
||||
notice "Adding file add instructions to file 'updatev2.manifest'"
|
||||
num_files=${#files[*]}
|
||||
|
||||
for ((i=0; $i<$num_files; i=$i+1)); do
|
||||
f="${files[$i]}"
|
||||
|
||||
make_add_instruction "$f" >> $updatemanifestv1
|
||||
make_add_instruction "$f" >> $updatemanifestv2
|
||||
|
||||
dir=$(dirname "$f")
|
||||
mkdir -p "$workdir/$dir"
|
||||
@ -83,24 +91,11 @@ for ((i=0; $i<$num_files; i=$i+1)); do
|
||||
targetfiles="$targetfiles \"$f\""
|
||||
done
|
||||
|
||||
# Add the type of update to the beginning of and cat the contents of the version
|
||||
# 1 update manifest to the version 2 update manifest.
|
||||
> $updatemanifestv2
|
||||
notice ""
|
||||
notice "Adding type instruction to file 'updatev2.manifest'"
|
||||
notice " type: complete"
|
||||
echo "type \"complete\"" >> $updatemanifestv2
|
||||
|
||||
notice ""
|
||||
notice "Concatenating file 'update.manifest' to file 'updatev2.manifest'"
|
||||
cat $updatemanifestv1 >> $updatemanifestv2
|
||||
|
||||
# Append remove instructions for any dead files.
|
||||
notice ""
|
||||
notice "Adding file and directory remove instructions from file 'removed-files'"
|
||||
append_remove_instructions "$targetdir" "$updatemanifestv1" "$updatemanifestv2"
|
||||
append_remove_instructions "$targetdir" "$updatemanifestv2"
|
||||
|
||||
$BZIP2 -z9 "$updatemanifestv1" && mv -f "$updatemanifestv1.bz2" "$updatemanifestv1"
|
||||
$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
|
||||
|
||||
eval "$MAR -C \"$workdir\" -c output.mar $targetfiles"
|
||||
|
@ -18,23 +18,22 @@ class TestPatchInfo(unittest.TestCase):
|
||||
def testPatchInfo(self):
|
||||
self.assertEquals(self.work_dir, self.patch_info.work_dir)
|
||||
self.assertEquals([], self.patch_info.archive_files)
|
||||
self.assertEquals([], self.patch_info.manifestv1)
|
||||
self.assertEquals([], self.patch_info.manifestv2)
|
||||
self.assertEquals(self.file_exclusion_list, self.patch_info.file_exclusion_list)
|
||||
self.assertEquals(self.path_exclusion_list, self.patch_info.path_exclusion_list)
|
||||
|
||||
def test_append_add_instruction(self):
|
||||
self.patch_info.append_add_instruction('file.test')
|
||||
self.assertEquals(['add "file.test"'], self.patch_info.manifestv1)
|
||||
self.assertEquals(['add "file.test"'], self.patch_info.manifestv2)
|
||||
|
||||
def test_append_patch_instruction(self):
|
||||
self.patch_info.append_patch_instruction('file.test', 'patchname')
|
||||
self.assertEquals(['patch "patchname" "file.test"'], self.patch_info.manifestv1)
|
||||
self.assertEquals(['patch "patchname" "file.test"'], self.patch_info.manifestv2)
|
||||
|
||||
""" FIXME touches the filesystem, need refactoring
|
||||
def test_append_remove_instruction(self):
|
||||
self.patch_info.append_remove_instruction('file.test')
|
||||
self.assertEquals(['remove "file.test"'], self.patch_info.manifestv1)
|
||||
self.assertEquals(['remove "file.test"'], self.patch_info.manifestv2)
|
||||
|
||||
def test_create_manifest_file(self):
|
||||
self.patch_info.create_manifest_file()
|
||||
|
Loading…
x
Reference in New Issue
Block a user