Refine the upgrade procedure
This commit is contained in:
@@ -44,36 +44,76 @@ git tag "$R"
|
|||||||
git push origin tag "$R"
|
git push origin tag "$R"
|
||||||
```
|
```
|
||||||
|
|
||||||
# Updating MacPorts
|
# Updating MacPorts (automatic)
|
||||||
|
|
||||||
Step 1: Generate the Port file
|
Step 1: Generate the Portfile
|
||||||
|
|
||||||
tools/mk_portfile.sh tools/Portfile.template Portfile 1.20150222
|
```
|
||||||
|
tools/macports_report_upgrade.sh 1.20150222
|
||||||
|
```
|
||||||
|
|
||||||
Step 2: Test it locally
|
This script will generate a file called `Portfile-vcs_blackbox.diff` and instructions on how to submit it as a update request.
|
||||||
|
|
||||||
sudo vi /opt/local/etc/macports/sources.conf
|
Step 2: Submit the update request.
|
||||||
Add this line early in the file:
|
|
||||||
file:///var/tmp/ports
|
|
||||||
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 uninstall vcs_blackbox
|
|
||||||
sudo port install vcs_blackbox
|
|
||||||
|
|
||||||
Step 3: File a request for an update
|
Submit the diff file as a bug as instructed. The instructions should look like this:
|
||||||
|
|
||||||
* https://trac.macports.org/newticket
|
* PLEASE OPEN A TICKET WITH THIS INFORMATION:
|
||||||
|
https://trac.macports.org/newticket
|
||||||
* Summary: `vcs_blackbox @1.20150222 Update to latest upstream`
|
* Summary: `vcs_blackbox @1.20150222 Update to latest upstream`
|
||||||
* Description: ```
|
* Description: ```New upstream of vcs_blackbox.
|
||||||
New upstream of vcs_blackbox.
|
|
||||||
github.setup and checksums updated.```
|
github.setup and checksums updated.```
|
||||||
* Type: `update`
|
* Type: `update`
|
||||||
* Component: `ports`
|
* Component: `ports`
|
||||||
* Port: `vcs_blackbox`
|
* Port: `vcs_blackbox`
|
||||||
|
* Keywords: `maintainer`
|
||||||
|
* Attach this file: `Portfile-vcs_blackbox.diff`
|
||||||
|
|
||||||
Attach the `Portfile` generated in Step 1.
|
Step 3: Watch for the update to happen.
|
||||||
|
|
||||||
Step 4: Wait for the devs to pick up the change.
|
# Updating MacPorts (manual)
|
||||||
|
|
||||||
|
This is the old, manual, procedure. If the automated procedure work, these notes may or may not be helpful.
|
||||||
|
|
||||||
|
The ultimate result of the script should be a `diff -u Portfile.orig Portfile`. The new `Portfile` should have these changes:
|
||||||
|
|
||||||
|
1. The `github.setup` line should have a new version number.
|
||||||
|
2. The `checksums` line(s) should have updated checksums.
|
||||||
|
|
||||||
|
How to generate the checksums?
|
||||||
|
|
||||||
|
The easiest way is to to make a Portfile with incorrect checksums, then run `sudo port -v checksum vcs_blackbox` to see what they should have been. Fix the file, and try again.
|
||||||
|
|
||||||
|
When the the checksum command works, run `port lint vcs_blackbox` and make sure it has no errors.
|
||||||
|
|
||||||
|
Some useful commands:
|
||||||
|
|
||||||
|
Change repos in sources.conf:
|
||||||
|
```
|
||||||
|
sudo vi /opt/local/etc/macports/sources.conf
|
||||||
|
Add this line early in the file:
|
||||||
|
file:///var/tmp/ports
|
||||||
|
```
|
||||||
|
|
||||||
|
Add a local repo in an automated manner:
|
||||||
|
```
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
Remove the local repo in an automated manner:
|
||||||
|
```
|
||||||
|
sudo sed -i -e '\@^file:///var/tmp/ports@d' /opt/local/etc/macports/sources.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
Test a Portfile:
|
||||||
|
```
|
||||||
|
sudo port uninstall vcs_blackbox
|
||||||
|
sudo port clean --all vcs_blackbox
|
||||||
|
rm -rf ~/.macports/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/security/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 -v checksum vcs_blackbox
|
||||||
|
sudo port install vcs_blackbox
|
||||||
|
```
|
||||||
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