Tweaks to making a source tarball from SVN (both for gnustep-make and other

dependant packages), allowing revision-based and time-based version stamps.
Tweaks to producing Debian packages switching to a multistep procedure that
requries: making a source tarball, making debfiles, then finally making the
deb source and binary package.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@37841 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Ivan Vučica 2014-05-06 01:29:07 +00:00
parent 1ca2a7c7a0
commit ff88759bb4
5 changed files with 148 additions and 42 deletions

View file

@ -1,3 +1,40 @@
2014-05-06 Ivan Vucica <ivan@vucica.net>
* GNUmakefile.in: Tarball may now have the SVN revision and
date appended to its version. This is done for svn-snapshot
and svn-export targets to ensure we have a 'unique' .orig.tar.gz
for uploading to the Launchpad PPA. The full name of the tarball
will be saved in a text file usable by scripts.
Tarball also has to be explicitly and separately produced and
optionally specifying DEB_TARBALL_VERSION when building a Debian
package.
Debian control files now can (and need to) be separately built
using the target debfiles.
* Master/source-distribution.make: Similarly to how gnustep-make
can export working copy as a tarball, the target svn-export has
been added to other GNUmakefiles.
Introduced TARBALL_VERSION as an overridable version string in
the tarball name.
Environment variables TARBALL_VERSION_INCLUDE_SVN_REVISION and
TARBALL_VERSION_INCLUDE_DATE_TIME now allow expanding the
tarball version with the svn revision and date+time.
Instead of EXPORT_SVN_NAME, now specifying entire EXPORT_SVN_URL
so that svn-export can specify '.'.
* Master/deb.make: Switched to use of TARBALL_VERSION as the
definitive version string in tarball name.
Added debclean target.
User now has to explicitly make a choice how the dist tarball
will be produced.
Depending on the method, tarball may be placed in the current
or parent directory, so we detect that (and prefer the current
directory).
* bake_debian_files: Now defaulting to target_arch=any so that
the package gets built on all platforms when uploaded on Launchpad,
instead of detecting an arch from gnustep-make and burning that
arch into the source package.
Added support for TARBALL_VERSION.
Fixed a 'command not found' error.
2014-05-05 Ivan Vucica <ivan@vucica.net>
* GNUmakefile.in: Separately building source and binary package,

View file

@ -169,6 +169,18 @@ else
DEBUILD_ARGS = -us -uc -nc
endif
# Version code that will be used in 'svn-export' target. Expand immediately;
# it should be constant in the script.
DATE_TIME_VERSION := $(shell date +%Y.%m.%d.%H.%M)
# Revision; potentially expensive so expand when used.
SVN_REVISION = $(shell svn info . | sed -ne 's/^Revision: //p')
# Used to override version of .tar.gz that will be copied and used as .orig.tar.gz.
ifeq ($(DEB_TARBALL_VERSION), )
DEB_TARBALL_VERSION = $(GNUSTEP_MAKE_VERSION)
endif
all: generated-files
$(EC)(echo "Thanks. All is ready: type '$(MAKE) install' to install gnustep-make.")
@ -374,18 +386,18 @@ svn-dist:
svn-snapshot:
svn export $(SVNPREFIX)/trunk \
gnustep-make-$(GNUSTEP_MAKE_VERSION)
tar --gzip -cf gnustep-make-$(GNUSTEP_MAKE_VERSION).tar.gz gnustep-make-$(GNUSTEP_MAKE_VERSION)
rm -rf gnustep-make-$(GNUSTEP_MAKE_VERSION)
gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION)
tar --gzip -cf gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION).tar.gz gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION)
echo $(GNUSTEP_MAKE_VERSION).$(SVN_REVISION) > svn-snapshot-tarball-version
rm -rf gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION)
svn-export:
@echo Note: any local changes are included.
svn export . \
gnustep-make-$(GNUSTEP_MAKE_VERSION)
tar --gzip -cf gnustep-make-$(GNUSTEP_MAKE_VERSION).tar.gz gnustep-make-$(GNUSTEP_MAKE_VERSION)
rm -rf gnustep-make-$(GNUSTEP_MAKE_VERSION)
dist: svn-export
gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION).$(DATE_TIME_VERSION)
tar --gzip -cf gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION).$(DATE_TIME_VERSION).tar.gz gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION).$(DATE_TIME_VERSION)
echo $(GNUSTEP_MAKE_VERSION).$(SVN_REVISION).$(DATE_TIME_VERSION) > svn-export-tarball-version
rm -rf gnustep-make-$(GNUSTEP_MAKE_VERSION).$(SVN_REVISION).$(DATE_TIME_VERSION)
cvs-tag:
cvs -z3 rtag make-$(VERTAG) make
@ -429,18 +441,33 @@ rpm: test-RPM_TOPDIR svn-dist
fi; \
$${rpmbuild} -ba gnustep-make.spec
deb: debian_dist/gnustep-make_$(GNUSTEP_MAKE_VERSION)_all.deb
debian_dist/gnustep-make_$(GNUSTEP_MAKE_VERSION)_all.deb: dist
debclean:
-rm -rf debian_dist
deb: debian_dist/gnustep-make_$(DEB_TARBALL_VERSION)_any.deb
debian_dist/gnustep-make_$(DEB_TARBALL_VERSION)_any.deb: debfiles
cd debian_dist/gnustep-make-$(DEB_TARBALL_VERSION)/ && EDITOR=/bin/true dpkg-source --commit -q . gnustep-make-automatic
cd debian_dist/gnustep-make-$(DEB_TARBALL_VERSION)/ && debuild $(DEBUILD_ARGS) -S
cd debian_dist/gnustep-make-$(DEB_TARBALL_VERSION)/ && debuild $(DEBUILD_ARGS) -b
debfiles: debian_dist/gnustep-make_$(DEB_TARBALL_VERSION).orig.tar.gz
cd debian_dist && tar xfz gnustep-make_$(DEB_TARBALL_VERSION).orig.tar.gz
PACKAGE_NAME="gnustep-make" VERSION=$(DEB_TARBALL_VERSION) DEB_MAINTAINER="GNUstep Developers <gnustep-dev@gnu.org>" DEB_ARCHITECTURE=any /bin/bash bake_debian_files.sh debian_dist/gnustep-make-$(DEB_TARBALL_VERSION)/
# Manual export is required to permit user to override .orig.tar.gz during the build process.
# We also allow user to make a choice of where to grab .orig.tar.gz from.
debian_dist/gnustep-make_$(DEB_TARBALL_VERSION).orig.tar.gz:
$(EC)(if [ ! -e gnustep-make-$(DEB_TARBALL_VERSION).tar.gz ] ; then \
echo "Please manually create gnustep-make-$(DEB_TARBALL_VERSION).tar.gz." ; \
echo "Some available make targets:" ; \
echo " * svn-dist" ; \
echo " * svn-snapshot" ; \
echo " * svn-export" ; \
fi)
mkdir -p debian_dist
cp gnustep-make-$(GNUSTEP_MAKE_VERSION).tar.gz debian_dist/gnustep-make_$(GNUSTEP_MAKE_VERSION).orig.tar.gz
cd debian_dist && tar xfz gnustep-make_$(GNUSTEP_MAKE_VERSION).orig.tar.gz
PACKAGE_NAME="gnustep-make" VERSION=$(GNUSTEP_MAKE_VERSION) DEB_MAINTAINER="GNUstep Developers <gnustep-dev@gnu.org>" DEB_ARCHITECTURE=all /bin/bash bake_debian_files.sh debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/
cd debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/ && dpkg-source --commit -q
cd debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/ && debuild $(DEBUILD_ARGS) -S
cd debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/ && debuild $(DEBUILD_ARGS) -b
# rm -rf debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)
cp gnustep-make-$(DEB_TARBALL_VERSION).tar.gz debian_dist/gnustep-make_$(DEB_TARBALL_VERSION).orig.tar.gz
generated-files: GNUmakefile GNUstep.sh GNUstep.csh fixpath.sh config-noarch.make config.make \
openapp opentool gnustep-make.spec executable.template gnustep-config \

View file

@ -54,7 +54,10 @@ endif
_DEB_ARCH=$(GNUSTEP_TARGET_CPU) # $(shell (/bin/bash -c "$(CC) -dumpmachine | sed -e 's,\\([^-]*\\).*,\\1,g'"))
_DEB_LOWERCASE_PACKAGE_NAME=$(shell (echo $(PACKAGE_NAME) | sed -e 's/\(.*\)/\L\1/'))
_DEB_VERSION=$(PACKAGE_VERSION)
_DEB_VERSION=$(TARBALL_VERSION)
ifeq ($(_DEB_VERSION), )
_DEB_VERSION=$(PACKAGE_VERSION)
endif
ifeq ($(_DEB_VERSION), )
_DEB_VERSION=$(VERSION)
endif
@ -77,6 +80,8 @@ else
DEBUILD_ARGS = -us -uc -nc
endif
_DEB_TARBALL = $(shell (test -e $(VERSION_NAME).tar.gz && echo $(VERSION_NAME).tar.gz) || \
(test -e ../$(VERSION_NAME).tar.gz && echo ../$(VERSION_NAME).tar.gz))
###
@ -88,11 +93,16 @@ _debenv.phony::
-rm _debenv
_DEB_SHOULD_EXPORT=1 make _debenv
# Order is important; we want debfiles to be done first so ./configure
# is not unnecessarily run during submake.
../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz: | _debenv.phony dist
debclean::
-rm _debenv
-rm -rf $(_ABS_OBJ_DIR)/debian_dist
deb-prep:: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
debfiles:: _debenv.phony
$(ECHO_NOTHING)(if [ -z "$(_DEB_TARBALL)" ] || [ ! -e "$(_DEB_TARBALL)" ] ; then \
echo "No tarball found. Please produce it manually using a target such as dist, svn-dist, " ; \
echo "svn-bugfix, svn-snapshot or svn-export." ; \
exit 1 ; \
fi)$(END_ECHO)
$(ECHO_NOTHING)echo "Baking deb control files ("$(GNUSTEP_TARGET_CPU)")..."$(END_ECHO)
/bin/bash -c ". _debenv && mkdir -p $(_ABS_OBJ_DIR)/debian_files && $(GNUSTEP_MAKEFILES)/bake_debian_files.sh $(_ABS_OBJ_DIR)/debian_files"
-rm _debenv
@ -100,18 +110,17 @@ deb-prep:: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
$(ECHO_NOTHING)echo "Preparing directory layout for building deb package..."$(END_ECHO)
-rm -rf $(_ABS_OBJ_DIR)/debian_dist
mkdir -p $(_ABS_OBJ_DIR)/debian_dist
cp ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz $(_ABS_OBJ_DIR)/debian_dist/$(_DEB_ORIGTARNAME).orig.tar.gz
cp $(_DEB_TARBALL) $(_ABS_OBJ_DIR)/debian_dist/$(_DEB_ORIGTARNAME).orig.tar.gz
cd $(_ABS_OBJ_DIR)/debian_dist && tar xfz $(_DEB_ORIGTARNAME).orig.tar.gz
mkdir -p $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian
mv $(_ABS_OBJ_DIR)/debian_files/debian/* $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian
mkdir -p $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/debian
mv $(_ABS_OBJ_DIR)/debian_files/debian/* $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/debian
-rm -rf $(_ABS_OBJ_DIR)/debian_files
deb:: deb-prep
deb:: debfiles
$(ECHO_NOTHING)echo "Building Debian package..."$(END_ECHO)
cd $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ && debuild $(DEBUILD_ARGS) -S
cd $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ && debuild $(DEBUILD_ARGS) -b
cd $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/ && debuild $(DEBUILD_ARGS) -S
cd $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/ && debuild $(DEBUILD_ARGS) -b
#
else

View file

@ -137,7 +137,26 @@ endif
endif # COMPRESSION
VERSION_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
# Due to peculiarities of some packaging systems or package distribution
# systems, we may want to permit customization of tarball version string.
ifeq ($(TARBALL_VERSION), )
TARBALL_VERSION := $(PACKAGE_VERSION)
endif
ifeq ($(TARBALL_VERSION_INCLUDE_SVN_REVISION), yes)
# Revision; potentially expensive so expand when used.
SVN_REVISION = $(shell svn info . | sed -ne 's/^Revision: //p')
TARBALL_VERSION := $(TARBALL_VERSION).$(SVN_REVISION)
endif
ifeq ($(TARBALL_VERSION_INCLUDE_DATE_TIME), yes)
# Expand immediately; it should be constant in the script.
DATE_TIME_VERSION := $(shell date +%Y.%m.%d.%H.%M)
TARBALL_VERSION := $(TARBALL_VERSION).$(DATE_TIME_VERSION)
endif
VERSION_NAME = $(PACKAGE_NAME)-$(TARBALL_VERSION)
ARCHIVE_FILE = $(VERSION_NAME).tar$(COMPRESSION_EXT)
@ -207,29 +226,35 @@ svn-tag:
# Build a .tar.gz from the SVN sources using revision/tag
# $(SVN_TAG_NAME)-$(VERTAG) as for a new release of the package.
#
svn-dist: EXPORT_SVN_NAME = tags/$(SVN_TAG_NAME)-$(VERTAG)
svn-dist: EXPORT_SVN_URL = $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/tags/$(SVN_TAG_NAME)-$(VERTAG)
svn-dist: internal-svn-export
#
# Build a .tar.gz from the SVN source from the stable branch
# as a bugfix release.
#
svn-bugfix: EXPORT_SVN_NAME = branches/stable
svn-bugfix: EXPORT_SVN_URL = $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/branches/stable
svn-bugfix: internal-svn-export
#
# Build a .tar.gz from the SVN source as they are now
#
svn-snapshot: EXPORT_SVN_NAME = trunk
svn-snapshot: EXPORT_SVN_URL = $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/trunk
svn-snapshot: internal-svn-export
#
# Build a .tar.gz from the local SVN tree
#
svn-export: EXPORT_SVN_URL = .
svn-export: internal-svn-export
internal-svn-export:
$(ECHO_NOTHING)echo "Exporting from module $(SVN_MODULE_NAME) on SVN..."; \
if [ -e $(VERSION_NAME) ]; then \
echo "*Error* cannot export: $(VERSION_NAME) already exists"; \
exit 1; \
fi; \
$(SVN) export $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/$(EXPORT_SVN_NAME) $(VERSION_NAME); \
$(SVN) export $(EXPORT_SVN_URL) $(VERSION_NAME); \
echo "Generating $(ARCHIVE_FILE)"; \
if [ -f $(ARCHIVE_FILE) ]; then \
echo "$(ARCHIVE_FILE) already exists:"; \

View file

@ -39,11 +39,18 @@ distrib_id="$(grep DISTRIB_ID /etc/lsb-release | sed 's/DISTRIB_ID=\(.*\)$/\1/')
if [[ "${distrib_id}" == "Ubuntu" ]] ; then
default_distribution=$(grep DISTRIB_CODENAME /etc/lsb-release | sed 's/DISTRIB_CODENAME=//')
fi
target_arch=${GNUSTEP_TARGET_CPU:-any}
if [[ "${target_arch}" == "i686" ]] ; then
target_arch=i386
elif [[ "${target_arch}" == "x86_64" ]] ; then
target_arch=amd64
if true ; then
# Forcing 'any' as we'd like Launchpad to build packages for all architectures.
# DEB_ARCHITECTURE can still be overridden.
target_arch=any
else
target_arch=${GNUSTEP_TARGET_CPU:-any}
if [[ "${target_arch}" == "i686" ]] ; then
target_arch=i386
elif [[ "${target_arch}" == "x86_64" ]] ; then
target_arch=amd64
fi
fi
PACKAGE_VERSION=${PACKAGE_VERSION:-${VERSION}}
@ -53,7 +60,7 @@ DEB_ARCHITECTURE=${DEB_ARCHITECTURE:-${target_arch}} #$(shell (/bin/bash -c "$(C
DEB_SECTION=${DEB_SECTION:-gnustep}
DEB_PRIORITY=${DEB_PRIORTY:-optional}
DEB_VCS_SVN=${DEB_VCS_SVN:-${svn_path}}
DEB_VERSION=${DEB_VERSION:-${PACKAGE_VERSION}}
DEB_VERSION=${DEB_VERSION:-${TARBALL_VERSION:-${PACKAGE_VERSION}}}
if [ -z "${DEB_BUILD_DEPENDS}" ] ; then
DEB_BUILD_DEPENDS="debhelper (>= 9), cdbs"
else
@ -319,12 +326,13 @@ ifneq (${PACKAGE_NAME}, gnustep-make)
ifneq (\$(GNUSTEP_MAKEFILES), )
DEB_MAKE_ENVVARS += \$(shell sh -c ". \$(GNUSTEP_MAKEFILES)/GNUstep.sh && env |grep GNUSTEP")
else
$(error Failed to get GNUSTEP_MAKEFILES variable. Is gnustep-config properly installed?)
\$(error Failed to get GNUSTEP_MAKEFILES variable. Is gnustep-config properly installed?)
exit 1
endif
endif
_EOF
chmod 755 "${destination}"/rules
##########