Refine the upgrade procedure
This commit is contained in:
67
tools/macports_report_upgrade.sh
Executable file
67
tools/macports_report_upgrade.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Turn the Portfile.template into a Portfile.
|
||||
# Usage:
|
||||
# mk_portfile.sh TEMPLATE OUTPUTFILE VERSION
|
||||
|
||||
set -e
|
||||
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source ${blackbox_home}/../bin/_stack_lib.sh
|
||||
|
||||
TEMPLATEFILE=tools/Portfile.template
|
||||
OUTPUTFILE=Portfile
|
||||
PORTVERSION=${1?"Arg 1 must be a version number like 1.20150222 (with no v)"} ; shift
|
||||
|
||||
# Add the version number to the template.
|
||||
sed <"$TEMPLATEFILE" >"$OUTPUTFILE" -e 's/@@VERSION@@/'"$PORTVERSION"'/g'
|
||||
|
||||
# Test it. Record the failure in $checksumout
|
||||
fgrep >/dev/null -x 'file:///var/tmp/ports' /opt/local/etc/macports/sources.conf || sudo sed -i -e '1s@^@file:///var/tmp/ports\'$'\n@' /opt/local/etc/macports/sources.conf
|
||||
rm -rf /var/tmp/ports
|
||||
mkdir -p /var/tmp/ports/security/vcs_blackbox
|
||||
cp Portfile /var/tmp/ports/security/vcs_blackbox
|
||||
( cd /var/tmp/ports && sudo portindex )
|
||||
make_self_deleting_tempfile checksumout
|
||||
set +e
|
||||
sudo port -v checksum vcs_blackbox > "$checksumout" 2>/dev/null
|
||||
ret=$?
|
||||
|
||||
# If it failed, grab the checksums. Then re-process the template with them.
|
||||
if [[ $ret != 0 ]]; then
|
||||
RMD160=$(awk <"$checksumout" '/^Distfile checksum: .*rmd160/ { print $NF }')
|
||||
SHA256=$(awk <"$checksumout" '/^Distfile checksum: .*sha256/ { print $NF }')
|
||||
echo RMD160=$RMD160
|
||||
echo SHA256=$SHA256
|
||||
echo
|
||||
if [[ $RMD160 != '' && $SHA256 != '' ]]; then
|
||||
sed <"$TEMPLATEFILE" >"$OUTPUTFILE" -e 's/@@VERSION@@/'"$PORTVERSION"'/g' -e 's/@@RMD160@@/'"$RMD160"'/g' -e 's/@@SHA256@@/'"$SHA256"'/g'
|
||||
cp Portfile /var/tmp/ports/security/vcs_blackbox
|
||||
( cd /var/tmp/ports && sudo portindex )
|
||||
sudo port -v checksum vcs_blackbox
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate the diff
|
||||
cp /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/security/vcs_blackbox/Portfile /var/tmp/ports/security/vcs_blackbox/Portfile.orig
|
||||
( cd /var/tmp/ports/security/vcs_blackbox && diff -u Portfile.orig Portfile ) > Portfile-vcs_blackbox.diff
|
||||
open -R Portfile-vcs_blackbox.diff
|
||||
|
||||
echo
|
||||
echo 'portfile is in:'
|
||||
echo ' /var/tmp/ports/security/vcs_blackbox/Portfile'
|
||||
echo 'cleanup:'
|
||||
echo ' sudo vi /opt/local/etc/macports/sources.conf'
|
||||
|
||||
echo "
|
||||
PLEASE OPEN A TICKET WITH THIS INFORMATION:
|
||||
https://trac.macports.org/newticket
|
||||
Summary: vcs_blackbox @$PORTVERSION Update to latest upstream
|
||||
Description:
|
||||
New upstream of vcs_blackbox.
|
||||
github.setup and checksums updated.
|
||||
Type: update
|
||||
Component: ports
|
||||
Port: vcs_blackbox
|
||||
Keywords: maintainer
|
||||
"
|
||||
echo 'Attach: Portfile-vcs_blackbox.diff'
|
||||
@@ -1,29 +0,0 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Generate the Macports Portfile and test it.
|
||||
|
||||
PORTVERSION=${1?"Arg 1 must be a version number like 1.20150222 (with no v)"} ; shift
|
||||
|
||||
tools/mk_portfile.sh tools/Portfile.template Portfile "$PORTVERSION"
|
||||
|
||||
echo
|
||||
echo 'Adding file:///var/tmp/ports to the start of /opt/local/etc/macports/sources.conf'
|
||||
echo
|
||||
fgrep >/dev/null -x 'file:///var/tmp/ports' /opt/local/etc/macports/sources.conf || sudo sed -i -e '1s@^@file:///var/tmp/ports\'$'\n@' /opt/local/etc/macports/sources.conf
|
||||
|
||||
echo
|
||||
echo 'Installing port using local repo.'
|
||||
echo
|
||||
sudo port uninstall vcs_blackbox
|
||||
rm -rf /var/tmp/ports
|
||||
mkdir -p /var/tmp/ports/security/vcs_blackbox
|
||||
cp Portfile /var/tmp/ports/security/vcs_blackbox
|
||||
cd /var/tmp/ports && portindex
|
||||
sudo port clean --all vcs_blackbox
|
||||
sudo port install vcs_blackbox
|
||||
|
||||
#echo
|
||||
#echo 'Removing file:///var/tmp/ports from /opt/local/etc/macports/sources.conf'
|
||||
#echo
|
||||
#sudo sed -i -e '\@^file:///var/tmp/ports@d' /opt/local/etc/macports/sources.conf
|
||||
echo 'You may wish to: sudo vi /opt/local/etc/macports/sources.conf'
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Turn the Portfile.template into a Portfile.
|
||||
# Usage:
|
||||
# mk_portfile.sh TEMPLATE OUTPUTFILE VERSION
|
||||
|
||||
# FIXME(tal): This code may be broken. URL may be incorrect.
|
||||
|
||||
set -e
|
||||
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source ${blackbox_home}/../bin/_stack_lib.sh
|
||||
|
||||
TEMPLATEFILE=${1?"Arg 1 must be the template."} ; shift
|
||||
OUTPUTFILE=${1?"Arg 2 must be the outputfile."} ; shift
|
||||
PORTVERSION=${1?"Arg 3 must be a version number like 1.20150222 (with no v)"} ; shift
|
||||
|
||||
make_self_deleting_tempfile bbtar
|
||||
echo URL="https://github.com/StackExchange/blackbox/archive/v${PORTVERSION}.tar.gz"
|
||||
curl -L "https://github.com/StackExchange/blackbox/archive/v${PORTVERSION}.tar.gz" -o ${bbtar}
|
||||
RMD160=$(openssl dgst -rmd160 ${bbtar} | awk '{ print $NF }')
|
||||
SHA256=$(openssl dgst -sha256 ${bbtar} | awk '{ print $NF }')
|
||||
echo PORTVERSION=$PORTVERSION
|
||||
echo RMD160=$RMD160
|
||||
echo SHA256=$SHA256
|
||||
|
||||
sed <"$TEMPLATEFILE" >"$OUTPUTFILE" -e 's/@@VERSION@@/'"$PORTVERSION"'/g' -e 's/@@RMD160@@/'"$RMD160"'/g' -e 's/@@SHA256@@/'"$SHA256"'/g'
|
||||
Reference in New Issue
Block a user