From 06106f75f55ca7fd1cd733eab322008805411dff Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Fri, 10 Jan 2020 12:40:26 -0500 Subject: [PATCH 1/3] update_version: add script to bump rpm version metadata --- update_version.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 update_version.sh diff --git a/update_version.sh b/update_version.sh new file mode 100755 index 00000000..12afb441 --- /dev/null +++ b/update_version.sh @@ -0,0 +1,35 @@ +#!/bin/bash +## Usage: ./update_version.sh + +set -e + +readonly NEW_VERSION=$1 + +if [ -z "$NEW_VERSION" ]; then + echo "You must specify the new version!" + exit 1 +fi + +# Get the old version from setup.py +old_version_regex="version=\"([0-9a-z.-_+]*)\"" +[[ "$(cat setup.py)" =~ $old_version_regex ]] +OLD_VERSION=${BASH_REMATCH[1]} + +if [ -z "$OLD_VERSION" ]; then + echo "Couldn't find the old version: does this script need to be updated?" + exit 1 +fi + +# Update the version in rpm-build/SPECS/securedrop-workstation-dom0-config.spec and setup.py +# We just change Source0 and Version fields in the rpm spec. The spec file also contains the changelog entries, +# and we don't want to increment those versions. +if [[ "$OSTYPE" == "darwin"* ]]; then + # The empty '' after sed -i is required on macOS to indicate no backup file should be saved. + sed -i '' -e "/Source0/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec + sed -i '' -e "/Version/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec + sed -i '' "s@$(echo "${OLD_VERSION}" | sed 's/\./\\./g')@$NEW_VERSION@g" setup.py +else + sed -i -e "/Source0/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec + sed -i -e "/Version/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec + sed -i "s@$(echo "${OLD_VERSION}" | sed 's/\./\\./g')@$NEW_VERSION@g" setup.py +fi From c6c89eb9fcf6c6672f3e1c6f03116a614d4e7aea Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Fri, 10 Jan 2020 12:44:14 -0500 Subject: [PATCH 2/3] dom0 rpm: update metadata to 0.1.1 The version of this dom0 rpm should match the latest tag in securedrop-workstation, which is 0.1.1. Nightlies will add a small changelog entry (that will not be saved) and will increment the version above the latest official release, which is 0.1.1. --- rpm-build/SPECS/securedrop-workstation-dom0-config.spec | 7 +++++-- setup.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rpm-build/SPECS/securedrop-workstation-dom0-config.spec b/rpm-build/SPECS/securedrop-workstation-dom0-config.spec index 7c7137fb..2821c70b 100644 --- a/rpm-build/SPECS/securedrop-workstation-dom0-config.spec +++ b/rpm-build/SPECS/securedrop-workstation-dom0-config.spec @@ -1,12 +1,12 @@ Name: securedrop-workstation-dom0-config -Version: 0.0.1 +Version: 0.1.1 Release: 1%{?dist} Summary: SecureDrop Workstation Group: Library License: GPLv3+ URL: https://github.com/freedomofpress/securedrop-workstation -Source0: securedrop-workstation-dom0-config-0.0.1.tar.gz +Source0: securedrop-workstation-dom0-config-0.1.1.tar.gz BuildArch: noarch BuildRequires: python3-setuptools @@ -64,6 +64,9 @@ find /srv/salt -maxdepth 1 -type f -iname '*.top' \ | xargs qubesctl top.enable > /dev/null %changelog +* Fri Jan 10 2020 redshiftzero - 0.1.1 +- First alpha release. + * Fri Oct 26 2018 Kushal Das - 0.0.1-1 - First release diff --git a/setup.py b/setup.py index e2b83840..8ee7bea4 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,8 @@ setuptools.setup( name="securedrop-workstation-dom0-config", - version="0.0.1", - author="Kushal Das", + version="0.1.1", + author="SecureDrop Team", author_email="securedrop@freedom.press", description="SecureDrop Workstation", long_description=long_description, From e2f401dbc6137bf702967d488680a134ed345576 Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Fri, 10 Jan 2020 15:17:23 -0500 Subject: [PATCH 3/3] update_version: just keep a VERSION file like we do in proxy easier to maintain --- MANIFEST.in | 1 + VERSION | 1 + setup.py | 5 ++++- update_version.sh | 9 +++------ 4 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 VERSION diff --git a/MANIFEST.in b/MANIFEST.in index 759f5680..2294c44e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ include dom0/securedrop-update include config.json.example include README.md include LICENSE +include VERSION include Makefile include sd-proxy/* include sd-svs/* diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..17e51c38 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.1 diff --git a/setup.py b/setup.py index 8ee7bea4..1a60c64b 100644 --- a/setup.py +++ b/setup.py @@ -3,10 +3,13 @@ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() +with open("VERSION", "r", encoding="utf-8") as f: + version = f.read().strip() + setuptools.setup( name="securedrop-workstation-dom0-config", - version="0.1.1", author="SecureDrop Team", + version=version, author_email="securedrop@freedom.press", description="SecureDrop Workstation", long_description=long_description, diff --git a/update_version.sh b/update_version.sh index 12afb441..2d96deb1 100755 --- a/update_version.sh +++ b/update_version.sh @@ -10,10 +10,7 @@ if [ -z "$NEW_VERSION" ]; then exit 1 fi -# Get the old version from setup.py -old_version_regex="version=\"([0-9a-z.-_+]*)\"" -[[ "$(cat setup.py)" =~ $old_version_regex ]] -OLD_VERSION=${BASH_REMATCH[1]} +OLD_VERSION=$(cat VERSION) if [ -z "$OLD_VERSION" ]; then echo "Couldn't find the old version: does this script need to be updated?" @@ -25,11 +22,11 @@ fi # and we don't want to increment those versions. if [[ "$OSTYPE" == "darwin"* ]]; then # The empty '' after sed -i is required on macOS to indicate no backup file should be saved. + sed -i '' "s@$(echo "${OLD_VERSION}" | sed 's/\./\\./g')@$NEW_VERSION@g" VERSION sed -i '' -e "/Source0/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec sed -i '' -e "/Version/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec - sed -i '' "s@$(echo "${OLD_VERSION}" | sed 's/\./\\./g')@$NEW_VERSION@g" setup.py else + sed -i "s@$(echo "${OLD_VERSION}" | sed 's/\./\\./g')@$NEW_VERSION@g" VERSION sed -i -e "/Source0/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec sed -i -e "/Version/s/$OLD_VERSION/$NEW_VERSION/" rpm-build/SPECS/securedrop-workstation-dom0-config.spec - sed -i "s@$(echo "${OLD_VERSION}" | sed 's/\./\\./g')@$NEW_VERSION@g" setup.py fi