From: Gordon Hecker Date: Wed, 13 May 2009 09:35:29 +0000 (+0200) Subject: build system has support for building extensions now X-Git-Tag: e2factory-2.3.1pre1~20 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=1a98a6652f76fc202f4dd652f8bfdc2ca41146ac;p=e2factory.git build system has support for building extensions now extensions are built inside e2factory now Signed-off-by: Gordon Hecker --- diff --git a/Makefile b/Makefile index 6fbe57d..98edc38 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ # along with this program. If not, see . # -SUBDIRS = lua generic global doc templates +SUBDIRS = lua generic global doc templates extensions LOCALSUBDIRS = lua generic global local doc TOPLEVEL = . @@ -58,6 +58,7 @@ all: e2commit buildconfig.lua $(MAKE) -C global $(MAKE) -C doc/man $(MAKE) -C templates all + $(MAKE) -C extensions all # this target creates a file E2_COMMIT, holding the current E2_COMMIT # string, and cleans the tree in case E2_COMMIT changed since the last @@ -84,6 +85,7 @@ install: all $(MAKE) -C local install $(MAKE) -C doc/man install $(MAKE) -C templates install + $(MAKE) -C extensions install uninstall: $(MAKE) -C lua uninstall @@ -97,12 +99,14 @@ local: e2commit buildconfig.lua $(MAKE) -C generic local $(MAKE) -C local $(MAKE) -C templates local + $(MAKE) -C extensions local install-local: scripts/e2-locate-project-root $(MAKE) -C generic install-local $(MAKE) -C local install-local $(MAKE) -C templates install-local + $(MAKE) -C extensions install-local install -m 644 buildconfig.lua $(LOCALLIBDIR) doc: diff --git a/extensions/Makefile b/extensions/Makefile new file mode 100644 index 0000000..ef5bf7a --- /dev/null +++ b/extensions/Makefile @@ -0,0 +1,57 @@ +# +# e2factory, the emlix embedded build system +# +# Copyright (C) 2007-2009 Gordon Hecker , emlix GmbH +# Copyright (C) 2007-2009 Oskar Schirmer , emlix GmbH +# Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH +# +# For more information have a look at http://www.e2factory.org +# +# e2factory is a registered trademark by emlix GmbH. +# +# This file is part of e2factory, the emlix embedded build system. +# +# e2factory is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +SUBDIRS = $(shell ls | grep -v Makefile) +TOPLEVEL = .. + +include $(TOPLEVEL)/make.vars + +CLEAN_FILES = *~ + +all: + @for s in $(SUBDIRS) ; do $(MAKE) -C $$s $@ ; done + +install: + @for s in $(SUBDIRS) ; do $(MAKE) -C $$s $@ ; done + +local: + @for s in $(SUBDIRS) ; do $(MAKE) -C $$s $@ ; done + +install-local: + @for s in $(SUBDIRS) ; do $(MAKE) -C $$s $@ ; done + +doc: + @for s in $(SUBDIRS) ; do $(MAKE) -C $$s $@ ; done + +install-doc: + @for s in $(SUBDIRS) ; do $(MAKE) -C $$s $@ ; done + +clean: + @for s in $(SUBDIRS) ; do $(MAKE) -C $$s $@ ; done + rm -f $(CLEAN_FILES) + +.PHONY: all install local install-local doc install-doc clean diff --git a/generic/e2lib.lua b/generic/e2lib.lua index e792d76..a9b764a 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -824,14 +824,8 @@ end -- @return the extension configuration table -- @return an error object on failure function e2lib.read_extension_config() - if e2util.exists(".e2/e2version") then - return false, new_error( - "Deprecated configuration file .e2/e2version exists.\n".. - "Move configuration to .e2/extensions") - end local e = new_error("reading extension config file: %s", e2lib.extension_config) - local rc = e2util.exists(e2lib.extension_config) if not rc then return false, e:append("config file does not exist") diff --git a/global/e2-install-e2.lua.in b/global/e2-install-e2.lua.in index 4423870..69a69f8 100755 --- a/global/e2-install-e2.lua.in +++ b/global/e2-install-e2.lua.in @@ -112,27 +112,21 @@ if e2util.exists(e2lib.extension_config) then e2lib.abort(e:cat(re)) end else - -- parse .e2/e2version for compatibility to e2factory versions without - -- extension support (e2factory-2.3.0) - local s = e2lib.read_line(".e2/e2version") - local branch, tag = s:match("(%S+) (%S+)") - if not branch or not tag then - e2lib.abort(e:append("cannot parse e2 version")) - end - local ref - if tag == "^" then - e2lib.warnf("WOTHER", "using e2 version by branch") - ref = string.format("refs/heads/%s", branch) - else - ref = string.format("refs/tags/%s", tag) - end - -- build an extension table pointing to e2factory core only - extensions = { - { - name = "e2factory", - ref=ref, - } - } + e2lib.warnf("WOTHER", "extension configuration not available") + extensions = {} -- empty list +end + +local s = e2lib.read_line(".e2/e2version") +local branch, tag = s:match("(%S+) (%S+)") +if not branch or not tag then + e2lib.abort(e:append("cannot parse e2 version")) +end +local ref +if tag == "^" then + e2lib.warnf("WOTHER", "using e2 version by branch") + ref = string.format("refs/heads/%s", branch) +else + ref = string.format("refs/tags/%s", tag) end rc, re = e2lib.chdir(".e2") @@ -140,13 +134,33 @@ if not rc then e2lib.abort(e:cat(re)) end +-- checkout e2factory itself +local server = config.site.e2_server +local location = config.site.e2_location +local destdir = "e2" +local skip_checkout = false +e2lib.logf(2, "fetching e2factory (ref %s)", ref) +rc, re = generic_git.git_clone_from_server(scache, server, location, + destdir, skip_checkout) +if not rc then + e2lib.abort(e:cat(re)) +end +e2lib.chdir(destdir) + +-- checkout ref +local args = string.format("--track -b tmp '%s'", ref) +rc, re = e2lib.git(nil, "checkout", args) +if not rc then + e2lib.abort(e:cat(re)) +end + for _,ex in ipairs(extensions) do - -- change to the project root directory - rc, re = e2lib.chdir(root .. "/.e2") + -- change to the e2factory extensions directory + rc, re = e2lib.chdir(root .. "/.e2/e2/extensions") if not rc then e2lib.abort(e:cat(re)) end - print(string.format("installing extension: %s (tag %s)", ex.name, ex.ref)) + e2lib.logf(2, "fetching extension: %s (tag %s)", ex.name, ex.ref) local server = config.site.e2_server local location = string.format("%s/%s.git", config.site.e2_base, ex.name) local destdir = ex.name @@ -168,14 +182,19 @@ for _,ex in ipairs(extensions) do if not rc then e2lib.abort(e:cat(re)) end +end - -- build and install - local cmd = string.format("make PREFIX='%s' local install-local", +-- build and install +e2lib.logf(2, "building e2factory") +rc, re = e2lib.chdir(root .. "/.e2/e2") +if not rc then + e2lib.abort(e:cat(re)) +end +local cmd = string.format("make PREFIX='%s' local install-local", install_prefix) - rc, re = e2lib.callcmd_capture(cmd) - if not rc then - e2lib.abort(e:cat(re)) - end +rc, re = e2lib.callcmd_capture(cmd) +if not rc then + e2lib.abort(e:cat(re)) end e2lib.finish() diff --git a/global/e2.conf.in b/global/e2.conf.in index fc591dd..97bb40a 100644 --- a/global/e2.conf.in +++ b/global/e2.conf.in @@ -7,11 +7,10 @@ config { site = { e2_server = "projects", e2_location = "e2factory.git", - e2_base = "." + e2_base = ".", e2_branch = "e2factory-2.3", e2_tag = "e2factory-2.3.0", default_extensions = { - { name = "e2factory", ref = "refs/heads/master", }, }, }, tools = {