File docker-image-migrator.spec of Package docker-image-migrator.2283
#
# spec file for package docker-image-migrator
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define go_arches %ix86 x86_64
%ifarch %go_arches
%define go_tool go
%define GO_BUILD_FLAGS ""
%else
%define go_tool go-5
%define GO_BUILD_FLAGS "-gccgoflags=-Wl,--add-needed -Wl,--no-as-needed -static-libgo -ldl -lselinux"
%endif
%define version_unconverted 1.0.2
%define bindir %{_prefix}/lib/docker-image-migrator
%define migratescriptname do-image-migration-v1to2.sh
Name: docker-image-migrator
Version: 1.0.2
Release: 0
License: Apache-2.0
Summary: No-downtime migration tool for Docker v1 image manifests.
Url: https://github.com/docker/v1.10-migrator
Group: System/Management
Source0: %{name}-%{version}.tar.xz
Source1: %{migratescriptname}
Patch0: ignore_undefined_flag_errors.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: xz
BuildRequires: device-mapper-devel >= 1.2.68
BuildRequires: libbtrfs-devel >= 3.8
%ifarch %go_arches
BuildRequires: go >= 1.5
%else
BuildRequires: gcc5-go >= 5.0
%endif
%description
In the transition between docker<=1.9 and docker>=1.10, the image manifest
format has changed. Upon restarting Docker, it will go through a lengthy
migration process. This package allows for the bulk of the migration to be done
while still on docker<=1.9, allowing for minimal-to-no downtime (while
restarting Docker will cause downtime during the migration).
%prep
%dump
%setup -q -n %{name}-%{version}
%patch0 -p1
cp -v %{_sourcedir}/%{migratescriptname} %{_builddir}/%{name}-%{version}/%{migratescriptname}
%build
export GOPATH=$PWD/go
mkdir -pv $GOPATH/src/github.com/docker/
# Copy the vendor directory into the GOPATH.
cp -rv $PWD/Godeps/_workspace/src/* $GOPATH/src/
ln -sv $PWD $GOPATH/src/github.com/docker/v1.10-migrator
export BUILDTAGS="exclude_graphdriver_aufs libdm_no_deferred_remove"
# This is taken from hack/vendor.sh in https://github.com/docker/docker.
# test whether "btrfs/version.h" exists and apply btrfs_noversion appropriately
if (command -v gcc &> /dev/null && ! gcc -E - -o /dev/null &> /dev/null <<<'#include <btrfs/version.h>')
then
export BUILDTAGS="$BUILDTAGS btrfs_noversion"
fi
%go_tool build -tags "$BUILDTAGS" -x -o %{name}-%{version} %GO_BUILD_FLAGS
%install
%{__mkdir_p} %{buildroot}%{bindir}
%{__install} -m0755 %{name}-%{version} %{buildroot}%{bindir}/%{name}
%{__install} -m0755 %{migratescriptname} %{buildroot}%{bindir}/%{migratescriptname}
%pre
%post
cat <<EOF
Please run
\$ sudo /usr/lib/docker-image-migrator/do-image-migration-v1to2.sh
for the migration to start. This script will source /etc/sysconfig/docker to
ascertain the storage driver and storage options used by Docker. If you wish to
add any extra options, you can specify them as arguments to the script.
EOF
%preun
%postun
%files
%defattr(-,root,root)
%doc README.md LICENSE.code LICENSE.docs
%dir %{bindir}
%{bindir}/%{name}
%{bindir}/%{migratescriptname}