add Debian scripts

release/4.3a0
Jose Luis Blanco Claraco 2019-06-20 01:02:38 +02:00
parent 64ead677c2
commit 325d4a674d
14 changed files with 456 additions and 0 deletions

12
debian/README.md vendored Normal file
View File

@ -0,0 +1,12 @@
# How to build a GTSAM debian package
To use the ``debuild`` command, install the ``devscripts`` package
sudo apt install devscripts
Change into the gtsam directory, then run:
debuild -us -uc -j4
Adjust the ``-j4`` depending on how many CPUs you want to build on in
parallel.

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
gtsam (4.0.0-1berndpfrommer) bionic; urgency=medium
* initial release
-- Bernd Pfrommer <bernd.pfrommer@gmail.com> Wed, 18 Jul 2018 20:36:44 -0400

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

15
debian/control vendored Normal file
View File

@ -0,0 +1,15 @@
Source: gtsam
Section: libs
Priority: optional
Maintainer: Frank Dellaert <frank@cc.gatech.edu>
Uploaders: Jose Luis Blanco Claraco <joseluisblancoc@gmail.com>, Bernd Pfrommer <bernd.pfrommer@gmail.com>
Build-Depends: cmake, libboost-all-dev (>= 1.58), libeigen3-dev, libtbb-dev, debhelper (>=9)
Standards-Version: 3.9.7
Homepage: https://github.com/borglab/gtsam
Vcs-Browser: https://github.com/borglab/gtsam
Package: libgtsam-dev
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Georgia Tech Smoothing and Mapping Library
gtsam: Georgia Tech Smoothing and Mapping library for SLAM type applications

15
debian/copyright vendored Normal file
View File

@ -0,0 +1,15 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: gtsam
Source: https://bitbucket.org/gtborg/gtsam.git
Files: *
Copyright: 2017, Frank Dellaert
License: BSD
Files: gtsam/3rdparty/CCOLAMD/*
Copyright: 2005-2011, Univ. of Florida. Authors: Timothy A. Davis, Sivasankaran Rajamanickam, and Stefan Larimore. Closely based on COLAMD by Davis, Stefan Larimore, in collaboration with Esmond Ng, and John Gilbert. http://www.cise.ufl.edu/research/sparse
License: GNU LESSER GENERAL PUBLIC LICENSE
Files: gtsam/3rdparty/Eigen/*
Copyright: 2017, Multiple Authors
License: MPL2

0
debian/gtsam-docs.docs vendored Normal file
View File

25
debian/rules vendored Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@ --parallel
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
override_dh_auto_configure:
dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_WRAP=OFF -DGTSAM_BUILD_DOCS=OFF -DGTSAM_INSTALL_CPPUNITLITE=OFF -DGTSAM_INSTALL_GEOGRAPHICLIB=OFF -DGTSAM_BUILD_TYPE_POSTFIXES=OFF

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

14
package_scripts/README.md Normal file
View File

@ -0,0 +1,14 @@
# How to generate Debian packages
cd [GTSAM_SOURCE_ROOT]
bash package_scripts/prepare_debian.sh
# How to generate Ubuntu packages for a PPA
cd [GTSAM_SOURCE_ROOT]
bash package_scripts/prepare_ubuntu_pkgs_for_ppa.sh
cd ~/gtsam_ubuntu
bash [GTSAM_SOURCE_ROOT]/upload_all_gtsam_ppa.sh

179
package_scripts/prepare_debian.sh Executable file
View File

@ -0,0 +1,179 @@
#!/bin/bash
# Prepare to build a Debian package.
# Jose Luis Blanco Claraco, 2019 (for GTSAM)
# Jose Luis Blanco Claraco, 2008-2018 (for MRPT)
set -e # end on error
#set -x # for debugging
APPEND_SNAPSHOT_NUM=0
IS_FOR_UBUNTU=0
APPEND_LINUX_DISTRO=""
VALUE_EXTRA_CMAKE_PARAMS=""
while getopts "sud:c:" OPTION
do
case $OPTION in
s)
APPEND_SNAPSHOT_NUM=1
;;
u)
IS_FOR_UBUNTU=1
;;
d)
APPEND_LINUX_DISTRO=$OPTARG
;;
c)
VALUE_EXTRA_CMAKE_PARAMS=$OPTARG
;;
?)
echo "Unknown command line argument!"
exit 1
;;
esac
done
if [ -f CMakeLists.txt ];
then
source package_scripts/prepare_debian_gen_snapshot_version.sh
else
echo "Error: cannot find CMakeList.txt. This script is intended to be run from the root of the source tree."
exit 1
fi
# Append snapshot?
if [ $APPEND_SNAPSHOT_NUM == "1" ];
then
CUR_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CUR_SCRIPT_DIR/prepare_debian_gen_snapshot_version.sh # populate GTSAM_SNAPSHOT_VERSION
GTSAM_VERSION_STR="${GTSAM_VERSION_STR}~snapshot${GTSAM_SNAPSHOT_VERSION}${APPEND_LINUX_DISTRO}"
else
GTSAM_VERSION_STR="${GTSAM_VERSION_STR}${APPEND_LINUX_DISTRO}"
fi
# Call prepare_release
GTSAMSRC=`pwd`
if [ -f $HOME/gtsam_release/gtsam*.tar.gz ];
then
echo "## release file already exists. Reusing it."
else
source package_scripts/prepare_release.sh
echo
echo "## Done prepare_release.sh"
fi
echo "=========== Generating GTSAM ${GTSAM_VER_MMP} Debian package =============="
cd $GTSAMSRC
set -x
if [ -z "$GTSAM_DEB_DIR" ]; then
GTSAM_DEB_DIR="$HOME/gtsam_debian"
fi
GTSAM_EXTERN_DEBIAN_DIR="$GTSAMSRC/debian/"
GTSAM_EXTERN_UBUNTU_PPA_DIR="$GTSAMSRC/debian/"
if [ -f ${GTSAM_EXTERN_DEBIAN_DIR}/control ];
then
echo "Using debian dir: ${GTSAM_EXTERN_DEBIAN_DIR}"
else
echo "ERROR: Cannot find ${GTSAM_EXTERN_DEBIAN_DIR}"
exit 1
fi
GTSAM_DEBSRC_DIR=$GTSAM_DEB_DIR/gtsam-${GTSAM_VERSION_STR}
echo "GTSAM_VERSION_STR: ${GTSAM_VERSION_STR}"
echo "GTSAM_DEBSRC_DIR: ${GTSAM_DEBSRC_DIR}"
# Prepare a directory for building the debian package:
#
rm -fR $GTSAM_DEB_DIR || true
mkdir -p $GTSAM_DEB_DIR || true
# Orig tarball:
echo "Copying orig tarball: gtsam_${GTSAM_VERSION_STR}.orig.tar.gz"
cp $HOME/gtsam_release/gtsam*.tar.gz $GTSAM_DEB_DIR/gtsam_${GTSAM_VERSION_STR}.orig.tar.gz
cd ${GTSAM_DEB_DIR}
tar -xf gtsam_${GTSAM_VERSION_STR}.orig.tar.gz
if [ ! -d "${GTSAM_DEBSRC_DIR}" ];
then
mv gtsam-* ${GTSAM_DEBSRC_DIR} # fix different dir names for Ubuntu PPA packages
fi
if [ ! -f "${GTSAM_DEBSRC_DIR}/CMakeLists.txt" ];
then
echo "*ERROR*: Seems there was a problem copying sources to ${GTSAM_DEBSRC_DIR}... aborting script."
exit 1
fi
cd ${GTSAM_DEBSRC_DIR}
# Copy debian directory:
#mkdir debian
cp -r ${GTSAM_EXTERN_DEBIAN_DIR}/* debian
# Use modified control & rules files for Ubuntu PPA packages:
#if [ $IS_FOR_UBUNTU == "1" ];
#then
# already done: cp ${GTSAM_EXTERN_UBUNTU_PPA_DIR}/control.in debian/
# Ubuntu: force use of gcc-7:
#sed -i '9i\export CXX=/usr/bin/g++-7\' debian/rules
#sed -i '9i\export CC=/usr/bin/gcc-7\' debian/rules7
#fi
# Export signing pub key:
mkdir debian/upstream/
gpg --export --export-options export-minimal --armor > debian/upstream/signing-key.asc
# Parse debian/ control.in --> control
#mv debian/control.in debian/control
#sed -i "s/@GTSAM_VER_MM@/${GTSAM_VER_MM}/g" debian/control
# Replace the text "REPLACE_HERE_EXTRA_CMAKE_PARAMS" in the "debian/rules" file
# with: ${${VALUE_EXTRA_CMAKE_PARAMS}}
RULES_FILE=debian/rules
sed -i -e "s/REPLACE_HERE_EXTRA_CMAKE_PARAMS/${VALUE_EXTRA_CMAKE_PARAMS}/g" $RULES_FILE
echo "Using these extra parameters for CMake: '${VALUE_EXTRA_CMAKE_PARAMS}'"
# Strip my custom files...
rm debian/*.new || true
# Figure out the next Debian version number:
echo "Detecting next Debian version number..."
CHANGELOG_UPSTREAM_VER=$( dpkg-parsechangelog | sed -n 's/Version:.*\([0-9]\.[0-9]*\.[0-9]*.*snapshot.*\)-.*/\1/p' )
CHANGELOG_LAST_DEBIAN_VER=$( dpkg-parsechangelog | sed -n 's/Version:.*\([0-9]\.[0-9]*\.[0-9]*\).*-\([0-9]*\).*/\2/p' )
echo " -> PREVIOUS UPSTREAM: $CHANGELOG_UPSTREAM_VER -> New: ${GTSAM_VERSION_STR}"
echo " -> PREVIOUS DEBIAN VERSION: $CHANGELOG_LAST_DEBIAN_VER"
# If we have the same upstream versions, increase the Debian version, otherwise create a new entry:
if [ "$CHANGELOG_UPSTREAM_VER" = "$GTSAM_VERSION_STR" ];
then
NEW_DEBIAN_VER=$[$CHANGELOG_LAST_DEBIAN_VER + 1]
echo "Changing to a new Debian version: ${GTSAM_VERSION_STR}-${NEW_DEBIAN_VER}"
DEBCHANGE_CMD="--newversion ${GTSAM_VERSION_STR}-${NEW_DEBIAN_VER}"
else
DEBCHANGE_CMD="--newversion ${GTSAM_VERSION_STR}-1"
fi
echo "Adding a new entry to debian/changelog..."
DEBEMAIL="Jose Luis Blanco Claraco <joseluisblancoc@gmail.com>" debchange $DEBCHANGE_CMD -b --distribution unstable --force-distribution New version of upstream sources.
echo "Copying back the new changelog to a temporary file in: ${GTSAM_EXTERN_DEBIAN_DIR}changelog.new"
cp debian/changelog ${GTSAM_EXTERN_DEBIAN_DIR}changelog.new
set +x
echo "=============================================================="
echo "Now, you can build the source Deb package with 'debuild -S -sa'"
echo "=============================================================="
cd ..
ls -lh
exit 0

View File

@ -0,0 +1,25 @@
#!/bin/bash
# See https://reproducible-builds.org/specs/source-date-epoch/
# get SOURCE_DATE_EPOCH with UNIX time_t
if [ -d ".git" ];
then
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
else
echo "Error: intended for use from within a git repository"
exit 1
fi
GTSAM_SNAPSHOT_VERSION=$(date -d @$SOURCE_DATE_EPOCH +%Y%m%d-%H%M)
GTSAM_SNAPSHOT_VERSION+="-git-"
GTSAM_SNAPSHOT_VERSION+=`git rev-parse --short=8 HEAD`
GTSAM_SNAPSHOT_VERSION+="-"
# x.y.z version components:
GTSAM_VERSION_MAJOR=$(grep "(GTSAM_VERSION_MAJOR" CMakeLists.txt | sed -r 's/^.*GTSAM_VERSION_MAJOR\s*([0-9])*.*$/\1/g')
GTSAM_VERSION_MINOR=$(grep "(GTSAM_VERSION_MINOR" CMakeLists.txt | sed -r 's/^.*GTSAM_VERSION_MINOR\s*([0-9])*.*$/\1/g')
GTSAM_VERSION_PATCH=$(grep "(GTSAM_VERSION_PATCH" CMakeLists.txt | sed -r 's/^.*GTSAM_VERSION_PATCH\s*([0-9])*.*$/\1/g')
GTSAM_VER_MM="${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}"
GTSAM_VER_MMP="${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}"
GTSAM_VERSION_STR=$GTSAM_VER_MMP

View File

@ -0,0 +1,71 @@
#!/bin/bash
# Export sources from a git tree and prepare it for a public release.
# Jose Luis Blanco Claraco, 2019 (for GTSAM)
# Jose Luis Blanco Claraco, 2008-2018 (for MRPT)
set -e # exit on error
#set -x # for debugging
# Checks
# --------------------------------
if [ -f version_prefix.txt ];
then
if [ -z ${GTSAM_VERSION_STR+x} ];
then
source package_scripts/prepare_debian_gen_snapshot_version.sh
fi
echo "ERROR: Run this script from the GTSAM source tree root directory."
exit 1
fi
GTSAM_SRC=`pwd`
OUT_RELEASES_DIR="$HOME/gtsam_release"
OUT_DIR=$OUT_RELEASES_DIR/gtsam-${GTSAM_VERSION_STR}
echo "=========== Generating GTSAM release ${GTSAM_VER_MMP} =================="
echo "GTSAM_VERSION_STR : ${GTSAM_VERSION_STR}"
echo "OUT_DIR : ${OUT_DIR}"
echo "============================================================"
echo
# Prepare output directory:
rm -fR $OUT_RELEASES_DIR || true
mkdir -p ${OUT_DIR}
# Export / copy sources to target dir:
if [ -d "$GTSAM_SRC/.git" ];
then
echo "# Exporting git source tree to ${OUT_DIR}"
git archive --format=tar HEAD | tar -x -C ${OUT_DIR}
# Remove VCS control files:
find ${OUT_DIR} -name '.gitignore' | xargs rm
# Generate ./SOURCE_DATE_EPOCH with UNIX time_t
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
else
echo "# Copying sources to ${OUT_DIR}"
cp -R . ${OUT_DIR}
# Generate ./SOURCE_DATE_EPOCH with UNIX time_t
SOURCE_DATE_EPOCH=$(date +%s)
fi
# See https://reproducible-builds.org/specs/source-date-epoch/
echo $SOURCE_DATE_EPOCH > ${OUT_DIR}/SOURCE_DATE_EPOCH
cd ${OUT_DIR}
# Dont include Debian files in releases:
rm -fR package_scripts
# Orig tarball:
cd ..
echo "# Creating orig tarball: gtsam-${GTSAM_VERSION_STR}.tar.gz"
tar czf gtsam-${GTSAM_VERSION_STR}.tar.gz gtsam-${GTSAM_VERSION_STR}
rm -fr gtsam-${GTSAM_VERSION_STR}
# GPG signature:
gpg --armor --detach-sign gtsam-${GTSAM_VERSION_STR}.tar.gz

View File

@ -0,0 +1,90 @@
#!/bin/bash
# Creates a set of packages for each different Ubuntu distribution, with the
# intention of uploading them to:
# https://launchpad.net/~joseluisblancoc/
#
# JLBC, 2010
# [Addition 2012:]
#
# You can declare a variable (in the caller shell) with extra flags for the
# CMake in the final ./configure like:
# GTSAM_PKG_CUSTOM_CMAKE_PARAMS="\"-DDISABLE_SSE3=ON\""
#
set -e
# List of distributions to create PPA packages for:
LST_DISTROS=(xenial bionic cosmic disco)
# Checks
# --------------------------------
if [ -f CMakeLists.txt ];
then
source package_scripts/prepare_debian_gen_snapshot_version.sh
echo "GTSAM version: ${GTSAM_VER_MMP}"
else
echo "ERROR: Run this script from the GTSAM root directory."
exit 1
fi
if [ -z "${gtsam_ubuntu_OUT_DIR}" ]; then
export gtsam_ubuntu_OUT_DIR="$HOME/gtsam_ubuntu"
fi
GTSAMSRC=`pwd`
if [ -z "${GTSAM_DEB_DIR}" ]; then
export GTSAM_DEB_DIR="$HOME/gtsam_debian"
fi
GTSAM_EXTERN_DEBIAN_DIR="$GTSAMSRC/debian/"
EMAIL4DEB="Jose Luis Blanco (University of Malaga) <joseluisblancoc@gmail.com>"
# Clean out dirs:
rm -fr $gtsam_ubuntu_OUT_DIR/
# -------------------------------------------------------------------
# And now create the custom packages for each Ubuntu distribution:
# -------------------------------------------------------------------
count=${#LST_DISTROS[@]}
IDXS=$(seq 0 $(expr $count - 1))
cp ${GTSAM_EXTERN_DEBIAN_DIR}/changelog /tmp/my_changelog
for IDX in ${IDXS};
do
DEBIAN_DIST=${LST_DISTROS[$IDX]}
# -------------------------------------------------------------------
# Call the standard "prepare_debian.sh" script:
# -------------------------------------------------------------------
cd ${GTSAMSRC}
bash package_scripts/prepare_debian.sh -s -u -d ${DEBIAN_DIST} -c "${GTSAM_PKG_CUSTOM_CMAKE_PARAMS}"
CUR_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CUR_SCRIPT_DIR/prepare_debian_gen_snapshot_version.sh # populate GTSAM_SNAPSHOT_VERSION
echo "===== Distribution: ${DEBIAN_DIST} ========="
cd ${GTSAM_DEB_DIR}/gtsam-${GTSAM_VER_MMP}~snapshot${GTSAM_SNAPSHOT_VERSION}${DEBIAN_DIST}/debian
#cp ${GTSAM_EXTERN_DEBIAN_DIR}/changelog changelog
cp /tmp/my_changelog changelog
DEBCHANGE_CMD="--newversion ${GTSAM_VERSION_STR}~snapshot${GTSAM_SNAPSHOT_VERSION}${DEBIAN_DIST}-1"
echo "Changing to a new Debian version: ${DEBCHANGE_CMD}"
echo "Adding a new entry to debian/changelog for distribution ${DEBIAN_DIST}"
DEBEMAIL="Jose Luis Blanco Claraco <joseluisblancoc@gmail.com>" debchange $DEBCHANGE_CMD -b --distribution ${DEBIAN_DIST} --force-distribution New version of upstream sources.
cp changelog /tmp/my_changelog
echo "Now, let's build the source Deb package with 'debuild -S -sa':"
cd ..
# -S: source package
# -sa: force inclusion of sources
# -d: don't check dependencies in this system
debuild -S -sa -d
# Make a copy of all these packages:
cd ..
mkdir -p $gtsam_ubuntu_OUT_DIR/$DEBIAN_DIST
cp gtsam_* $gtsam_ubuntu_OUT_DIR/${DEBIAN_DIST}/
echo ">>>>>> Saving packages to: $gtsam_ubuntu_OUT_DIR/$DEBIAN_DIST/"
done
exit 0

View File

@ -0,0 +1,3 @@
#!/bin/bash
find . -name '*.changes' | xargs -I FIL dput ppa:joseluisblancoc/gtsam-develop FIL