media/libnestegg/update.sh
author Eugen Sawin <esawin@mozilla.com>
Mon, 02 Dec 2019 23:11:32 +0000
changeset 563512 7fd12a78625c6f1725f64a42d7f4f8dbfeff7177
parent 504306 dcda0765ea951f08ba34b6b1270c86c9dc9a802c
permissions -rwxr-xr-x
Bug 1592752 - [1.0] Conditionally check for storage clearing based on status of LSNG. r=snorp, a=test-only It looks like there is going to be a period of LSNG being disabled on some channels for a while. Making the test conditional on the pref will make it pass in all situations and would allow us to keep the test enabled. It doesn't help with the fact, that on some version we're clearing storage despite the flag not being set, but since it's clearing more, rather than less, it's at least not as critical in terms of privacy. Differential Revision: https://phabricator.services.mozilla.com/D55526

#!/bin/bash
# Usage: sh update.sh <upstream_src_directory>

set -e

[[ -n "$1" ]] || ( echo "syntax: $0 update_src_directory"; exit 1 )
[[ -e "$1/src/nestegg.c" ]] || ( echo "$1: nestegg not found"; exit 1 )

cp $1/include/nestegg/nestegg.h include
cp $1/src/nestegg.c src
cp $1/LICENSE .
cp $1/README.md .
cp $1/AUTHORS .

if [ -d $1/.git ]; then
  rev=$(cd $1 && git rev-parse --verify HEAD)
  date=$(cd $1 && git show -s --format=%ci HEAD)
  dirty=$(cd $1 && git diff-index --name-only HEAD)
  set +e
  pre_rev=$(grep -o '[[:xdigit:]]\{40\}' moz.yaml)
  commits=$(cd $1 && git log --pretty=format:'%h - %s' $pre_rev..$rev)
  set -e
fi

if [ -n "$rev" ]; then
  version=$rev
  if [ -n "$dirty" ]; then
    version=$version-dirty
    echo "WARNING: updating from a dirty git repository."
  fi
  sed -i.bak -e "s/^ *release:.*/  release: \"$version ($date)\"/" moz.yaml
  if [[ ! "$( grep "$version" moz.yaml )" ]]; then
    echo "Updating moz.yaml failed."
    exit 1
  fi
  rm moz.yaml.bak
  [[ -n "$commits" ]] && echo -e "Pick commits:\n$commits"
else
  echo "Remember to update moz.yaml with the version details."
fi