[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: X Strike Force XFree86 SVN commit: r1320 - in people/fabbione/trunk/debian: . patches



On Tue, 27 Apr 2004, X Strike Force SVN Repository Admin wrote:

> Author: fabbione
> Date: 2004-04-27 10:27:22 -0500 (Tue, 27 Apr 2004)
> New Revision: 1320
>
> Added:
>    people/fabbione/trunk/debian/patches/914_debian_donot_build_fonts
> Modified:
>    people/fabbione/trunk/debian/rules
> Log:
> Do not build fonts when build is triggered via dpkg-buildpackage -B
> (common to all buildd)
>

Small comments about this commit. Note that it is not in trunk and it is
up for discussion and improvement.

Target of this commit as specified in the Log: above

Analysis:
In order to not build fonts we need to be sure that host.def will contain
#define BuildFonts NO

Despite the fact that there might be better way to do so, this is one of
them, others and probably betters can come later on by more experienced
people. (Branded, does this ring a bell? ;))

Tested solution (or possible solution):

The patch move the check for $(TOP)/fonts/Imakefile from the
BuildServersOnly scope to a global scope that will be used as a on/off
trigger from debian/rules.

> Modified: people/fabbione/trunk/debian/rules
> ===================================================================
> --- people/fabbione/trunk/debian/rules	2004-04-27 10:38:22 UTC (rev 1319)
> +++ people/fabbione/trunk/debian/rules	2004-04-27 15:27:22 UTC (rev 1320)
> @@ -137,7 +137,7 @@
>  	dh_testdir
>  	rm -rf $(STAMP_DIR) $(SOURCE_DIR)
>  	perl $(SCRIPT_DIR)/dbs_split clean
> -	rm -rf imports debian/local/xlibmesa-drm-source/modules
> +	rm -rf imports debian/local/xlibmesa-drm-source/modules debian/build-fonts

the trigger is a file (easy and lazy) called debian/build-fonts and of
course it needs to be removed on clean:

> @@ -201,9 +201,13 @@
>  	touch $@
>
>  # DO NOT CHANGE THIS RULE WITHOUT CHECKING FOR SYNCHRONICITY WITH THE build-server RULE BELOW
> -build: $(STAMP_DIR)/stamp-build
> +real-build: $(STAMP_DIR)/stamp-build

The build: target needs to be changed so the old one is renamed to
real-build (see below for details)

>  $(STAMP_DIR)/stamp-build: $(STAMP_DIR)/patch-audit $(STAMP_DIR)/genscripts
>  	dh_testdir
> +	# check if we need to build fonts
> +	if [ ! -e debian/build-fonts ]; then \
> +	    mv -f $(SOURCE_TREE)/fonts/Imakefile $(SOURCE_TREE)/fonts/Imakefile.removed; \
> +	fi

In combination with the patch and the trigger, the real-build target will
rename or not $(SOURCE_TREE)/fonts/Imakefile. When the Imakefile is there
the fonts will be build, otherwise no.

> +	# put back the Imakefile
> +	if [ ! -e debian/build-fonts ]; then \
> +	    mv -f $(SOURCE_TREE)/fonts/Imakefile.removed $(SOURCE_TREE)/fonts/Imakefile; \
> +	fi
>  	touch $@

Of course we put the file back at the end of the build.

> -build-arch: build
> -build-indep: build
>
> +build:
> +	# do nothing. build-indep and build-arch will be called by binary-* targets.
> +	# Policy allows us to do so.
> +
> +build-fonts:
> +	touch debian/build-fonts
> +
> +build-arch: real-build
> +build-indep: build-fonts real-build
> +

The build sequence needs to be modified. The problem is that
dpkg-buildpackage in general calls in order:

dpkg-source -b
debian/rules build
fakeroot debian/rules $binarytarget

$binarytarget is explicity set to binary: (no options or -b) or
binary-arch: (-B as buildd's)

It is allowed by policy to keep an empty build: so that arch-dep and
arch-indep build targets can be called by the respective bynary-* targets.

The trick is to enable fonts only when binary: is called, and as a
consequence binary-indep -> build-indep -> build-fonts -> real-build,
where build-fonts does not realy build the fonts but enable/disable their
built.
Calling binary-arch: will lead directly to build-arch -> real-build.

>  # DO NOT CHANGE THIS RULE WITHOUT CHECKING FOR SYNCHRONICITY WITH THE install-server RULE BELOW
>  install: $(STAMP_DIR)/install
>  $(STAMP_DIR)/install: $(STAMP_DIR)/stamp-build
> @@ -347,7 +363,7 @@
>
>  binary-indep: $(STAMP_DIR)/binary-indep
>  $(STAMP_DIR)/binary-indep: DH_OPTIONS=-i
> -$(STAMP_DIR)/binary-indep: $(STAMP_DIR)/stamp-build $(STAMP_DIR)/install
> +$(STAMP_DIR)/binary-indep: build-indep $(STAMP_DIR)/install
>  	dh_testdir
>  	dh_testroot
>  	dh_install --sourcedir=debian/tmp
> @@ -379,7 +395,7 @@
>  # DO NOT CHANGE THIS RULE WITHOUT CHECKING FOR SYNCHRONICITY WITH THE binary-server RULE BELOW
>  binary-arch: $(STAMP_DIR)/binary-arch
>  $(STAMP_DIR)/binary-arch: DH_OPTIONS=-s
> -$(STAMP_DIR)/binary-arch: $(STAMP_DIR)/stamp-build $(STAMP_DIR)/install debian/shlibs.local
> +$(STAMP_DIR)/binary-arch: build-arch $(STAMP_DIR)/install debian/shlibs.local

at this point we need to depend on specific build-*

>
> -binary: binary-arch binary-indep
> +binary: binary-indep binary-arch

and we always ensure that when binary: is called, binary-indep is always
triggered before binary-arch (to ensure that the fonts will be built).

What needs to be added now is a more dynamic support for MANIFEST files
(since they contain the 4500 or more entries for fonts) and adjust small
details for binary-arch: target.

Two files, bdftruncate and ucs2any (perl scripts, part of xutils), and
their manpages are installed only when fonts are built and they could be
copied directly from $(BUILD_TREE) (unchecked).

As a result on my test environment not building fonts saves from 15% up to
23% in build time. Not checked the disk space. Note: tests have been done
using ccache enabled with a populated cache from previous builds.

Fabio

-- 
<user> fajita: step one
<fajita> Whatever the problem, step one is always to look in the error log.
<user> fajita: step two
<fajita> When in danger or in doubt, step two is to scream and shout.



Reply to: