Commit 74f87ef3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1464-build-issue' into 'master'

Resolve "remove support for upgrade from versions before 12.1"

Closes #1464

See merge request !1292
parents aec1ee5e af57958f
Pipeline #40044 canceled with stage
......@@ -524,7 +524,7 @@ test_deploy_with_db_without_superadmin_rights:
script:
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql-client
- mkdir /etc/minerva
- mkdir -p /etc/minerva
- echo "database.uri=jdbc:postgresql://postgres:5432/test" > /etc/minerva/db.properties
- echo "database.username=test" >> /etc/minerva/db.properties
- echo "database.password=test" >> /etc/minerva/db.properties
......
minerva (16.0.0~alpha.1) stable; urgency=medium
minerva (16.0.0~alpha.2) stable; urgency=medium
* Backward incompatibility: debian package cannot be upgraded from version
prior to 12.1.0 (#1464)
* Small improvement: homomultimer information is provided in API (#1468)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 19 Mar 2021 10:00:00 +0200
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 26 Mar 2021 10:00:00 +0200
minerva (16.0.0~alpha.1) stable; urgency=medium
* Backward incompatibility: deprecated columns in data overlays are no longer
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>CellDesigner-plugin</artifactId>
<!-- dependency from the MapViewer model -->
......@@ -50,19 +50,19 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>commons</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>annotation</artifactId>
<name>Annotation module</name>
......@@ -18,7 +18,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<!-- dependency from the MapViewer dao -->
......@@ -26,7 +26,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<!-- dependency from the MapViewer cell designer parser (we need access
......@@ -34,13 +34,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -64,7 +64,7 @@
</target>
<target name="maven-build" depends="gitversion, maven-build-windows, maven-build-unix" />
<target name="maven-build" depends="maven-build-windows, maven-build-unix" />
<target name="maven-build-windows" if="isWindows">
<exec dir="." executable="cmd">
......@@ -78,7 +78,7 @@
</exec>
</target>
<target name="maven-build-with-doc" depends="gitversion, maven-build-with-doc-windows, maven-build-with-doc-unix" />
<target name="maven-build-with-doc" depends="maven-build-with-doc-windows, maven-build-with-doc-unix" />
<target name="maven-build-with-doc-windows" if="isWindows">
<exec dir="." executable="cmd">
......@@ -108,32 +108,6 @@
</exec>
</target>
<target name="deployMapFiles">
<copy todir="${tomcat.deploy.dir}/map_images">
<fileset dir="map_images" />
</copy>
</target>
<target name="gitversion">
<exec executable="git" outputproperty="gitversion">
<arg value="rev-parse" />
<arg value="HEAD" />
</exec>
<tstamp>
<format property="build.time" pattern="dd/MM/yyyy HH:mm" unit="hour" />
</tstamp>
<echo>GIT Version: ${gitversion}
Build timestamp: ${build.time}
</echo>
<echo file="web/src/main/webapp/version.txt">${gitversion}
${build.time}
</echo>
<copy file="CHANGELOG" tofile="web/src/main/webapp/CHANGELOG" overwrite="true" />
</target>
<target name="debian-pkg" depends="maven-build">
<exec executable="debian/create-debian-pkg.sh" />
</target>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>commons</artifactId>
<name>Mapviewer commons</name>
......
......@@ -3,6 +3,7 @@ package lcsb.mapviewer.common;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.jar.Manifest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -215,25 +216,17 @@ public final class Configuration {
systemBuildVersion = "Unknown";
systemBuildTime = "Unknown";
systemVersion = "Unknown";
File buildVersionFile = null;
File changelogFile = null;
File manifestFile = null;
if (baseDir == null) {
buildVersionFile = new File("version.txt");
changelogFile = new File("CHANGELOG");
manifestFile = new File("META-INF/MANIFEST.MF");
} else {
buildVersionFile = new File(baseDir + "version.txt");
changelogFile = new File(baseDir + "CHANGELOG");
manifestFile = new File(baseDir + "MANIFEST.MF");
}
if (buildVersionFile.exists()) {
loadSystemBuildVersion(buildVersionFile);
if (manifestFile.exists()) {
loadSystemBuildVersion(manifestFile);
} else {
logger.error(buildVersionFile.getAbsoluteFile() + " doesn't exist.");
}
if (changelogFile.exists()) {
loadSystemVersion(changelogFile);
} else {
logger.error(changelogFile.getAbsoluteFile() + " doesn't exist.");
logger.error(manifestFile.getAbsoluteFile() + " doesn't exist.", new Exception());
}
}
......@@ -245,35 +238,27 @@ public final class Configuration {
*/
protected static void loadSystemBuildVersion(File file) {
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
systemBuildVersion = reader.readLine().trim();
systemBuildTime = reader.readLine().trim();
reader.close();
} catch (IOException e) {
logger.error(e);
}
}
/**
* Loads system version from debian changelog file.
*
* @param file
* debian changelog file
*/
protected static void loadSystemVersion(File file) {
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = reader.readLine();
int startIndex = line.indexOf("(");
int endIndex = line.indexOf(")");
if (startIndex >= 0 && endIndex >= 0) {
systemVersion = line.substring(startIndex + 1, endIndex);
} else {
logger.error("Invalid CHANGELOG file. Cannot find system version in line: " + line);
boolean problem = false;
Manifest manifest = new Manifest(new FileInputStream(file));
systemBuildTime = manifest.getMainAttributes().getValue("git-timestamp");
if (systemBuildTime == null) {
systemBuildTime = "Unknown";
problem = true;
}
systemBuildVersion = manifest.getMainAttributes().getValue("git-version");
if (systemBuildVersion == null) {
systemBuildVersion = "Unknown";
problem = true;
}
systemVersion = manifest.getMainAttributes().getValue("version");
if (systemVersion == null) {
systemVersion = "Unknown";
problem = true;
}
if (problem) {
logger.warn("MANIFEST.MF file does not contain required information.");
}
reader.close();
} catch (IOException e) {
logger.error(e);
}
......
......@@ -42,7 +42,7 @@ public class ConfigurationTest extends CommonTestFunctions {
@Test
public void testLoadSystemBuildVersion2() {
Configuration.loadSystemVersion((String) null);
Configuration.loadSystemVersion(new File("unknown.xxx"));
Configuration.loadSystemVersion("/tmp");
assertEquals("Unknown", Configuration.getSystemBuildVersion(null));
assertEquals("Unknown", Configuration.getSystemBuild(null));
assertEquals("Unknown", Configuration.getSystemVersion(null));
......@@ -50,15 +50,15 @@ public class ConfigurationTest extends CommonTestFunctions {
@Test
public void testGetSystemBuildVersion() {
assertEquals("100", Configuration.getSystemBuildVersion("testFiles/version/", true));
assertEquals("100", Configuration.getSystemBuildVersion(null, false));
assertEquals("101", Configuration.getSystemVersion("testFiles/version/", true));
assertEquals("78606521500fd349b603a77e9f64cfe57517c1a6", Configuration.getSystemBuildVersion("testFiles/version/", true));
assertEquals("78606521500fd349b603a77e9f64cfe57517c1a6", Configuration.getSystemBuildVersion(null, false));
assertEquals("16.0.0~alpha.2", Configuration.getSystemVersion("testFiles/version/", true));
}
@Test
public void testGetSystemBuild() {
assertEquals("102", Configuration.getSystemBuild("testFiles/version/", true));
assertEquals("102", Configuration.getSystemBuild(null, false));
assertEquals("2021-03-29T08:44:16+0200", Configuration.getSystemBuild("testFiles/version/", true));
assertEquals("2021-03-29T08:44:16+0200", Configuration.getSystemBuild(null, false));
}
@Test
......@@ -83,9 +83,12 @@ public class ConfigurationTest extends CommonTestFunctions {
}
@Test
public void testLoadInvalidSystemVersion() {
Configuration.loadSystemVersion(new File("testFiles/version/INVALID_CHANGELOG"));
assertEquals(1, super.getErrors().size());
public void testLoadMissingSystemVersion() {
FrameworkVersion version = Configuration.getFrameworkVersion("testFiles/invalid_version/");
assertEquals("Unknown", version.getGitVersion());
assertEquals("Unknown", version.getTime());
assertEquals("Unknown", version.getVersion());
assertEquals(1, super.getWarnings().size());
}
@Test
......
Manifest-Version: 1.0
Created-By: Apache Maven 3.6.3
Built-By: gawi
Build-Jdk: 11.0.10
minerva (101) stable; urgency=medium
* Initial release
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 4 Dec 2013 22:00:00 +0200
\ No newline at end of file
blablabla
\ No newline at end of file
Manifest-Version: 1.0
Created-By: Apache Maven 3.6.3
Built-By: gawi
Build-Jdk: 11.0.10
git-timestamp: 2021-03-29T08:44:16+0200
git-version: 78606521500fd349b603a77e9f64cfe57517c1a6
version: 16.0.0~alpha.2
100
102
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>converter-CellDesigner</artifactId>
<name>CellDesigner converter</name>
......@@ -17,13 +17,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>converter-SBGNML</artifactId>
......@@ -20,26 +20,26 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>converter-graphics</artifactId>
<name>MapViewer graphics converter</name>
......@@ -18,13 +18,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<!-- Log4J2-->
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>converter-sbml</artifactId>
<name>converter-sbml</name>
......@@ -40,22 +40,22 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<!-- Log4J2 -->
......@@ -154,7 +154,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
<scope>test</scope>
</dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</parent>
<artifactId>converter</artifactId>
......@@ -15,7 +15,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.0~alpha.1</version>
<version>16.0.0~alpha.2</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
......
......@@ -9,23 +9,15 @@ versionCompLt() {
[ "$1" = "$2" ] && return 1 || versionCompLte $1 $2
}
# file with bash code generating DB schema diffs for different versions
dbschemadiff=management_scripts/db_schema_and_diff.sh
#Where source file of the debian package should be placed
SRC_DIR=debian/src
#File that should be deployed on tomcat
TOMCAT_FILE=web/target/*.war
#Directory with database schema
DB_SCHEMA_DIR=persist/src/main/resources/db/migration/postgres
ROOT_DIR=`pwd`
# where dn script files should be stored on the debian system
DB_SCRIPT_DIR="\/usr\/share\/minerva\/schema"
LOG_FILE="\/var\/log\/minerva-install.log"
#clean build directories
......@@ -52,20 +44,9 @@ cp debian/scripts/common.sh $SRC_DIR/
#copy changelog file
cp CHANGELOG $ROOT_DIR/debian/template/changelog
# set $versions and $current_version; generate upgrade scripts in SRC_DIR
DBSCRIPT_DEST_DIR=$SRC_DIR
MAX_DB_VERSION_FOR_MIGRTION=12.1.0~alpha
source $dbschemadiff
current_version=`cat CHANGELOG |grep minerva |head -1 | cut -f2 -d'(' | cut -f1 -d')'`
echo "Current version: " $current_version
echo "Flyway was introduced in version: " $MAX_DB_VERSION_FOR_MIGRTION
#------------------------------------------
# Now we have all db schema diff files. Let's start preparing
# debian package
#------------------------------------------
#dh_make requires directory name to be like <package>-<version>
# this points to the directory
......@@ -92,11 +73,6 @@ find -name '*.ex' ! -name 'minerva*' -type f -exec rm -f {} +
sed -i "s/__CURRENT_VERSION__/$current_version/g" common.sh
sed -i "s/__LOG_FILE__/$LOG_FILE/g" common.sh
#__DB_SCRIPT_DIR__ in our scripts points to place where db schema files are placed
#in the filesystem where package is installed
sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" common.sh
sed -i "s/__MAX_DB_VERSION_FOR_MIGRTION__/$MAX_DB_VERSION_FOR_MIGRTION/g" common.sh
sed -i -e "1r common.sh" debian/config
sed -i -e "1r common.sh" debian/postinst
......@@ -107,14 +83,6 @@ sed -i -e "1r common.sh" debian/prerm
#put scripts into $DB_SCRIPT_DIR (it's a bit different than varaiable because it's not
#escaped
echo db_0_to_$MAX_DB_VERSION_FOR_MIGRTION".sql" /usr/share/minerva/schema >> debian/install
for version in ${versions[*]}
do
echo db_"$version"_to_$MAX_DB_VERSION_FOR_MIGRTION".sql" /usr/share/minerva/schema >> debian/install;
done
#set proper architecture
arch=`dpkg --print-architecture`
echo "Architecture: $arch" >>debian/control
......
......@@ -4,9 +4,6 @@ log(){
}
LOG_FILE="__LOG_FILE__"
DB_SCRIPT_DIR="__DB_SCRIPT_DIR__"
MAX_DB_VERSION_FOR_MIGRTION="__MAX_DB_VERSION_FOR_MIGRTION__"
#new (current) version of the package
CURRENT_VERSION="__CURRENT_VERSION__"
#if we update package then this will be the old version of the package
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment