]> git.e2factory.org Git - e2factory.git/commitdiff
global interface: cleanup: The server side ./version file and the .e2/version file...
authorGordon Hecker <gh@emlix.com>
Tue, 5 Jan 2010 10:47:07 +0000 (11:47 +0100)
committerGordon Hecker <gh@emlix.com>
Fri, 12 Feb 2010 09:51:58 +0000 (10:51 +0100)
This commit cleans up the situation:
remove and deprecate .e2/version
introduce .e2/global_version that is created on project check-out and
initialized with the value stored in ./version on the server side.

Local tools check the global interface version against a list of
supported versions stored in the build time configuration. That way they
will, in future, be able to complain if a particular version is not
supported.

Global tools create projects with the newest global interface version
supported.

Signed-off-by: Gordon Hecker <gh@emlix.com>
Changelog
Makefile
generic/e2lib.lua
global/e2-create-project.lua.in
global/e2-fetch-project.lua.in
global/e2-install-e2.lua.in
local/e2tool.lua
make.vars

index c89e6e6ebd932c12a4f5befe73735dd142557305..dc7a12bcf1f21a9782ffccbb98baffcd6dd592f9 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,12 @@ NEXT:
    to this problem in the default configuration and is enabled now.
  * support for per-project caches (using the %l format) in e2.conf is
    no longer available. Cache is designed to be per user.
+ * the global interface version is no longer maintained in the file
+   .e2/version inside the project. Instead ./version on the server side
+   remains the only permanent copy and it is fetched to .e2/global-version
+   in the project environment
+ * the local tools check for their own support for the global interface
+   version in use.
 
 e2factory-2.3.3
  * use sha1 module instead of calling the sha1sum tool
index ac11fd67d22ea47a99b5546bb072d98f2505e29d..962e6facb7ad4898ce17a68438093462293a4d5d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,9 @@ buildconfig.lua: Makefile make.vars
        @echo 'EXTRAVERSION="$(EXTRAVERSION)"' >>$@
        @echo 'VERSION="$(VERSION)"' >>$@
        @echo 'VERSIONSTRING="$(VERSIONSTRING)"' >>$@
+       @echo 'GLOBAL_INTERFACE_VERSION={' >>$@
+       @for x in $(GLOBAL_INTERFACE_VERSION) ; do echo " \"$$x\"," ; done >>$@
+       @echo '}' >>$@
        @echo 'SYNTAX={' >>$@
        @for x in $(SYNTAX) ; do echo " \"$$x\"," ; done >>$@
        @echo '}' >>$@
index 9ceb72bb2cd439c4b0afd72e31f1a7a04b1f0499..2ad01af73e4780a91a4caf9a83ca89cfed7cb04a 100644 (file)
@@ -85,6 +85,7 @@ e2lib = {
   buildnumber_server_url = nil,
   template_path = string.format("%s/templates", buildconfig.SYSCONFDIR),
   extension_config = ".e2/extensions",
+  global_interface_version_file = ".e2/global-version",
   lock = nil,
   logrotate = 5,   -- configurable via config.log.logrotate
 }
index 52c3d5511b1f27bd3ed0321af57685e4496a0d73..413ca27e53a2462d0c621ac02bdabb47d8b57d28 100755 (executable)
@@ -84,7 +84,7 @@ if not sl then
 end
 
 local p = {}
-p.version = 2                                  -- the project version
+p.version = buildconfig.GLOBAL_INTERFACE_VERSION[1] -- the project version
 p.e2version = string.format("%s %s", e2lib.local_e2_branch,
                                                        e2lib.local_e2_tag)
 p.server = sl.server                           -- the server
@@ -192,7 +192,6 @@ files = {
        { filename = "proj/licences", content=licences },
        { filename = "proj/env", content=env },
        { filename = "proj/config", content=pconfig },
-       { filename = ".e2/version", content=version },
        { filename = ".e2/syntax", content=syntax },
        { filename = ".e2/e2version", content=e2version },
        { filename = ".gitignore", content=gitignore },
index b70d1c1322f2e04f217f8b4e06add08d8d60ba4d..760efda9f6e68290a298258380897ff0c072dbf0 100755 (executable)
@@ -174,6 +174,9 @@ if not rc then
   e2lib.abort(e:cat(re))
 end
 
+-- write version file
+local rc, re = e2lib.write_file(e2lib.global_interface_version_file, string.format("%d\n", v))
+
 -- call e2-install-e2
 e2_install_e2 = string.format("'%s' '%s/e2-install-e2'", 
                        buildconfig.LUA, buildconfig.TOOLDIR)
index babcb244f167779272a9431b3781d3fa91788b50..b862740081ffda639f178683b1293475c0c7d148 100755 (executable)
@@ -81,7 +81,7 @@ if not rc then
 end
 
 -- read the version from the first line
-local line, re = e2lib.read_line(".e2/version")
+local line, re = e2lib.read_line(e2lib.global_interface_version_file)
 if not line then
        e2lib.abort(e:cat(re))
 end
index 4a97277b80d6ec364dfc43d5b49c46c7b9c77fd5..ac4d0c923b35cc90fb5b70f48c0f8e2a46849dab 100644 (file)
@@ -618,6 +618,27 @@ The newest configuration syntax supported by the tools is %s.
   info.project_location = l
   e2lib.log(4, string.format("project location is %s", info.project_location))
 
+  -- read global interface version and check if this version of the local
+  -- tools supports the version used for the project
+  local line, re = e2lib.read_line(e2lib.global_interface_version_file)
+  if not line then
+    return false, e:cat(re)
+  end
+  info.global_interface_version = line:match("^%s*(%d+)%s*$")
+  local supported = false
+  for _,v in ipairs(buildconfig.GLOBAL_INTERFACE_VERSION) do
+    if v == info.global_interface_version then
+      supported = true
+    end
+  end
+  if not supported then
+    e:append("%s: Invalid global interface version",
+                                       e2lib.global_interface_version_file)
+    e:append("supported global interface versions are: %s",
+               table.concat(buildconfig.GLOBAL_INTERFACE_VERSION), " ")
+    return false, e
+  end
+
   -- warn if deprecated config files still exist
   local deprecated_files = {
        "proj/servers",
@@ -625,6 +646,7 @@ The newest configuration syntax supported by the tools is %s.
        "proj/default-results",
        "proj/name",
        "proj/release-id",
+       ".e2/version",
   }
   for _,f in ipairs(deprecated_files) do
     local path = string.format("%s/%s", info.root, f)
index bc44e18919f37d6b00bec98d73afc42d0dd49b25..fb3d1c9337ed059735a34bcab1df33ec7244fb35 100644 (file)
--- a/make.vars
+++ b/make.vars
@@ -23,6 +23,14 @@ endif
 # list the latest one first
 SYNTAX = 2_3_2
 
+# Global interface version describes the server side data format
+# It is stored in a file named `version` in the server side project location.
+# This file is copied to .e2/global_version when checking out a project for
+# access by the local tools.
+#
+# List the latest one first. It will be used when creating new projects.
+GLOBAL_INTERFACE_VERSION = 2
+
 # when creating a project a current set of local tools is requested
 DEFAULT_LOCAL_BRANCH = master
 DEFAULT_LOCAL_TAG = $(TAG)