xref: /aosp_15_r20/external/wuffs-mirror-release-c/script/sync.sh (revision 30889fd3ad667d11ca7a90e9af352e217875dd23)
1#!/bin/bash -eu
2# Copyright 2021 The Wuffs-Mirror-Release-C Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#    https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# ----------------
17
18# This script synchronizes this repository's release/c directory with the
19# upstream one, assumed to be "../wuffs/release/c", and updates "sync.txt".
20#
21# It does not ensure that ../wuffs is synchronized to the latest version (at
22# https://github.com/google/wuffs). That is a separate responsibility.
23
24echo -n "script/sync.sh ran on " > sync.txt
25date --iso-8601 >> sync.txt
26echo -n "Sibling directory (../wuffs) git revision is " >> sync.txt
27cd ../wuffs
28git rev-parse HEAD >> ../wuffs-mirror-release-c/sync.txt
29cd ../wuffs-mirror-release-c
30echo "Manifest (sha256sum values, filenames, versions):" >> sync.txt
31
32for f in ../wuffs/release/c/*; do
33  f=${f##*/}
34
35  # Skip the unsupported snapshot.
36  if [ $f = "wuffs-unsupported-snapshot.c" ]; then
37    continue
38  fi
39
40  cp ../wuffs/release/c/$f release/c
41  sha256sum release/c/$f >> sync.txt
42  set +e
43  VER=$(grep "^#define WUFFS_VERSION_STRING " release/c/$f)
44  set -e
45  if [ -n "$VER" ]; then
46    echo "    $VER" >> sync.txt
47  fi
48done
49