From: Stefan Hundhammer Date: Wed, 13 Apr 2016 14:55:18 +0000 (+0200) Subject: Unify SUSE and Debian build X-Git-Tag: v0.4.0~12^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=adc2ddac35342980711ead2451f52476fae91b3f;p=thirdparty%2Fsnapper.git Unify SUSE and Debian build --- diff --git a/.gitignore b/.gitignore index aaf6c3aa..d222ed9d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ install-sh libtool ltmain.sh missing -/obs-package-from-git +obs-package-from-git stamp-h1 py-compile test-driver diff --git a/Makefile.am b/Makefile.am index 00a799af..11c8f833 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,48 @@ EXTRA_DIST = $(doc_DATA) VERSION LIBVERSION snapper-$(VERSION).tar.bz2: dist-bzip2 -package: snapper-$(VERSION).tar.bz2 +DEBIAN_FLAVOURS = \ + Debian_7.0 \ + Debian_8.0 \ + xUbuntu_14.04 \ + xUbuntu_14.10 \ + xUbuntu_15.04 \ + xUbuntu_15.10 \ + xUbuntu_16.04 + +show-debian: + @echo "Debian flavors: $(DEBIAN_FLAVOURS)" + +package-clean: rm -f package/snapper-*.tar.bz2 + rm -f package/debian.* + rm -f package/*.dsc + +# Create all the files necessary for building the package with OBS: +# +# - Clean up the package/ directory +# - create a new tarball (via the depencency) +# - copy the content of the debian/ directory +# - generate a master .dsc file with the "Files:" line for the tarball +# with its md5sum, file size in bytes, and name +# - copy that .dsc master file for each flavor of Debian to be supported +# - remove the .dsc master file and the .dsc.in file +# - move the new tarball to the package/ directory +# +# Unfortunately, using variables for the md5sum and the file size didn't work out +# (not even with the GNU make ':=' syntax): They cannot be assigned in the 'actions' +# part of a rule, only outside rules. +# +# The debian/snapper.dsc file is generated by autoconf (see configure.ac) from +# debian/snapper.dsc.in with @VERSION@ expanded with the content of +# $toplevel/VERSION. +# +# $< is the first depencency of the rule, i.e. snapper-$(VERSION).tar.gz in this case. +# +package: snapper-$(VERSION).tar.bz2 package-clean + cp debian/* package/ + echo "$(shell md5sum $< | sed -e 's/\s.*//') $(shell wc -c $<)" >>package/snapper.dsc + for DEB in $(DEBIAN_FLAVOURS); do cp -v package/snapper.dsc package/snapper-$${DEB}.dsc; done + rm package/snapper.dsc* mv snapper-$(VERSION).tar.bz2 package/ diff --git a/Makefile.ci b/Makefile.ci index a3d7b81a..231c0da5 100644 --- a/Makefile.ci +++ b/Makefile.ci @@ -3,15 +3,18 @@ # Usage in Jenkins: # make -f Makefile.ci package -.PHONY: package +.PHONY: package always_out_of_date + package: obs-package-from-git ./$^ \ - -P YaST:Head -p snapper \ + -P filesystems:snapper -p snapper \ -o .obsdir \ -c 'make -f Makefile.repo && make package' # A script that is shared with other projects and should be always refreshed URL=https://raw.githubusercontent.com/openSUSE/obs-package-from-git/master/obs-package-from-git + .PHONY: always_out_of_date + obs-package-from-git: always_out_of_date wget -O $@ $(URL) && chmod +x $@ diff --git a/Rakefile b/Rakefile index 83341ad8..595579e5 100644 --- a/Rakefile +++ b/Rakefile @@ -15,6 +15,11 @@ Packaging.configuration do |conf| conf.package_name.sub!(/-.*/, "") # strip branch name conf.package_dir = ".obsdir" # Makefile.ci puts it there conf.skip_license_check << /.*/ + + conf.obs_api = "https://api.opensuse.org/" + conf.obs_project = "filesystems:snapper" + conf.obs_target = "openSUSE_Factory" + conf.obs_sr_project = "openSUSE_Factory" end desc 'Pretend to run the test suite' diff --git a/configure.ac b/configure.ac index 50093f0f..33ce6eb3 100644 --- a/configure.ac +++ b/configure.ac @@ -183,4 +183,5 @@ AC_OUTPUT( testsuite-real/Makefile testsuite-cmp/Makefile package/snapper.spec:snapper.spec.in + debian/snapper.dsc:debian/snapper.dsc.in ) diff --git a/debian/debian.changelog b/debian/debian.changelog new file mode 100644 index 00000000..87081cbe --- /dev/null +++ b/debian/debian.changelog @@ -0,0 +1,131 @@ +snapper (0.3.3-0) stable; urgency=low + + * Updated to version 0.3.3 + + -- Arvin Schnell Tue, 2 Aug 2016 13:42:22 +0200 + +snapper (0.2.8-0) stable; urgency=low + + * Updated to version 0.2.8 + + -- Arvin Schnell Thu, 27 Aug 2015 12:01:05 +0200 + +snapper (0.2.6-0) stable; urgency=low + + * Updated to version 0.2.6 + + -- Arvin Schnell Tue, 24 Feb 2015 10:58:53 +0100 + +snapper (0.2.5-0) stable; urgency=low + + * Updated to version 0.2.5 + + -- Arvin Schnell Mon, 19 Jan 2015 16:05:14 +0100 + +snapper (0.2.4-0) stable; urgency=low + + * Updated to version 0.2.4 + + -- Arvin Schnell Mon, 15 Sep 2014 11:56:42 +0200 + +snapper (0.2.3-0) stable; urgency=low + + * Updated to version 0.2.3 + + -- Arvin Schnell Tue, 24 Jun 2014 11:22:40 +0200 + +snapper (0.2.2-0) stable; urgency=low + + * Updated to version 0.2.2 + + -- Arvin Schnell Wed, 16 Apr 2014 12:54:13 +0200 + +snapper (0.2.0-0) stable; urgency=low + + * Updated to version 0.2.0 + + -- Arvin Schnell Wed, 29 Jan 2014 16:56:45 +0100 + +snapper (0.1.8-0) stable; urgency=low + + * Updated to version 0.1.8 + + -- Arvin Schnell Tue, 3 Dec 2013 10:48:50 +0100 + +snapper (0.1.7-0) stable; urgency=low + + * Updated to version 0.1.7 + + -- Arvin Schnell Tue, 8 Oct 2013 13:43:52 +0200 + +snapper (0.1.6-0) stable; urgency=low + + * Updated to version 0.1.6 + + -- Arvin Schnell Fri, 6 Sep 2013 17:05:05 +0200 + +snapper (0.1.5-0) stable; urgency=low + + * Updated to version 0.1.5 + + -- Arvin Schnell Fri, 12 Jul 2013 10:53:14 +0200 + +snapper (0.1.4-0) stable; urgency=low + + * Updated to version 0.1.4 + + -- Arvin Schnell Fri, 24 May 2013 09:51:11 +0200 + +snapper (0.1.3-0) stable; urgency=low + + * Updated to version 0.1.3 + + -- Arvin Schnell Thu, 15 Apr 2013 16:29:34 +0200 + +snapper (0.1.2-0) stable; urgency=low + + * Updated to version 0.1.2 + + -- Arvin Schnell Mon, 11 Feb 2013 15:04:51 +0100 + +snapper (0.1.1-0) stable; urgency=low + + * Updated to version 0.1.1 + + -- Arvin Schnell Mon, 12 Nov 2012 16:42:06 +0100 + +snapper (0.1.0-0) stable; urgency=low + + * Updated to version 0.1.0 + + -- Arvin Schnell Mon, 15 Oct 2012 11:08:32 +0100 + +snapper (0.0.14-0) stable; urgency=low + + * Updated to version 0.0.14 + + -- Arvin Schnell Wed, 22 Aug 2012 18:49:42 +0100 + +snapper (0.0.13-0) stable; urgency=low + + * Updated to version 0.0.13 + + -- Arvin Schnell Thu, 26 Jul 2012 15:06:12 +0100 + +snapper (0.0.12-0) stable; urgency=low + + * Updated to version 0.0.12 + + -- Arvin Schnell Tue, 24 Jul 2012 15:07:31 +0100 + +snapper (0.0.11-0) stable; urgency=low + + * Updated to version 0.0.11 + + -- Arvin Schnell Thu, 14 Jun 2012 11:14:21 +0100 + +snapper (0.0.10-0) stable; urgency=low + + * Initial Debian package + + -- Arvin Schnell Tue, 19 Mar 2012 15:57:09 +0100 diff --git a/debian/debian.control b/debian/debian.control new file mode 100644 index 00000000..f94618f7 --- /dev/null +++ b/debian/debian.control @@ -0,0 +1,45 @@ +Source: snapper +Priority: optional +Section: admin +Maintainer: Arvin Schnell +Build-Depends: debhelper (>= 4.1.16), g++, libboost-dev, libboost-thread-dev, libboost-system-dev, libboost-test-dev, libxml2-dev, libz-dev, libdbus-1-dev, libpam-dev, xsltproc, docbook-xsl +Homepage: http://en.opensuse.org/Portal:Snapper + +Package: snapper +Priority: optional +Section: admin +Architecture: any +Depends: ${shlibs:Depends} +Description: snapper + This package contains snapper, a tool for filesystem snapshot management. + +Package: libsnapper +Priority: optional +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Description: snapper + This package contains libsnapper, a library for filesystem snapshot management. + +Package: libsnapper-dev +Priority: optional +Section: libdevel +Architecture: any +Description: snapper + This package contains header files and documentation for developing with + libsnapper. + +Package: snapper-zypp-plugin +Priority: optional +Section: admin +Architecture: any +Description: snapper + This package contains a plugin for zypp that makes filesystem snapshots with + snapper during commits. + +Package: libpam-snapper +Priority: optional +Section: admin +Architecture: any +Description: pam_snapper + A PAM module for calling snapper during user login and logout. diff --git a/debian/debian.libpam-snapper.install b/debian/debian.libpam-snapper.install new file mode 100644 index 00000000..e8957e2e --- /dev/null +++ b/debian/debian.libpam-snapper.install @@ -0,0 +1 @@ +lib/security/pam_snapper.so diff --git a/debian/debian.libpam-snapper.manpages b/debian/debian.libpam-snapper.manpages new file mode 100644 index 00000000..4773f27a --- /dev/null +++ b/debian/debian.libpam-snapper.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man8/pam_snapper.8 diff --git a/debian/debian.libsnapper-dev.install b/debian/debian.libsnapper-dev.install new file mode 100644 index 00000000..c217fe92 --- /dev/null +++ b/debian/debian.libsnapper-dev.install @@ -0,0 +1,3 @@ +usr/include/snapper +usr/lib/libsnapper.la +usr/lib/libsnapper.so diff --git a/debian/debian.libsnapper.install b/debian/debian.libsnapper.install new file mode 100644 index 00000000..52e37009 --- /dev/null +++ b/debian/debian.libsnapper.install @@ -0,0 +1,6 @@ +etc/snapper/config-templates +etc/snapper/configs +etc/snapper/filters +etc/sysconfig/snapper +usr/lib/libsnapper.so.* +usr/share/doc/packages/snapper diff --git a/debian/debian.rules b/debian/debian.rules new file mode 100644 index 00000000..cf15d01b --- /dev/null +++ b/debian/debian.rules @@ -0,0 +1,71 @@ +#!/usr/bin/make -f + +# Turn on verbose mode. +export DH_VERBOSE=1 + +# Set debhelper compatibility version. +export DH_COMPAT=5 + +CFLAGS = -g +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) +CFLAGS += -O0 -Wall +else +CFLAGS += -O2 -Wall +endif + +build: build-stamp +build-stamp: + dh_testdir + + ./configure --docdir=/usr/share/doc/packages/snapper --disable-silent-rules \ + --disable-ext4 --enable-xattrs --disable-rollback --disable-btrfs-quota + make + + make check + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + make clean || true + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + make install DESTDIR=/usr/src/packages/BUILD/debian/tmp + install -D -m 644 data/sysconfig.snapper /usr/src/packages/BUILD/debian/tmp/etc/sysconfig/snapper + +# Build architecture-independent files here. +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + + mv debian/tmp/etc/cron.hourly/suse.de-snapper debian/tmp/etc/cron.hourly/snapper + mv debian/tmp/etc/cron.daily/suse.de-snapper debian/tmp/etc/cron.daily/snapper + + dh_install --sourcedir=debian/tmp + dh_installman + dh_installchangelogs + dh_strip + dh_compress + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/debian.snapper-zypp-plugin.install b/debian/debian.snapper-zypp-plugin.install new file mode 100644 index 00000000..2d296944 --- /dev/null +++ b/debian/debian.snapper-zypp-plugin.install @@ -0,0 +1,2 @@ +usr/lib/zypp/plugins/commit/snapper.py +etc/snapper/zypp-plugin.conf diff --git a/debian/debian.snapper-zypp-plugin.manpages b/debian/debian.snapper-zypp-plugin.manpages new file mode 100644 index 00000000..018b2a5b --- /dev/null +++ b/debian/debian.snapper-zypp-plugin.manpages @@ -0,0 +1,2 @@ +debian/tmp/usr/share/man/man8/snapper-zypp-plugin.8 +debian/tmp/usr/share/man/man5/snapper-zypp-plugin.conf.5 diff --git a/debian/debian.snapper.install b/debian/debian.snapper.install new file mode 100644 index 00000000..f957310b --- /dev/null +++ b/debian/debian.snapper.install @@ -0,0 +1,8 @@ +etc/cron.daily/snapper +etc/cron.hourly/snapper +etc/dbus-1/system.d/org.opensuse.Snapper.conf +etc/logrotate.d/snapper +usr/bin/snapper +usr/sbin/snapperd +usr/share/dbus-1/system-services/org.opensuse.Snapper.service +usr/share/locale/*/LC_MESSAGES/snapper.mo diff --git a/debian/debian.snapper.manpages b/debian/debian.snapper.manpages new file mode 100644 index 00000000..03a75bc0 --- /dev/null +++ b/debian/debian.snapper.manpages @@ -0,0 +1,3 @@ +debian/tmp/usr/share/man/man8/snapper.8 +debian/tmp/usr/share/man/man8/snapperd.8 +debian/tmp/usr/share/man/man5/snapper-configs.5 diff --git a/debian/snapper.dsc.in b/debian/snapper.dsc.in new file mode 100644 index 00000000..0ffc23c0 --- /dev/null +++ b/debian/snapper.dsc.in @@ -0,0 +1,13 @@ +Format: 1.0 +Source: snapper +Version: @VERSION@ +Binary: snapper +Maintainer: Arvin Schnell +Architecture: any +Build-Depends: debhelper (>= 4.1.16), acl-dev, g++, libboost-dev, libboost-thread-dev, libboost-system-dev, libboost-test-dev, libxml2-dev, libz-dev, libdbus-1-dev, libpam-dev, xsltproc, docbook-xsl, locales-all +# +# The 'Files' line is generated during 'make debian-package': +# Files: +# 423a20ae6e882d44e65a4eff97f2269f 630905 snapper-0.2.8.tar.gz +# md5sum size filename +Files: diff --git a/package/.gitignore b/package/.gitignore index c29f158b..31ba2f3c 100644 --- a/package/.gitignore +++ b/package/.gitignore @@ -1,2 +1,4 @@ snapper-*.tar.bz2 snapper.spec +debian.* +*.dsc