]> git.e2factory.org Git - e2factory.git/commitdiff
cleanup: remove unused e2api code
authorGordon Hecker <gh@emlix.com>
Wed, 20 Jan 2010 17:22:19 +0000 (18:22 +0100)
committerGordon Hecker <gh@emlix.com>
Fri, 12 Feb 2010 09:51:59 +0000 (10:51 +0100)
Signed-off-by: Gordon Hecker <gh@emlix.com>
local/Makefile
local/e2api.c [deleted file]
local/e2api.h [deleted file]
local/e2api.lua [deleted file]
local/testapi.c [deleted file]
local/testapi.lua [deleted file]

index 243b1854c35e288b7d2e94d9f86f667c3b28224f..d944cd99df3c72c03d53f7ffc076dbb35cce04ce 100644 (file)
@@ -48,9 +48,9 @@ SYMLINKS_2_1 = lookup-server use-source prepare-cargo sync-results cleanup \
 .PHONY: all install uninstall install install-local doc install-doc
 
 
-all: linux32 e2local.lc $(LOCALLUATOOLS:=.lc) libe2api.so
+all: linux32 e2local.lc $(LOCALLUATOOLS:=.lc)
 
-install: libe2api.so
+install:
        # install symlinks for e2-2.1 compatibility
        for i in $(SYMLINKS_2_1); do \
                ln -sf e2 $(DESTDIR)$(BINDIR)/e2-$$i ; \
@@ -58,9 +58,6 @@ install: libe2api.so
        for i in $(LOCALTOOLS); do \
                ln -sf e2 $(DESTDIR)$(BINDIR)/e2-$$i ; \
        done
-       install -m755 libe2api.so $(DESTDIR)$(LIBDIR)/
-       install -m644 e2api.h $(DESTDIR)$(INCDIR)/
-       install -m644 e2api.lua $(DESTDIR)$(LIBDIR)/
 
 install-local: all
        test -n "$(PROJECTDIR)"
@@ -94,9 +91,6 @@ uninstall:
        for i in $(LOCALTOOLS); do \
                rm -f $(DESTDIR)$(BINDIR)/e2-$$i ; \
        done
-       rm -f $(DESTDIR)$(LIBDIR)/libe2api.so
-       rm -f $(DESTDIR)$(INCDIR)/e2api.h
-       rm -f $(DESTDIR)$(LIBDIR)/e2api.lua
 
 clean:
        rm -f $(CLEAN_FILES)
@@ -129,11 +123,3 @@ e2local.lc: $(TOPLEVEL)/generic/strict.lua \
        $(LUAC) -o $@ $^
 
 linux32: linux32.c
-
-libe2api.so: e2api.o
-       $(CC) -shared -o $@ $^ -I../lua/lua-$(LUA_VERSION)/src -I. $(CFLAGS)
-
-e2api.o: e2api.h
-
-testapi: testapi.o libe2api.so
-       $(CC) -o $@ $< -le2api $(LDFLAGS) -llua -lm -ldl -export-dynamic
diff --git a/local/e2api.c b/local/e2api.c
deleted file mode 100644 (file)
index 8ea0c02..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-   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/>.
-*/
-
-/* 
-   e2api.c 
-
-   C-API for accessing project information
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-
-#include "e2api.h"
-
-
-static char *error_message = NULL;
-
-
-lua_State *
-e2_init(char *project_path)
-{
-  char rpath[ PATH_MAX + 1 ];
-  char buffer[ PATH_MAX + 1 ];
-  lua_State *lua;
-
-  if(realpath(project_path, rpath) == NULL) {
-    free(error_message);
-    error_message = strdup(strerror(errno));
-    return NULL;
-  }
-
-  strcpy(buffer, rpath);
-  strcat(buffer, "/.e2/lib/e2/?.lc;");
-  strcat(buffer, rpath);
-  strcat(buffer, "/.e2/lib/e2/?.lua");
-  setenv("LUA_PATH", buffer, 1);
-  strcpy(buffer, rpath);
-  strcat(buffer, "/.e2/lib/e2/?.so");
-  setenv("LUA_CPATH", buffer, 1);
-  lua = lua_open();
-  luaL_openlibs(lua);
-  lua_newtable(lua);
-  lua_setglobal(lua, "arg");
-  lua_pushstring(lua, rpath);
-  lua_setglobal(lua, "e2api_rpath");
-  strcpy(buffer, rpath);
-  strcat(buffer, "/.e2/lib/e2/e2local.lc");
-  
-  if(luaL_loadfile(lua, buffer) != 0) {
-    free(error_message);
-    error_message = strdup(lua_tostring(lua, -1));
-    lua_close(lua);
-    return NULL;
-  }
-
-  if(lua_pcall(lua, 0, 0, 0) != 0) {
-    free(error_message);
-    error_message = strdup(lua_tostring(lua, -1));
-    lua_close(lua);
-    return NULL;
-  }
-
-  return lua;
-}
-
-
-void 
-e2_exit(lua_State *lua)
-{
-  free(error_message);
-  lua_close(lua);
-}
-
-static int
-exit_handler(lua_State *lua)
-{
-  free(error_message);
-  error_message = strdup(lua_tostring(lua, -1));
-  return luaL_error(lua, error_message);
-}
-
-int 
-e2_info(lua_State *lua)
-{
-  lua_getglobal(lua, "e2lib");
-  lua_pushstring(lua, "abort_with_message");
-  lua_pushcfunction(lua, exit_handler);
-  lua_rawset(lua, -3);
-  lua_getglobal(lua, "e2tool");
-  lua_pushstring(lua, "collect_project_info");
-  lua_rawget(lua, -2);
-  lua_remove(lua, -2); /* remove e2tool table */
-  lua_getglobal(lua, "e2api_rpath");
-
-  if(lua_pcall(lua, 1, 1, 0) != 0) {
-    free(error_message);
-    error_message = strdup(lua_tostring(lua, -1));
-    return 0;
-  }
-
-  return 1;
-}
-
-
-char *
-e2_error(void)
-{
-  return error_message;
-}
diff --git a/local/e2api.h b/local/e2api.h
deleted file mode 100644 (file)
index 98ee945..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-   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/>.
-*/
-
-/*
-  e2api.h
-*/
-
-
-#ifndef E2API_H
-#define E2API_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-
-
-  extern lua_State *e2_init(char *project_path);
-  extern void e2_exit(lua_State *state);
-  extern int e2_info(lua_State *state);
-  extern char *e2_error(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/local/e2api.lua b/local/e2api.lua
deleted file mode 100644 (file)
index fae87a8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
---[[
-   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/>.
-]]
-
--- e2api.lua
--- Use e2 from a Lua program.
-
-
-e2api = {}
-
-function e2api.init(project_path)
-  package.path = project_path .. "/.e2/lib/e2/?.lc;" ..
-    project_path .. "/.e2/lib/e2/?.lua;" .. package.path
-  package.cpath = project_path .. "/.e2/lib/e2/?.so;" .. package.cpath
-  e2api.rpath = project_path
-  require("e2local")
-  e2lib.abort_with_message = error
-end
-
-function e2api.info()
-  return e2tool.collect_project_info(e2api.rpath)
-end
diff --git a/local/testapi.c b/local/testapi.c
deleted file mode 100644 (file)
index 4495828..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-   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/>.
-*/
-
-/*
-  testapi.c
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-
-#include "e2api.h"
-
-
-int 
-main(int argc, char *argv[])
-{
-  lua_State *lua;
-  char rpath[ PATH_MAX + 1 ];
-
-  if(argc > 1) strcpy(rpath, argv[ 1 ]);
-  else strcpy(rpath, ".");
-
-  lua = e2_init(rpath);
-
-  if(lua == NULL) {
-    fprintf(stderr, "[e2api] Error: %s\n", e2_error());
-    exit(EXIT_FAILURE);
-  }
-
-  if(e2_info(lua)) {
-    lua_pushnil(lua);
-    
-    while (lua_next(lua, -2) != 0) {
-      printf("%s: %s\n", lua_tostring(lua, -2), lua_typename(lua, lua_type(lua, -1)));
-      lua_pop(lua, 1);
-    }
-
-    lua_pop(lua, 1);
-  }
-  else {
-    fprintf(stderr, "[e2api] Error: %s\n", e2_error());
-    exit(EXIT_FAILURE);
-  }
-  
-  e2_exit(lua);
-  return 0;
-}
diff --git a/local/testapi.lua b/local/testapi.lua
deleted file mode 100644 (file)
index c494162..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
---[[
-   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/>.
-]]
-
--- testapi.lua
---
--- Test Lua e2 api
-
-
-dofile("e2api.lua")
-
-e2api.init(arg[ 1 ] or error("usage: lua e2api.lua PATH"))
-table.foreach(e2api.info(), print)
-
-rc = e2lib.callcmd_capture("exit 3")
-print(rc)