]> git.e2factory.org Git - e2factory.git/commitdiff
example: include example project into source tree
authorGordon Hecker <gh@emlix.com>
Tue, 3 Nov 2009 18:03:36 +0000 (19:03 +0100)
committerGordon Hecker <gh@emlix.com>
Wed, 4 Nov 2009 11:48:26 +0000 (12:48 +0100)
Signed-off-by: Gordon Hecker <gh@emlix.com>
18 files changed:
Changelog
example/Makefile [new file with mode: 0644]
example/README [new file with mode: 0644]
example/example/in/.keep [new file with mode: 0644]
example/example/log/.keep [new file with mode: 0644]
example/example/proj/chroot [new file with mode: 0644]
example/example/proj/config [new file with mode: 0644]
example/example/proj/env [new file with mode: 0644]
example/example/proj/init/.keep [new file with mode: 0644]
example/example/proj/licences [new file with mode: 0644]
example/example/res/.keep [new file with mode: 0644]
example/example/res/final/build-script [new file with mode: 0644]
example/example/res/final/config [new file with mode: 0644]
example/example/res/helloworld/build-script [new file with mode: 0644]
example/example/res/helloworld/config [new file with mode: 0644]
example/example/src/.keep [new file with mode: 0644]
example/example/src/helloworld/config [new file with mode: 0644]
example/setup_example.sh [new file with mode: 0755]

index 90391a4e9c972d91e66db01d15183a5b85b799c2..2b77be35ac01f51eb9ed35b0416a52fbe71e6f49 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -30,6 +30,8 @@ NEXT:
    for files stored in the project configuration tree (on the "." server)
  * fix the bug that the project name configuratino from `proj/config` did
    not influence the BuildId
+ * the example project is now included in the main source tree. Additional
+   files and the e2factory.git repository can be fetched on-the-fly
 
 e2factory-2.3.1
  * bugfixes
diff --git a/example/Makefile b/example/Makefile
new file mode 100644 (file)
index 0000000..470ccc0
--- /dev/null
@@ -0,0 +1,85 @@
+#
+#  e2factory, the emlix embedded build system
+#
+#  Copyright (C) 2007-2009 Gordon Hecker <gh@emlix.com>, emlix GmbH
+#  Copyright (C) 2007-2009 Oskar Schirmer <os@emlix.com>, 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 <http://www.gnu.org/licenses/>.
+#
+
+TOPLEVEL = ..
+
+include $(TOPLEVEL)/make.vars
+
+CLEAN_FILES = *~ *.lc *.so
+
+DOWNLOAD = http://www.e2factory.org/source/example
+E2FACTORY_GIT = http://git.e2factory.org/git/e2factory/e2factory.git
+
+E2_CONFIG = /etc/e2/e2.conf.sample
+export E2_CONFIG
+
+CHROOTDIR   = $(LOCALSTATEDIR)/chroot
+RESULTSDIR  = $(LOCALSTATEDIR)/results
+RELEASESDIR = $(LOCALSTATEDIR)/releases
+PROJECTSDIR = $(LOCALSTATEDIR)/projects
+UPSTREAMDIR = $(LOCALSTATEDIR)/upstream
+
+default: example
+
+clean:
+       rm -fr e2factory-example
+       rm -fr e2factory.git
+       rm -fr base.tar.gz
+       rm -f $(CLEAN_FILES)
+
+base.tar.gz:
+       wget $(DOWNLOAD)/base.tar.gz
+
+e2factory.git:
+       git clone $(E2FACTORY_GIT) e2factory.git
+
+fetch: base.tar.gz e2factory.git
+
+install_example: fetch
+       for d in $(CHROOTDIR) $(RESULTSDIR) $(RELEASESDIR) $(PROJECTSDIR) \
+               $(UPSTREAMDIR) ; do \
+               install -d -m 775 -o root -g ebs $$d ;\
+       done
+       install -m 644 base.tar.gz $(CHROOTDIR)/
+       cp -r e2factory.git $(PROJECTSDIR)/
+       # need 'env -i' here to avoid environment going from this build
+       # process to the local build inside e2-fetch-project.
+       env -i \
+               PATH=$(PATH) \
+               E2_CONFIG=$(E2_CONFIG) \
+               HOME=$(HOME) \
+               USER=$(USER) \
+               E2_LOCAL_BRANCH=$(E2_LOCAL_BRANCH) \
+               E2_LOCAL_TAG=$(E2_LOCAL_TAG) \
+               ./setup_example.sh
+
+uninstall_example:
+       rm -fr $(PROJECTSDIR)/e2factory-example
+       rm -fr $(PROJECTSDIR)/e2factory.git
+       rm -f $(CHROOTDIR)/base.tar.gz
+
+.PHONY: example install_example uninstall_example
diff --git a/example/README b/example/README
new file mode 100644 (file)
index 0000000..78ac735
--- /dev/null
@@ -0,0 +1,25 @@
+The example/ subdirectory includes an example project configuration.
+
+You can easily set up the example project by running
+
+ $ make fetch
+
+to fetch files required to setup the example and
+
+ $ make install_example
+
+to install files required for the the example project to your server
+environment and setup the example project.
+If you change the LOCALSTATEDIR setting in your e2factory build make sure
+you use the same setting here.
+
+Finally you can checkout the project
+
+ $ e2-fetch-project e2factory-example
+ $ cd e2factory-example
+
+and use it...
+
+ $ e2-ls-project
+ $ e2-fetch-sources
+ $ e2-build
diff --git a/example/example/in/.keep b/example/example/in/.keep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/example/log/.keep b/example/example/log/.keep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/example/proj/chroot b/example/example/proj/chroot
new file mode 100644 (file)
index 0000000..5c48377
--- /dev/null
@@ -0,0 +1,19 @@
+-- e2 factory chroot configuration file --
+local cp = "sample/"
+e2chroot {
+  default_groups = {
+    "base",
+  },
+  groups = {
+    {
+      name = "base",
+      server = "chroot",
+      files = {
+        {
+         location = cp.."base.tar.gz",
+         sha1 = "284e7e9b03cf4e0343d509f564a1b2124933533d",
+        },
+      },
+    },
+  },
+}
diff --git a/example/example/proj/config b/example/example/proj/config
new file mode 100644 (file)
index 0000000..367e524
--- /dev/null
@@ -0,0 +1,8 @@
+-- e2 factory project configuration file --
+
+e2project {
+       name = "e2factory-example",
+       release_id = "e2factory-example",
+       default_results = { "final", },
+       chroot_arch = "x86_32",
+}
diff --git a/example/example/proj/env b/example/example/proj/env
new file mode 100644 (file)
index 0000000..06dd4ca
--- /dev/null
@@ -0,0 +1,10 @@
+-- e2 factory environment configuration file --
+env {
+       -- global variables
+       -- key = "val",
+
+       -- result specific variables (only available in <result>)
+       -- <result> = {
+       --      key = "val",
+       -- },
+}
diff --git a/example/example/proj/init/.keep b/example/example/proj/init/.keep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/example/proj/licences b/example/example/proj/licences
new file mode 100644 (file)
index 0000000..0b70070
--- /dev/null
@@ -0,0 +1,3 @@
+-- e2 factory licence configuration file --
+e2licence {
+}
diff --git a/example/example/res/.keep b/example/example/res/.keep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/example/res/final/build-script b/example/example/res/final/build-script
new file mode 100644 (file)
index 0000000..664e9bb
--- /dev/null
@@ -0,0 +1,30 @@
+# e2 factory build script template
+#
+# The build system provides the following variables for use in build scripts:
+# - TMPDIR       pointing to a temporary directory with a directory structure
+# - RESULT       the name of the result currently building
+# - BUILD_NUMBER the build number, 0 by default
+#
+# Additional variables can be provided in init files.
+# Variables are not exported unless the init files do.
+#
+# The following directory structure is available, relative to TMPDIR
+#
+# ./build/<sourcename> sources are located here
+# ./root               shall be used as the destination directory when
+#                      installing software for packaging
+# ./env                        files containing environment variables are located here
+# ./init               init scripts are located here
+# ./script             this directory holds the build driver and the build 
+#                      script
+# ./in                 This directory is available but unused
+# ./dep/<dependency>   These directories hold result files from dependency
+#                      results
+# ./out                        Files that are left here are packaged into the result
+#                      finally.
+#
+
+# simple example: just extract and repackage everything
+find /
+tar -C ${E2_TMPDIR}/root -xzvf ${E2_TMPDIR}/dep/helloworld/helloworld.tar.gz
+tar -C ${E2_TMPDIR}/root -czvf ${E2_TMPDIR}/out/${E2_RESULT}.tar.gz .
diff --git a/example/example/res/final/config b/example/example/res/final/config
new file mode 100644 (file)
index 0000000..704ec6e
--- /dev/null
@@ -0,0 +1,13 @@
+-- e2 factory result configuration template --
+
+e2result {
+       -- a list of sources
+       sources = { },
+       -- a list of dependencies
+       depends = { "helloworld", },
+       -- a list of chroot groups
+       chroot = { },
+       -- use the collect_project feature for this result?
+       collect_project = false,
+       -- collect_project_default_result = "<result>",
+}
diff --git a/example/example/res/helloworld/build-script b/example/example/res/helloworld/build-script
new file mode 100644 (file)
index 0000000..d0dd7a1
--- /dev/null
@@ -0,0 +1,30 @@
+# e2 factory build script template
+#
+# The build system provides the following variables for use in build scripts:
+# - TMPDIR       pointing to a temporary directory with a directory structure
+# - RESULT       the name of the result currently building
+# - BUILD_NUMBER the build number, 0 by default
+#
+# Additional variables can be provided in init files.
+# Variables are not exported unless the init files do.
+#
+# The following directory structure is available, relative to TMPDIR
+#
+# ./build/<sourcename> sources are located here
+# ./root               shall be used as the destination directory when
+#                      installing software for packaging
+# ./env                        files containing environment variables are located here
+# ./init               init scripts are located here
+# ./script             this directory holds the build driver and the build 
+#                      script
+# ./in                 This directory is available but unused
+# ./dep/<dependency>   These directories hold result files from dependency
+#                      results
+# ./out                        Files that are left here are packaged into the result
+#                      finally.
+#
+cd helloworld
+make hello
+install -d ${E2_TMPDIR}/root/bin
+install -m 755 hello ${E2_TMPDIR}/root/bin/hello
+tar -C ${E2_TMPDIR}/root -czvf ${E2_TMPDIR}/out/helloworld.tar.gz .
diff --git a/example/example/res/helloworld/config b/example/example/res/helloworld/config
new file mode 100644 (file)
index 0000000..afd9bac
--- /dev/null
@@ -0,0 +1,13 @@
+-- e2 factory result configuration template --
+
+e2result {
+       -- a list of sources
+       sources = { "helloworld", },
+       -- a list of dependencies
+       depends = { },
+       -- a list of chroot groups
+       chroot = { },
+       -- use the collect_project feature for this result?
+       collect_project = false,
+       -- collect_project_default_result = "<result>",
+}
diff --git a/example/example/src/.keep b/example/example/src/.keep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/example/src/helloworld/config b/example/example/src/helloworld/config
new file mode 100644 (file)
index 0000000..27d5c7e
--- /dev/null
@@ -0,0 +1,21 @@
+-- -*- Lua -*-
+
+e2source {
+       -- the source name
+       -- (is derived from the config file path if only one source is 
+       -- specified per file)
+       name = "helloworld",
+       -- the source type
+       type = "git",
+       -- a list of licences from proj/licences
+       licences = { },
+       -- git specific attributes
+       -- server name
+       server = "proj-storage",
+       -- the repository location relative to the server
+       location = "git/helloworld.git",
+       -- git branch name
+       branch = "master",
+       -- git tag names, the first one is used for building
+       tag = "helloworld-0.1",
+}
diff --git a/example/setup_example.sh b/example/setup_example.sh
new file mode 100755 (executable)
index 0000000..fd9297e
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+set -e
+
+E=e2factory-example
+rm -fr $E
+
+e2-create-project $E
+e2-fetch-project $E
+
+# merge the example project into the new project
+tar -C example -cf - . | tar -C $E -xf -
+
+pushd $E
+git add .
+git commit -m 'configure example project'
+git push
+e2-new-source --git helloworld
+
+pushd in/helloworld
+cat >hello.sh <<EOF
+#!/bin/bash
+echo "Hello World!"
+EOF
+git add hello.sh
+git commit -m 'hello world script'
+git push origin master
+git tag helloworld-0.1
+git push --tags
+popd
+popd
+
+rm -fr $E