[gentoo-commits] proj/mozilla:master commit in: scripts/

2019-07-09 Thread Jory Pratt
commit: 09124fbe287f4c2717fea6faef8dcc2562d811ed
Author: Jory Pratt  gentoo  org>
AuthorDate: Tue Jul  9 18:22:10 2019 +
Commit: Jory Pratt  gentoo  org>
CommitDate: Tue Jul  9 18:22:10 2019 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=09124fbe

get_langs.sh use /bin/bash instead of /bin/sh for compatibility issues

 scripts/get_langs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/get_langs.sh b/scripts/get_langs.sh
index 50adba4..7098da6 100755
--- a/scripts/get_langs.sh
+++ b/scripts/get_langs.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # vim: set sts=2 sw=2 et tw=0 :
 
 if test -z "${2}"; then



[gentoo-commits] proj/mozilla:master commit in: scripts/

2017-11-16 Thread Ian Stakenvicius
commit: 5a05a2d2432451e61d59009ba77c5af617317859
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Thu Nov 16 20:44:00 2017 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Thu Nov 16 20:44:11 2017 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=5a05a2d2

verify_distfiles.sh: fix ESR identification (again)

 scripts/verify_distfiles.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/verify_distfiles.sh b/scripts/verify_distfiles.sh
index 9d56cfe..8679b7f 100755
--- a/scripts/verify_distfiles.sh
+++ b/scripts/verify_distfiles.sh
@@ -9,7 +9,7 @@ check_distfiles() {
local myver myname tmp
myname=$(qatom $1 |awk '{print $2}')
 mybasename=${myname/-bin/}
-   if grep -e 'MOZ_ESR=""' -e 'MOZ_ESR="0"' $1 &>/dev/null || [[ -n $(grep 
-L MOZ_ESR $1) ]] ; then
+   if grep -e 'MOZ_ESR=""' -e 'MOZ_ESR="0"' $1 &>/dev/null || [[ -n $(grep 
-L '^MOZ_ESR' $1) ]] ; then
myver=$(qatom $1 |awk '{print $3}')
else
myver=$(qatom $1 |awk '{print $3 "esr"}')



[gentoo-commits] proj/mozilla:master commit in: scripts/

2017-10-06 Thread Ian Stakenvicius
commit: 31d3ae8bbdb30450b1658dbf864c194d0ffcf2de
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Fri Oct  6 17:15:18 2017 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Fri Oct  6 17:15:18 2017 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=31d3ae8b

scripts/generate_langpacks.sh: kill script of mercurial is not found

 scripts/generate_langpacks.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/scripts/generate_langpacks.sh b/scripts/generate_langpacks.sh
index ad9f7cf..c80a326 100755
--- a/scripts/generate_langpacks.sh
+++ b/scripts/generate_langpacks.sh
@@ -21,6 +21,11 @@ fi
 
 ebuild=${1}
 
+if ! hg --version &>/dev/null; then
+   echo "$0 needs mercurial -- aborting"
+   exit 1
+fi
+
 if [[ ${ebuild/.ebuild/} == ${ebuild} ]] || [[ ! -e ${ebuild} ]]; then
   echo "Must specify the full path to the ebuild as arg.1"
 fi



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-11-22 Thread Ian Stakenvicius
commit: a8e7efc128222f12c386b7d8e28ff75ae92dcb26
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Tue Nov 22 19:42:29 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Tue Nov 22 19:42:29 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=a8e7efc1

generate-langpacks.sh: strip '_pre*' from the search tag used against the L10N 
repos, to improve likeliness of a match

 scripts/generate_langpacks.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/generate_langpacks.sh b/scripts/generate_langpacks.sh
index e0552cb..ad9f7cf 100755
--- a/scripts/generate_langpacks.sh
+++ b/scripts/generate_langpacks.sh
@@ -52,6 +52,7 @@ if [[ ${uctarget/_BETA/} != ${uctarget} ]]; then
   l10nrepo="mozilla-beta"
   uctarget=${uctarget/_BETA/b}
 fi
+uctarget=${uctarget%_PRE*}
 
 l10n_releasedir="${LANGPACK_DESTDIR%/}/l10n-${target}"
 



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-06-02 Thread Ian Stakenvicius
commit: 5b8d3228512547d28f4aef9137c19fe7f670804c
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Thu Jun  2 15:18:55 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Thu Jun  2 15:19:25 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=5b8d3228

generate_langpacks.sh: use pushd/popd instead of cd

 scripts/generate_langpacks.sh | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/generate_langpacks.sh b/scripts/generate_langpacks.sh
index 8530e34..e0552cb 100755
--- a/scripts/generate_langpacks.sh
+++ b/scripts/generate_langpacks.sh
@@ -70,11 +70,12 @@ if ! [[ -e ${l10n_releasedir}/mozlangs.cached ]]; then
   for abcd in "${MOZ_LANGS[@]}" ; do
 if [[ ! -d ${L10N_STAGING_DIR%/}/${l10nrepo}/${abcd} ]]; then
   mkdir -p ${L10N_STAGING_DIR%/}/${l10nrepo}
-  cd ${L10N_STAGING_DIR%/}/${l10nrepo}
+  pushd ${L10N_STAGING_DIR%/}/${l10nrepo} &>/dev/null || die
   hg clone "http://hg.mozilla.org/releases/l10n/${l10nrepo}/${abcd};
+  popd &>/dev/null || die
 fi
 if [[ -d ${L10N_STAGING_DIR%/}/${l10nrepo}/${abcd} ]]; then
-  cd ${L10N_STAGING_DIR%/}/${l10nrepo}/${abcd}
+  pushd ${L10N_STAGING_DIR%/}/${l10nrepo}/${abcd} &>/dev/null || die
   hg pull
   if hg tags |grep ${uctarget//\./_}_RELEASE &>/dev/null; then
 rev="-r ${uctarget//\./_}_RELEASE"
@@ -85,6 +86,7 @@ if ! [[ -e ${l10n_releasedir}/mozlangs.cached ]]; then
 rev=
   fi
   hg archive ${rev} -t files ${l10n_releasedir}/src/${abcd}
+  popd &>/dev/null || die
 fi
   done
   cp ${l10n_releasedir}/mozlangs{,.cached}
@@ -139,7 +141,7 @@ fi
 
 
 function package_lightning {
-  cd ${S}/dist/xpi-stage
+  pushd ${S}/dist/xpi-stage &>/dev/null || die
   cp -rL lightning stage-lightning
   for ech in lightning-*; do
 if [[ -d $ech ]]; then
@@ -164,10 +166,11 @@ function package_lightning {
   cd ..
   mv stage-lightning lightning-${vers}
   tar -Jcf ${l10n_releasedir}/lightning-${vers}.tar.xz lightning-${vers}
+  popd &>/dev/null || die
 }
 
 function package_gdata_provider {
-  cd ${S}/dist/xpi-stage
+  pushd ${S}/dist/xpi-stage &>/dev/null || die
   cp -rL gdata-provider stage-gdata-provider
   for ech in gdata-provider-*; do
 if [[ -d $ech ]]; then
@@ -192,6 +195,7 @@ function package_gdata_provider {
   cd ..
   mv stage-gdata-provider gdata-provider-${vers}
   tar -Jcf ${l10n_releasedir}/gdata-provider-${vers}.tar.xz 
gdata-provider-${vers}
+  popd &>/dev/null || die
 }
 
 # run the locales



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-05-05 Thread Ian Stakenvicius
commit: 7fc5aa1b3d7cb9b320237769e934f99d75150645
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Thu May  5 14:44:31 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Thu May  5 14:44:31 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=7fc5aa1b

scripts/generate_langpacks.sh: fixed a typo in a path

This typo kept langpacks from actually generating so it was kind of a big deal

 scripts/generate_langpacks.sh | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/generate_langpacks.sh b/scripts/generate_langpacks.sh
index bbeb745..8530e34 100755
--- a/scripts/generate_langpacks.sh
+++ b/scripts/generate_langpacks.sh
@@ -197,7 +197,7 @@ function package_gdata_provider {
 # run the locales
 for langpack_op in "${langpack_targets[@]}"; do
   cd ${S}/${locale_buildpath}
-  for ech_l10n in ${l10n_releasedir}/* ; do
+  for ech_l10n in ${l10n_releasedir}/src/* ; do
 if [[ -d ${ech_l10n} ]]; then
   abcd=${ech_l10n##*/}
   # Need to set LOCALE_MERGEDIR to someplace that doesnt exist -- odd but 
whatever
@@ -205,9 +205,6 @@ for langpack_op in "${langpack_targets[@]}"; do
 fi
   done
 
-  # get the langpacks
-  cp -t ${l10n_releasedir}/ ${S}/dist/linux-*/xpi/*lang*
-
   # package lightning and gdata-provider if calendar was a target
   if ! [[ ${langpack_op/calendar/} == ${langpack_op} ]]; then
 package_lightning
@@ -215,3 +212,7 @@ for langpack_op in "${langpack_targets[@]}"; do
   fi
 
 done
+
+# get the langpacks
+cp -t ${l10n_releasedir}/ ${S}/dist/linux-*/xpi/*lang*
+



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-05-04 Thread Ian Stakenvicius
commit: 470f7cb82169d76ea8d463c212aa08e866dad3fb
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Thu May  5 03:02:53 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Thu May  5 03:02:53 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=470f7cb8

minor adjustments to two scripts

Added logic to abort if the ebuild specified as argument to 
generate_langpacks.sh
doesn't exist (typo in the path, etc)

Added another case to the MOZ_ESR check in verify_distfiles.sh to match 
properly in
older thunderbird-bin ebuilds

 scripts/generate_langpacks.sh | 2 +-
 scripts/verify_distfiles.sh   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/generate_langpacks.sh b/scripts/generate_langpacks.sh
index 5032cdd..bbeb745 100755
--- a/scripts/generate_langpacks.sh
+++ b/scripts/generate_langpacks.sh
@@ -21,7 +21,7 @@ fi
 
 ebuild=${1}
 
-if [[ ${ebuild/.ebuild/} == ${ebuild} ]]; then
+if [[ ${ebuild/.ebuild/} == ${ebuild} ]] || [[ ! -e ${ebuild} ]]; then
   echo "Must specify the full path to the ebuild as arg.1"
 fi
 

diff --git a/scripts/verify_distfiles.sh b/scripts/verify_distfiles.sh
index 0cf2d68..d7fe77d 100755
--- a/scripts/verify_distfiles.sh
+++ b/scripts/verify_distfiles.sh
@@ -9,7 +9,7 @@ check_distfiles() {
local myver myname tmp
myname=$(qatom $1 |awk '{print $2}')
 mybasename=${myname/-bin/}
-   if grep 'MOZ_ESR=""' $1 &>/dev/null || [[ -n $(grep -L MOZ_ESR $1) ]] ; 
then
+   if grep -e 'MOZ_ESR=""' -e 'MOZ_ESR="0"' $1 &>/dev/null || [[ -n $(grep 
-L MOZ_ESR $1) ]] ; then
myver=$(qatom $1 |awk '{print $3}')
else
myver=$(qatom $1 |awk '{print $3 "esr"}')



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-05-03 Thread Ian Stakenvicius
commit: 1a33c33d296ff49a382d50c857d7a20c6b6ae758
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Tue May  3 15:34:08 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Tue May  3 15:34:08 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=1a33c33d

Add script to help automate rolling of langpacks for mozilla packages

 scripts/generate_langpacks.sh | 217 ++
 1 file changed, 217 insertions(+)

diff --git a/scripts/generate_langpacks.sh b/scripts/generate_langpacks.sh
new file mode 100755
index 000..5032cdd
--- /dev/null
+++ b/scripts/generate_langpacks.sh
@@ -0,0 +1,217 @@
+#!/bin/bash
+
+#
+# Langpack generator for mozilla packages
+# hacked together by Ian Stakenvicius , spring 2016
+#
+# Call this script, providing a path to the ebuild you want to generate the 
langpacks for as argument1
+#
+
+# source make.conf to get PORTAGE_TMPDIR etc.
+if [[ -e /etc/make.conf ]]; then
+   . /etc/make.conf
+elif [[ -e /etc/portage/make.conf ]]; then
+   . /etc/portage/make.conf
+fi
+
+: ${L10N_STAGING_DIR:=/var/cache/mozl10n}
+: ${LANGPACK_DESTDIR:=${L10N_STAGING_DIR}}
+: ${PORTAGE_TMPDIR:=/var/tmp/portage}
+: ${PORTDIR:=/usr/portage}
+
+ebuild=${1}
+
+if [[ ${ebuild/.ebuild/} == ${ebuild} ]]; then
+  echo "Must specify the full path to the ebuild as arg.1"
+fi
+
+if ! grep mozlinguas_mozconfig ${ebuild} &>/dev/null ; then
+  if ! grep mozlinguas_mozconfig ${ebuild%/*}/../../eclass/$(grep -o 
'mozconfig-v[^ ]*' ${ebuild}).eclass &>/dev/null ; then
+if ! grep mozlinguas_mozconfig ${PORTDIR}/eclass/$(grep -o 'mozconfig-v[^ 
]*' ${ebuild}).eclass &>/dev/null ; then
+  echo ""
+  echo "WARNING -- this script will not work unless 'mozlinguas_mozconfig' 
is called sometime during"
+  echo "src_configure between mozconfig_init and mozconfig_final.  A rough 
check did not find this call."
+  echo "Press any key to continue or CTRL-C to abort."
+  read target
+fi
+  fi
+fi
+
+echo ""
+echo "Using ${L10N_STAGING_DIR} for l10n repository cache"
+echo "Using ${LANGPACK_DESTDIR} to store generated langpacks"
+echo ""
+
+target=${ebuild##*/}
+target=${target%.ebuild}
+uctarget=${target^^*}
+uctarget=${uctarget//-/_}
+
+l10nrepo="mozilla-release"
+if [[ ${uctarget/_BETA/} != ${uctarget} ]]; then
+  l10nrepo="mozilla-beta"
+  uctarget=${uctarget/_BETA/b}
+fi
+
+l10n_releasedir="${LANGPACK_DESTDIR%/}/l10n-${target}"
+
+# if the mozlangs.cached file in l10n_releasedir doesn't exist, then
+# create it and checkout all the upstream l10n repositories using mercurial,
+# based on the list of locales in MOZ_LANGS in the ebuild.  If the directory
+# already exists, then assume everything has been checked out and
+# proceed.
+if ! [[ -e ${l10n_releasedir}/mozlangs.cached ]]; then
+  mkdir -p ${l10n_releasedir}
+
+  # source the ebuild so that MOZ_LANGS is available
+  cat ${ebuild} |grep -A 5 'MOZ_LANGS' >${l10n_releasedir}/mozlangs
+  . ${l10n_releasedir}/mozlangs
+
+  for abcd in "${MOZ_LANGS[@]}" ; do
+if [[ ! -d ${L10N_STAGING_DIR%/}/${l10nrepo}/${abcd} ]]; then
+  mkdir -p ${L10N_STAGING_DIR%/}/${l10nrepo}
+  cd ${L10N_STAGING_DIR%/}/${l10nrepo}
+  hg clone "http://hg.mozilla.org/releases/l10n/${l10nrepo}/${abcd};
+fi
+if [[ -d ${L10N_STAGING_DIR%/}/${l10nrepo}/${abcd} ]]; then
+  cd ${L10N_STAGING_DIR%/}/${l10nrepo}/${abcd}
+  hg pull
+  if hg tags |grep ${uctarget//\./_}_RELEASE &>/dev/null; then
+rev="-r ${uctarget//\./_}_RELEASE"
+  elif hg branches |grep ${uctarget//\./} &>/dev/null; then
+rev="-r $(hg branches |grep ${uctarget//\./})"
+  else
+echo "*** WARNING: ${abcd} has no branch or tag matching ${target}, 
using HEAD"
+rev=
+  fi
+  hg archive ${rev} -t files ${l10n_releasedir}/src/${abcd}
+fi
+  done
+  cp ${l10n_releasedir}/mozlangs{,.cached}
+else
+  . ${l10n_releasedir}/mozlangs.cached
+fi
+
+# set some variables based on what package it is
+# so the langpacks can be rolled
+# note -- this sets $S to BUILD_OBJ_DIR, getting the path
+# from the actual ebuild would likely be more stable long-term
+case "${target}" in
+*thunderbird*)
+   category=mail-client
+   langpack_targets=( langpack calendar-langpack )
+   locale_buildpath=mail/locales
+   if grep 'S=.*comm-esr' ${ebuild} &>/dev/null; then
+   S=${PORTAGE_TMPDIR%/}/${category}/${target}/work/comm-esr*/tbird
+   else
+   
S=${PORTAGE_TMPDIR%/}/${category}/${target}/work/thunderbird-*/tbird
+   fi
+   ;;
+*firefox*)
+   category=www-client
+   langpack_targets=( langpack )
+   locale_buildpath=browser/locales
+   if grep 'S=.*mozilla-esr' ${ebuild} &>/dev/null; then
+   S=${PORTAGE_TMPDIR%/}/${category}/${target}/work/mozilla-esr*/ff
+   else
+   S=${PORTAGE_TMPDIR%/}/${category}/${target}/work/firefox-*/ff
+   fi
+   ;;
+*seamonkey*)

[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-04-27 Thread Ian Stakenvicius
commit: f71aced94424b5aed99fdda631096f8355cb0314
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Wed Apr 27 20:47:58 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Wed Apr 27 20:47:58 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=f71aced9

verify_distfiles.sh: fix bug related to esr distfile matches

 scripts/verify_distfiles.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/verify_distfiles.sh b/scripts/verify_distfiles.sh
index 9ffc867..0cf2d68 100755
--- a/scripts/verify_distfiles.sh
+++ b/scripts/verify_distfiles.sh
@@ -22,6 +22,7 @@ check_distfiles() {
 
grep -e "^DIST ${mybasename}-${myver}[-\.]" \
  -e "^DIST ${myname}_.*-${myver}[-\.]" \
+ -e "^DIST ${myname}_.*-${myver/esr/}[-\.]" \
  Manifest |grep -v -- "${myname}-.*-patches-" |awk '{print $7}' |while 
read ech ; do
tmp=$(grep ${ech} Manifest |awk '{print $2}')
if grep $ech ${sigfile} &>/dev/null ; then



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-04-27 Thread Ian Stakenvicius
commit: a1738f6a3804230550af2e81a4d99c58d055ea10
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Wed Apr 27 15:55:39 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Wed Apr 27 15:55:39 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=a1738f6a

verify_distfiles.sh: fix bug so that matching works on *-bin packages

 scripts/verify_distfiles.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/verify_distfiles.sh b/scripts/verify_distfiles.sh
index 420318b..9ffc867 100755
--- a/scripts/verify_distfiles.sh
+++ b/scripts/verify_distfiles.sh
@@ -20,8 +20,8 @@ check_distfiles() {
wget -O ${sigfile} -q 
https://archive.mozilla.org/pub/${mybasename}/releases/${myver}/SHA512SUMS
gpg --verify ${sigfile}.asc ${sigfile} || exit 1
 
-   grep -e "^DIST ${myname}-${myver}[-\.]" \
- -e "^DIST ${mybasename}_.*-${myver}[-\.]" \
+   grep -e "^DIST ${mybasename}-${myver}[-\.]" \
+ -e "^DIST ${myname}_.*-${myver}[-\.]" \
  Manifest |grep -v -- "${myname}-.*-patches-" |awk '{print $7}' |while 
read ech ; do
tmp=$(grep ${ech} Manifest |awk '{print $2}')
if grep $ech ${sigfile} &>/dev/null ; then



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-04-27 Thread Ian Stakenvicius
commit: cac163f1695bd581f74a249130226d204db8dad4
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Wed Apr 27 15:52:27 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Wed Apr 27 15:52:57 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=cac163f1

verify_distfiles.sh: drop debugging code that should have been removed earlier

 scripts/verify_distfiles.sh | 5 -
 1 file changed, 5 deletions(-)

diff --git a/scripts/verify_distfiles.sh b/scripts/verify_distfiles.sh
index b418620..420318b 100755
--- a/scripts/verify_distfiles.sh
+++ b/scripts/verify_distfiles.sh
@@ -20,11 +20,6 @@ check_distfiles() {
wget -O ${sigfile} -q 
https://archive.mozilla.org/pub/${mybasename}/releases/${myver}/SHA512SUMS
gpg --verify ${sigfile}.asc ${sigfile} || exit 1
 
-   grep -e "^DIST ${mybasename}-${myver}[-\.]" \
- -e "^DIST ${myname}_.*-${myver}[-\.]" \
- Manifest
-   exit 1
-
grep -e "^DIST ${myname}-${myver}[-\.]" \
  -e "^DIST ${mybasename}_.*-${myver}[-\.]" \
  Manifest |grep -v -- "${myname}-.*-patches-" |awk '{print $7}' |while 
read ech ; do



[gentoo-commits] proj/mozilla:master commit in: scripts/

2016-04-27 Thread Ian Stakenvicius
commit: 279a7ebed5c004e1da3df8fa77c783a1e42ab955
Author: Ian Stakenvicius  gentoo  org>
AuthorDate: Wed Apr 27 14:43:07 2016 +
Commit: Ian Stakenvicius  gentoo  org>
CommitDate: Wed Apr 27 14:43:10 2016 +
URL:https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=279a7ebe

added script that helps with verifying SHA512 hashes of distfiles against 
upstream

The script also checks the signature of the SHA512SUMS file is valid, though 
the trust
of the mozilla key used is entirely up to the user to verify and validate.

 scripts/verify_distfiles.sh | 63 +
 1 file changed, 63 insertions(+)

diff --git a/scripts/verify_distfiles.sh b/scripts/verify_distfiles.sh
new file mode 100755
index 000..b418620
--- /dev/null
+++ b/scripts/verify_distfiles.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# Script to check distfiles against SHA512SUMS in upstream repo
+# Note - your gpg setup needs to have the mozilla release key imported for 
signature verification
+# Author: Ian Stakenvicius
+# 2016-03-10
+
+check_distfiles() {
+   local myver myname tmp
+   myname=$(qatom $1 |awk '{print $2}')
+mybasename=${myname/-bin/}
+   if grep 'MOZ_ESR=""' $1 &>/dev/null || [[ -n $(grep -L MOZ_ESR $1) ]] ; 
then
+   myver=$(qatom $1 |awk '{print $3}')
+   else
+   myver=$(qatom $1 |awk '{print $3 "esr"}')
+   fi
+
+   sigfile=$(mktemp)
+   wget -O ${sigfile}.asc -q 
https://archive.mozilla.org/pub/${mybasename}/releases/${myver}/SHA512SUMS.asc
+   wget -O ${sigfile} -q 
https://archive.mozilla.org/pub/${mybasename}/releases/${myver}/SHA512SUMS
+   gpg --verify ${sigfile}.asc ${sigfile} || exit 1
+
+   grep -e "^DIST ${mybasename}-${myver}[-\.]" \
+ -e "^DIST ${myname}_.*-${myver}[-\.]" \
+ Manifest
+   exit 1
+
+   grep -e "^DIST ${myname}-${myver}[-\.]" \
+ -e "^DIST ${mybasename}_.*-${myver}[-\.]" \
+ Manifest |grep -v -- "${myname}-.*-patches-" |awk '{print $7}' |while 
read ech ; do
+   tmp=$(grep ${ech} Manifest |awk '{print $2}')
+   if grep $ech ${sigfile} &>/dev/null ; then
+   echo -n $tmp
+   grep ${ech} ${sigfile} |awk '{print " -> " $2 " OK"}'
+   else
+   echo -n "ERROR - no file with sum ${ech} found -- 
${tmp}"
+   exit 1
+   fi
+   done
+   rm -f ${sigfile}.asc ${sigfile}
+}
+
+
+if [[ ! -e Manifest ]]; then
+   echo "ERROR - must be run in the directory of the package (with ebuilds 
and Manifest)"
+   echo "USAGE: $0 [ebuild file(s)]"
+   exit 1
+fi
+
+ebuild_list=( "$@" )
+if [ "$#" -eq 0 ]; then
+   echo "No arguments specified, verifying all ebuilds in current 
directory"
+   ebuild_list=( *.ebuild )
+fi
+
+for ebuild in "${ebuild_list[@]}"; do
+   echo "Checking $ebuild"
+   if [[ -e $ebuild ]]; then
+   check_distfiles $ebuild
+   else
+   echo "ERROR - $ebuild does not exist, skipping"
+   fi
+done