Sorry for the huge delay, FIRST Robotics absorbed my life for >6 weeks, then I never really came back to this.
---- In the patch 'external-python-bzr.patch' I've done what we discussed.
=== added directory 'deps/python2' === added file 'deps/python2/Makefile' --- deps/python2/Makefile 1970-01-01 00:00:00 +0000 +++ deps/python2/Makefile 2011-07-03 03:39:46 +0000 @@ -0,0 +1,10 @@ +GARNAME = python +GARVERSION = 2 + +BINFILES=python +SIGFILES = $(DISTNAME).tar.gz.asc + +HOME_URL = http://www.python.org +DESCRIPTION = interactive high-level object-oriented language + +include ../../gar.lib/external.mk === added file 'gar.lib/external.mk' --- gar.lib/external.mk 1970-01-01 00:00:00 +0000 +++ gar.lib/external.mk 2011-07-03 03:39:46 +0000 @@ -0,0 +1,76 @@ +# Function: gar_patternlist +# Usage: $(call gar_patternlist,$(PATH),$(PATTERNS)) +# Description: Create a list of files to check for that match pattern, in path. +# The directory is on the outer loop, and pattern on the inner. +# (This matches the behavior of the linker and Make 3.82+'s +# Directory Search for Link Libraries) +# Example: = $(call gar_patternlist,/lib:/usr/lib,lib%.so lib%.a) +# = /lib/lib%.so /lib/lib%.a /usr/lib/lib%.so /usr/lib/lib%.a +gar_patternlist = $(foreach DIR,$(subst :, ,$1),$(addprefix $(DIR)/,$2)) + +# Function: gar_pathsearch +# Usage: $(call gar_pathsearch,$(FILE),$(PATH),$(PATTERNS)) +# Description: Generate a gar_patternlist from $(PATH) and $(PATTERNS), then +# expand `%' to $(FILE), and return a the subset of the list that +# exists. +gar_pathsearch = $(wildcard $(subst %,$1,$(call gar_patternlist,$2,$3))) + +# Function: gar_missing +# Usage: $(call gar_patternlist,$(FILES),$(PATH),$(PATTERNS)) +# Description: Return the subset of $(FILES) for which gar_pathsearch returns an +# empty list. +# Example: If coreutils is installed but gcc isn't +# = $(call gar_missing,cat gcc,$(PATH),%) +# = gcc +gar_missing = $(foreach FILE,$1,$(if $(call gar_pathsearch,$(FILE),$2,$3),,$(FILE))) + +################################################################################# + +.BINPATTERNS ?= % +.LIBPATTERNS ?= lib%.so lib%.a +.PYPATTERNS ?= %.pyc %.py +.PKGPATTERNS ?= %.pc +.MANPATTERNS ?= $(foreach i,1 2 3 4 5 6 7 8,man$i/%.$i*) + +MISSING_BINFILES = $(call gar_missing,$(BINFILES),$(PATH) ,$(.BINPATTERNS)) +MISSING_LIBFILES = $(call gar_missing,$(LIBFILES),$(LD_LIBRARY_PATH),$(.LIBPATTERNS)) +MISSING_PYFILES = $(call gar_missing,$(PYFILES) ,$(PYTHONPATH) ,$(.PYPATTERNS) ) +MISSING_PKGFILES = $(call gar_missing,$(PKGFILES),$(PKG_CONFIG_PATH),$(.PKGPATTERNS)) +MISSING_MANFILES = $(call gar_missing,$(MANFILES),$(MANPATH) ,$(.MANPATTERNS)) + +MISSING_FILES = $(strip \ + $(MISSING_BINFILES) \ + $(MISSING_LIBFILES) \ + $(MISSING_PYFILES) \ + $(MISSING_PKGFILES) \ + $(MISSING_MANFILES) \ + ) + +# The `$(MISSING)' variable is the action that is taken if the package is not +# installed +#MISSING ?= install +MISSING ?= install-message + +variable-install: $(if $(MISSING_FILES),$(MISSING)); + +install-message: + @echo "Please install `$(GARNAME)' using a system other than GSRC." + @echo $(INSTALL_CMD) + @exit 1 + +# The rest is a little ugly, but what it does is probe the operating system to +# decide an appropriate example command for $(INSTALL_CMD) + +ifeq '$(USER)' 'root' +else ifeq '$(UID)' '0' +else +SUDO = $(if $(call gar_pathsearch,sudo,$(PATH),$(.BINPATTERNS)),sudo) +endif + +ifneq ($(strip $(call gar_pathsearch,apt-get,$(PATH),$(.BINPATTERNS))),) +INSTALL_CMD ?= eg: $(SUDO) apt-get install $(GARNAME) +endif + +ifneq ($(strip $(call gar_pathsearch,yum,$(PATH),$(.BINPATTERNS))),) +INSTALL_CMD ?= eg: $(SUDO) yum install $(GARNAME) +endif === modified file 'gnu/bazaar/Makefile' --- gnu/bazaar/Makefile 2011-06-08 21:40:00 +0000 +++ gnu/bazaar/Makefile 2011-07-03 03:42:51 +0000 @@ -15,6 +15,7 @@ #EXTDEPS = paramiko LIBDEPS = zlib +BUILDDEPS = python2 HOME_URL = http://bazaar.canonical.com/ DESCRIPTION = The GNU distributed version control system
I've implemented gar.lib/external.mk that can detect if a package is externally installed files in in */bin, lib, python files, pkgconfig. If it's installed, the cookies are created, if it's not it prints a message telling the user to install the package, trying to print one appropriate the the user's system. It also provides a facility to install the package via GAR if it's not installed, by setting MISSING to 'install' (instead of the default 'install-message'). I've added Python2 using this, though it does not optionally install if it isn't (because I'm lazy, this probably should be done), and given bazar python2 as a BUILDDEPT ---- I've also written a basic INSTALL file.
=== modified file 'INSTALL' --- INSTALL 2010-12-20 11:45:48 +0000 +++ INSTALL 2011-07-03 03:39:46 +0000 @@ -1,1 +1,32 @@ -TBD \ No newline at end of file +The install process for GSRC is fairly straight forward. +Extract/check-out the files into the desired directory, and run the +commands + +$ ./bootstrap +$ ./configure + +You can give `./configure' the normal GNU configure arguments. If you +decide to change these, either reconfigure, or edit `config.mk'. + +After you have done that, you can use GSRC to install packages. For +further instruction, run the command + +$ make help + +If you are curious about what is created in each of these steps: + ./bootstrap: + * aclocal.m4 + * autom4te.cache/ + * configure + * doc/Makefile.in + * doc/mdate-sh + * doc/texinfo.tex + * GNUmakefile.in + * install-sh + * missing + ./configure: + * config.log + * config.mk + * config.status + * doc/Makefile + * GNUmakefile
---- While working with GSRC, I've noticed a few things: ---- It appears that the original design of GAR was to use the `USE' variable to include other lib files, rather than include them directly. So, for example, instead of include ../../gar.lib/auto.mk one would use USE = auto.mk include ../../gar.mk This would allow for things like moving the gar.lib directory or having multiple directories. The system is constructed that either method can be used without breaking anything. This means that if you agree that the USE variable is in good design, the switch can be made gradually. ---- GARDIR_ABSOLUTE := $(shell cd $(GARDIR) && pwd) could be replaced with GARDIR_ABSOLUTE := $(realpath $(GARDIR)) (in gar.mk) While not vital, that was annoying me. I assume that the reason this was not used before is that $(realpath) was not added until GNU Make 3.81 (2006-04-01). The reason I have not changed this is because you may wish to be compatible with older releases of make, so I'll let you make that call. ---- ~ Luke Shumaker http://lukeshu.ath.cx At Tue, 01 Feb 2011 17:44:29 +0000, Brian Gough wrote: > At Mon, 31 Jan 2011 19:44:22 -0500, > Luke Shumaker wrote: > > On Mon, 2011-01-31 at 16:24 +0000, Brian Gough wrote: > > > I've been reluctant to add Python as a full dependency, due to its > > > size and the fact that most people will have it installed already. > > > > > > I think we really need some kind of mechanism to specify system > > > packages like python-dev and tell the user to "apt-get install > > > python-dev" (or whatever is appropriate on their system) if needed. > > > > I've been thinking about a system to tag a package as installed by > > another source, and to treat it as successfully installed. This gives > > me two questions: > > 1) Would you accept such a patch? > > Yes > > > 2) Would I have to maintain compatibility with existing `.gar/', > > `cookies/' and such? Not that I plan on breaking it, but it will > > probably affect design decisions. > > The .gar stuff shouldn't be needed, cookies would be. > > Essentially what is needed is a Makefile with an install target that > creates the appropriate cookie if the package is found on the system, > and otherwise prints a message telling the user the necessary > 'apt-get' command or similar. > > Then it can just be specified as a normal dependency.
