[libgap-sage] 01/03: Improve get-orig-source machinery

Jerome Benoit calculus-guest at moszumanska.debian.org
Sat Nov 12 05:22:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

calculus-guest pushed a commit to branch master
in repository libgap-sage.

commit 4a534db38e0cb9be4996507fb20d0335ef3b0fae
Author: Jerome Benoit <calculus at rezozer.net>
Date:   Fri Nov 11 16:49:14 2016 +0000

    Improve get-orig-source machinery
---
 debian/changelog          | 13 ++++++++
 debian/control            |  6 ++--
 debian/copyright          | 26 +++++----------
 debian/get-orig-source.sh | 84 +++++++++++++++++++++++++++++++++++++----------
 debian/rules              | 35 ++++++++++++++++----
 5 files changed, 119 insertions(+), 45 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index aa0fda5..dc2fa72 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+libgap-sage (4.8.5+3+20160327g69a66f0+dsx-0) UNRELEASED; urgency=medium
+
+  * Debianization:
+    - debian/control, refresh;
+    - debian/rules, refresh and improve;
+    - debian/get-orig-source.sh:
+      - upstream GAP-core material, now fetch as-is directly from
+        http://www.gap-system.org/;
+      - upstream libGAP material, discard patched GAP-core material;
+    - debian/copyright, refresh and clarify.
+
+ -- Jerome Benoit <calculus at rezozer.net>  Sat, 12 Nov 2016 01:15:44 +0000
+
 libgap-sage (4.8.3+g69a66f0+dsx-1) experimental; urgency=medium
 
   * Initial release (Closes: #833406).
diff --git a/debian/control b/debian/control
index 096134c..13ad5d4 100644
--- a/debian/control
+++ b/debian/control
@@ -5,8 +5,7 @@ Maintainer: Debian Science Maintainers <debian-science-maintainers at lists.alioth.
 Uploaders: Jerome Benoit <calculus at rezozer.net>
 Build-Depends:
  debhelper (>= 9), gnulib, dh-autoreconf, libtool, python-ply,
- gap (>= 4r8p3-2),
-# gap (<< 4r8p4),
+ gap (>= 4r8p5), gap (<< 4r8p6),
  libgmp-dev
 Build-Depends-Indep:
 Standards-Version: 3.9.8
@@ -20,8 +19,7 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends:
- gap (>= 4r8p3-2),
-# gap (<< 4r8p4),
+ gap (>= 4r8p5), gap (<< 4r8p6),
  ${shlibs:Depends}, ${misc:Depends}
 Description: GAP kernel as a C shared library -- lib
  GAP is a system for computational group theory. LibGAP contains a shared
diff --git a/debian/copyright b/debian/copyright
index 479f02c..f79387f 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -20,24 +20,16 @@ Copyright:
  2011-2016 Volker Braun <vbraun.name at gmail.com>
 License: GPL-2+
 
-Files: src/*
+Files: gapcore/*
 Copyright:
  1996  Lehrstuhl D für Mathematik, RWTH Aachen, Germany
  1998 School Math and Comp. Sci., University of St Andrews, Scotland
  2002-2016 The GAP Group
 License: GPL-2+
 Comment:
- Ideally these source files must be discarded from the Debian Source, but
- it appears that the provided patch is partial (unfortunately).
-
-Files:
- src/libgap.c
- src/libgap.h
- src/libgap_internal.h
- src/Makefile.am
-Copyright:
- 2013-2016 Volker Braun <vbraun.name at gmail.com>
-License: GPL-2+
+ This folder contains the upstream GAP-core material that is needed to build
+ the libGAP library. It was fetched as-is by debian/get-orig-source.sh from
+ http://www.gap-system.org/ .
 
 Files:
  pkgextra/doc/libGAP.pdf
@@ -49,7 +41,7 @@ Comment:
  At the time of packaging, it is the only document available around that gives
  an useful overview of the libGAP library; it was not composed by a friends of
  TeX but of Google, so it cannot be easily regenerated. It was fetched as-is by
- hand from https://bitbucket.org/vbraun/libgap/downloads .
+ debian/get-orig-source.sh from https://bitbucket.org/vbraun/libgap/downloads .
 
 Files:
  pkgextra/GitChangeLog
@@ -58,9 +50,9 @@ Copyright:
 License: public-domain
  This file is public domain and come with NO WARRANTY of any kind.
 Comment:
- This file was generated by hand from a local clone of the upstream git
- repository in order to provide a meaningful alternative to the upstream
- ChangeLog which is empty.
+ This file was generated by debian/get-orig-source.sh from a local clone of
+ the upstream git repository in order to provide a meaningful alternative to
+ the upstream ChangeLog which is empty.
 
 Files: debian/*
 Copyright:
@@ -82,4 +74,4 @@ License: GPL-2+
  along with this program. If not, see <http://www.gnu.org/licenses/>.
  .
  On Debian systems, the complete text of the GNU General Public License
- version 2 can be found in "/usr/share/common-licenses/GPL-2".
+ version 2 can be found in `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/get-orig-source.sh b/debian/get-orig-source.sh
index cbdc937..d74695f 100755
--- a/debian/get-orig-source.sh
+++ b/debian/get-orig-source.sh
@@ -6,18 +6,39 @@ set -e
 set -u
 
 usage() {
-	echo "Usage: ${0##*/} --upstream-version <ver> --upstream-commit-id <commit id>"
+	echo "Usage: ${0##*/} --upstream-libgap-xversion <xver> --upstream-libgap-commit-epoch <commit epoch>"
 	exit 1
 	}
 
 if [ "$#" != "4" ]; then
 	usage
 fi
-if [  "$1" != "--upstream-version" -o "$3" != "--upstream-commit-id" ]; then
+if [  "$1" != "--upstream-libgap-xversion" -o "$3" != "--upstream-libgap-commit-epoch" ]; then
 	usage
 fi
-UPSTREAM_VERSION="$2"
-UPSTREAM_COMMIT_ID=$4
+UPSTREAM_XVERSION="$2"
+UPSTREAM_COMMIT_EPOCH=$4
+
+UPSTREAM_GAP_DOTVERSION=${UPSTREAM_XVERSION%%+*}
+UPSTREAM_LGP_VERSION_NANO=${UPSTREAM_XVERSION##*+}
+
+UPSTREAM_GAP_VERSION_MAJOR=${UPSTREAM_GAP_DOTVERSION%%.*}
+UPSTREAM_GAP_VERSION_MINOR=${UPSTREAM_GAP_DOTVERSION#*.}
+UPSTREAM_GAP_VERSION_MINOR=${UPSTREAM_GAP_VERSION_MINOR%%.*}
+UPSTREAM_GAP_VERSION_MICRO=${UPSTREAM_GAP_DOTVERSION#*.*.}
+UPSTREAM_GAP_VERSION_MICRO=${UPSTREAM_GAP_VERSION_MICRO%%.*}
+
+UPSTREAM_COMMIT_DATE=${UPSTREAM_COMMIT_EPOCH%%g*}
+UPSTREAM_COMMIT_ID=${UPSTREAM_COMMIT_EPOCH##*g}
+
+UPSTREAM_VERSION="${UPSTREAM_GAP_VERSION_MAJOR}.${UPSTREAM_GAP_VERSION_MINOR}.${UPSTREAM_LGP_VERSION_NANO}"
+UPSTREAM_GAP_RELEASE="${UPSTREAM_GAP_VERSION_MAJOR}r${UPSTREAM_GAP_VERSION_MINOR}"
+UPSTREAM_GAP_RELEASE_PATCH=${UPSTREAM_GAP_VERSION_MICRO}
+UPSTREAM_GAP_VERSION="${UPSTREAM_GAP_RELEASE}p${UPSTREAM_GAP_RELEASE_PATCH}"
+
+##echo "UPSTREAM_XVERSION:     ${UPSTREAM_XVERSION} (libgap_version=${UPSTREAM_VERSION}; gap_version=${UPSTREAM_GAP_VERSION}; gap_dotversion=${UPSTREAM_GAP_DOTVERSION})"
+##echo "UPSTREAM_COMMIT_EPOCH: ${UPSTREAM_COMMIT_EPOCH} (date=${UPSTREAM_COMMIT_DATE}; id=${UPSTREAM_COMMIT_ID})"
+##exit 0
 
 if [ ! -e debian/changelog ]; then
 	echo 1>&2 "nonexitent debian/changelog file"
@@ -25,10 +46,11 @@ if [ ! -e debian/changelog ]; then
 fi
 
 UPSTREAM_REPO="https://bitbucket.org/vbraun/libgap"
+UPSTREAM_GAPCORE_REPO="http://www.gap-system.org/pub/gap/gap${UPSTREAM_GAP_VERSION_MAJOR}core"
 
-DEBIAN_SUFFIX="+g${UPSTREAM_COMMIT_ID}+dsx"
+DEBIAN_SUFFIX="+${UPSTREAM_COMMIT_EPOCH}+dsx"
 
-DEBIAN_UVERSION=${UPSTREAM_VERSION}${DEBIAN_SUFFIX}
+DEBIAN_UVERSION=${UPSTREAM_XVERSION}${DEBIAN_SUFFIX}
 DEBIAN_ROOTFOLDERNAME="${PACKAGE_NAME}-${DEBIAN_UVERSION}.orig"
 DEBIAN_TARBALLXZ="$(realpath ..)/${PACKAGE_NAME}_${DEBIAN_UVERSION}.orig.tar.xz"
 
@@ -47,27 +69,52 @@ message() {
 
 
 UPSTREAM_GITFOLDER=${GOS_TMPDIR}/GITFOLDER
+UPSTREAM_GAPCOREFOLDER=${GOS_TMPDIR}/GAPCOREFOLDER
 UPSTREAM_ROOTFOLDER=${GOS_TMPDIR}/unpacked
 EXTRA_ROOTFOLDER=${GOS_TMPDIR}/pkgextra
+GAPCORE_ROOTFOLDER=${GOS_TMPDIR}/gapcore
+
+GAPCOREBALLFOLDERNAME="gap${UPSTREAM_GAP_RELEASE}"
+GAPCOREZIPBALL="gap${UPSTREAM_GAP_VERSION}_nopackages.zip"
 
 message "Cloning"
 
 git clone git at bitbucket.org:vbraun/libgap.git ${UPSTREAM_GITFOLDER}
 
 
+message "Fetching GAP-core zipball"
+
+mkdir ${UPSTREAM_GAPCOREFOLDER}
+cd ${UPSTREAM_GAPCOREFOLDER}
+wget "${UPSTREAM_GAPCORE_REPO}/${GAPCOREZIPBALL}"
+
+
+message "Extracting GAP-core relevant material"
+mkdir ${GAPCORE_ROOTFOLDER}
+cd ${GAPCORE_ROOTFOLDER}
+unzip "${UPSTREAM_GAPCOREFOLDER}/${GAPCOREZIPBALL}" "${GAPCOREBALLFOLDERNAME}/src/*"
+mv ${GAPCOREBALLFOLDERNAME} ${GAPCOREBALLFOLDERNAME}p${UPSTREAM_GAP_RELEASE_PATCH}
+
+
 message "Fetching extra material"
 
 mkdir ${EXTRA_ROOTFOLDER}
 cd ${EXTRA_ROOTFOLDER}
 mkdir doc
 cd doc
-wget https://bitbucket.org/vbraun/libgap/downloads/libGAP.pdf
+wget ${UPSTREAM_REPO}/downloads/libGAP.pdf
 
 
 message "Packaging"
 
 mkdir ${UPSTREAM_ROOTFOLDER}
 cd ${UPSTREAM_GITFOLDER}
+EFFECTIVE_UPSTREAM_COMMIT_UNIXEPOCH=$(git show -s --format=%ct ${UPSTREAM_COMMIT_ID})
+EFFECTIVE_UPSTREAM_COMMIT_DATE=$(date -u +%Y%m%d -d @${EFFECTIVE_UPSTREAM_COMMIT_UNIXEPOCH})
+if [ "${EFFECTIVE_UPSTREAM_COMMIT_DATE}" != "${UPSTREAM_COMMIT_DATE}" ]; then
+	echo 1>&2 "inconsistent given commit date (expected ${UPSTREAM_COMMIT_DATE} but observed ${EFFECTIVE_UPSTREAM_COMMIT_DATE})"
+	exit 64
+fi
 git archive --prefix="${DEBIAN_ROOTFOLDERNAME}/" --format=tar ${UPSTREAM_COMMIT_ID} | tar -C ${UPSTREAM_ROOTFOLDER} -xf -
 git log --date iso ${UPSTREAM_COMMIT_ID} > ${EXTRA_ROOTFOLDER}/GitChangeLog
 
@@ -103,22 +150,25 @@ find . -name 'Makefile.in' | xargs --no-run-if-empty rm --verbose --force
 rm --verbose --force -- src/config.h.in
 rm --verbose --force -- aclocal.m4
 rm --verbose --force -- configure
-## discard obsolete patches
+## discard undesirable patches
 find patches -type f -a -not -name gap-${UPSTREAM_VERSION}.patch | xargs --no-run-if-empty rm --verbose --force
-#### discard non-libGAP source files
-## comment: it appears that some modifications were patched, so this part is commented out
-##for _g in $(find src/ -type f); do
-##	if $(grep --quiet --ignore-case --max-count=1 'libGAP' $_g); then
-##	 :
-##	else
-##		rm --verbose --force -- ${_g}
-##	fi
-##done
+## discard non-libGAP source files
+for _g in $(find src/ -type f); do
+	if $(grep --quiet --max-count=1 'LibGAP' $_g); then
+	 :
+	else
+		case ${_g##*/} in
+			gap_version.h|Makefile.am) ;;
+			*) rm --verbose --force -- ${_g} ;;
+		esac
+	fi
+done
 #:
 cd ${GOS_WORKING_FOLDER}
 set +f
 mv ${UPSTREAM_ROOTFOLDER} ${DEBIAN_ROOTFOLDER}
 
+cp -prd ${GAPCORE_ROOTFOLDER} ${DEBIAN_ROOTFOLDER}
 cp -prd ${EXTRA_ROOTFOLDER} ${DEBIAN_ROOTFOLDER}
 
 GOS_TARBALL="${GOS_TMPDIR}/repacked.tar"
diff --git a/debian/rules b/debian/rules
index f4dedc2..fbcd8ef 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,11 +5,22 @@ CGAP = /usr/bin/gap
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 
 DEB_PKG_VERSION := $(shell dpkg-parsechangelog -S Version)
-DEB_SRC_VERSION := $(firstword $(subst -, ,$(DEB_PKG_VERSION)))
-UPS_PKG_VERSION := $(firstword $(subst +, ,$(DEB_SRC_VERSION)))
-UPS_PKG_GITCOMMIT := $(subst g,,$(filter g%,$(subst +, ,$(DEB_SRC_VERSION))))
+DEB_PKG_DOTVERSION :=   $(word 1,$(subst +, ,$(DEB_PKG_VERSION)))
+DEB_PKG_VERSION_NANO := $(word 2,$(subst +, ,$(DEB_PKG_VERSION)))
+UPS_PKG_GIT_EPOCH :=    $(word 3,$(subst +, ,$(DEB_PKG_VERSION)))
+
+DEB_PKG_VERSION_MAJOR := $(word 1,$(subst ., ,$(DEB_PKG_DOTVERSION)))
+DEB_PKG_VERSION_MINOR := $(word 2,$(subst ., ,$(DEB_PKG_DOTVERSION)))
+DEB_PKG_VERSION_MICRO := $(word 3,$(subst ., ,$(DEB_PKG_DOTVERSION)))
+
+UPS_PKG_VERSION :=         $(DEB_PKG_VERSION_MAJOR).$(DEB_PKG_VERSION_MINOR).$(DEB_PKG_VERSION_NANO)
+DEB_PKG_GAP_DOTVERSION :=  $(DEB_PKG_VERSION_MAJOR).$(DEB_PKG_VERSION_MINOR).$(DEB_PKG_VERSION_MICRO)
+DEB_PKG_GAP_VERSION :=     $(DEB_PKG_VERSION_MAJOR)r$(DEB_PKG_VERSION_MINOR)p$(DEB_PKG_VERSION_MICRO)
+DEB_PKG_LIBGAP_XVERSION := $(DEB_PKG_GAP_DOTVERSION)+$(DEB_PKG_VERSION_NANO)
+
 DEB_BUILD_GAP_BUILD_DATETIME := $(shell LC_ALL=C date -u -d @$(SOURCE_DATE_EPOCH) +"%F %T (%Z) (Debian $(DEB_PKG_VERSION))")
 
+
 export DEB_BUILD_MULTIARCH ?= $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)
 DEB_BUILD_GAP_INFO_ARCH ?= $(shell echo 'Print(GAPInfo.Architecture);' | $(CGAP) -q -A -T)
 
@@ -26,11 +37,13 @@ override_dh_auto_configure:
 	# amble:
 	dh_auto_configure -B _build -- --with-gap_system_arch=$(DEB_BUILD_GAP_INFO_ARCH)
 	# postamble: based on the dist-hook target.
-	cp -t _build/src $(wildcard src/*.h src/*.c src/*.s)
+	cp -t _build/src $(wildcard $(addprefix gapcore/gap$(DEB_PKG_GAP_VERSION)/src/,*.h *.c *.s))
+	cp -t _build/src $(wildcard $(addprefix src/,*.h *.c))
+	patch --directory _build/src --strip 1 < patches/gap-$(UPS_PKG_VERSION).patch
 	scripts/libGAPify.py --modify _build/src
-	sed -i -e 's/SyKernelVersion = "[0-9]*\.[0-9]*\.[0-9]*"/SyKernelVersion = "$(UPS_PKG_VERSION)"/g' _build/src/system.c
+	sed -i -e 's/SyKernelVersion = "[0-9]*\.[0-9]*\.[0-9]*"/SyKernelVersion = "$(DEB_PKG_GAP_DOTVERSION)"/g' _build/src/system.c
 	sed -i \
-			-e 's/GAP_BUILD_VERSION  "libgap-[0-9]*\.[0-9]*\.[0-9]*"/GAP_BUILD_VERSION  "libgap-$(UPS_PKG_VERSION)"/g' \
+			-e 's/GAP_BUILD_VERSION  "libgap-[0-9]*\.[0-9]*\.[0-9]*"/GAP_BUILD_VERSION  "libgap-$(DEB_PKG_GAP_DOTVERSION)"/g' \
 			-e 's/GAP_BUILD_DATETIME "\(.*\)"/GAP_BUILD_DATETIME "$(DEB_BUILD_GAP_BUILD_DATETIME)"/g' \
 		_build/src/gap_version.h
 	$(foreach _t, $(wildcard test/*.c) , sed -f debian/adhoc/scripts/libGAPify-test.sed $(_t) > _build/$(_t) ;)
@@ -51,4 +64,12 @@ override_dh_compress-indep:
 	dh_compress -X.pdf -Xexamples
 
 get-orig-source:
-	debian/get-orig-source.sh --upstream-version $(UPS_PKG_VERSION) --upstream-commit-id $(UPS_PKG_GITCOMMIT)
+	debian/get-orig-source.sh --upstream-libgap-xversion $(DEB_PKG_LIBGAP_XVERSION) --upstream-libgap-commit-epoch $(UPS_PKG_GIT_EPOCH)
+
+get-info:
+	@echo "DEB_PKG_VERSION:         $(DEB_PKG_VERSION)"
+	@echo "UPS_PKG_VERSION:         $(UPS_PKG_VERSION)"
+	@echo "UPS_PKG_GIT_EPOCH:       $(UPS_PKG_GIT_EPOCH)"
+	@echo "DEB_PKG_GAP_DOTVERSION:  $(DEB_PKG_GAP_DOTVERSION)"
+	@echo "DEB_PKG_GAP_VERSION:     $(DEB_PKG_GAP_VERSION)"
+	@echo "DEB_PKG_LIBGAP_XVERSION: $(DEB_PKG_LIBGAP_XVERSION)"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libgap-sage.git



More information about the debian-science-commits mailing list