Fix database tool.
It was also broken functionally, probably since a while.So restore the functionality. Run it on the dap, the tcd files will be placed into .rockbox folder. Change-Id: Id7a6ce4389dfaf99799258902be80d630af0601c
This commit is contained in:
parent
b358bcfc25
commit
efe73e143a
10 changed files with 62 additions and 64 deletions
|
@ -822,6 +822,8 @@ static long find_tag(int tag, int idx_id, const struct index_entry *idx)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void)idx_id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return idx->tag_seek[tag];
|
return idx->tag_seek[tag];
|
||||||
|
@ -3110,7 +3112,10 @@ static bool commit(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __PCTOOL__
|
||||||
static int tempbuf_handle;
|
static int tempbuf_handle;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void allocate_tempbuf(void)
|
static void allocate_tempbuf(void)
|
||||||
{
|
{
|
||||||
/* Yeah, malloc would be really nice now :) */
|
/* Yeah, malloc would be really nice now :) */
|
||||||
|
@ -4483,8 +4488,11 @@ void tagcache_screensync_enable(bool state)
|
||||||
tc_stat.syncscreen = state;
|
tc_stat.syncscreen = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __PCTOOL__
|
||||||
static void do_tagcache_build(const char *path[])
|
/* this is called by the database tool to not pull in global_settings */
|
||||||
|
static
|
||||||
|
#endif
|
||||||
|
void do_tagcache_build(const char *path[])
|
||||||
{
|
{
|
||||||
struct tagcache_header header;
|
struct tagcache_header header;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
@ -4595,6 +4603,7 @@ static void do_tagcache_build(const char *path[])
|
||||||
cpu_boost(false);
|
cpu_boost(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __PCTOOL__
|
||||||
void tagcache_build(void)
|
void tagcache_build(void)
|
||||||
{
|
{
|
||||||
char *vect[MAX_STATIC_ROOTS + 1]; /* +1 to ensure NULL sentinel */
|
char *vect[MAX_STATIC_ROOTS + 1]; /* +1 to ensure NULL sentinel */
|
||||||
|
@ -4606,6 +4615,7 @@ void tagcache_build(void)
|
||||||
|
|
||||||
do_tagcache_build((const char**)vect);
|
do_tagcache_build((const char**)vect);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TC_RAMCACHE
|
#ifdef HAVE_TC_RAMCACHE
|
||||||
static void load_ramcache(void)
|
static void load_ramcache(void)
|
||||||
|
|
|
@ -203,13 +203,13 @@ struct tagcache_search {
|
||||||
|
|
||||||
#ifdef __PCTOOL__
|
#ifdef __PCTOOL__
|
||||||
void tagcache_reverse_scan(void);
|
void tagcache_reverse_scan(void);
|
||||||
|
/* call this directly instead of tagcache_build in order to not pull
|
||||||
|
* on global_settings */
|
||||||
|
void do_tagcache_build(const char *path[]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* tagcache_tag_to_str(int tag);
|
const char* tagcache_tag_to_str(int tag);
|
||||||
|
|
||||||
#ifdef CPU_SH
|
|
||||||
bool tagcache_is_numeric_tag(int type);
|
|
||||||
#endif
|
|
||||||
bool tagcache_find_index(struct tagcache_search *tcs, const char *filename);
|
bool tagcache_find_index(struct tagcache_search *tcs, const char *filename);
|
||||||
bool tagcache_check_clauses(struct tagcache_search *tcs,
|
bool tagcache_check_clauses(struct tagcache_search *tcs,
|
||||||
struct tagcache_search_clause **clause, int count);
|
struct tagcache_search_clause **clause, int count);
|
||||||
|
|
|
@ -55,6 +55,7 @@ int strip_volume(const char* name, char* namecopy)
|
||||||
}
|
}
|
||||||
#endif /* #ifdef HAVE_MULTIVOLUME */
|
#endif /* #ifdef HAVE_MULTIVOLUME */
|
||||||
|
|
||||||
|
#endif /* __PCTOOL__ */
|
||||||
/* Test file existence, using dircache of possible */
|
/* Test file existence, using dircache of possible */
|
||||||
bool file_exists(const char *file)
|
bool file_exists(const char *file)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +90,6 @@ bool dir_exists(const char *path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __PCTOOL__ */
|
|
||||||
|
|
||||||
#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA))
|
#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA))
|
||||||
struct dirinfo dir_get_info(DIR* parent, struct dirent *entry)
|
struct dirinfo dir_get_info(DIR* parent, struct dirent *entry)
|
||||||
|
|
|
@ -31,10 +31,9 @@
|
||||||
int strip_volume(const char* name, char* namecopy);
|
int strip_volume(const char* name, char* namecopy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __PCTOOL__
|
|
||||||
bool file_exists(const char *file);
|
bool file_exists(const char *file);
|
||||||
bool dir_exists(const char *path);
|
bool dir_exists(const char *path);
|
||||||
#endif
|
|
||||||
extern struct dirinfo dir_get_info(DIR* parent, struct dirent *entry);
|
extern struct dirinfo dir_get_info(DIR* parent, struct dirent *entry);
|
||||||
|
|
||||||
#endif /* __INCLUDE_FILEFUNCS_H_ */
|
#endif /* __INCLUDE_FILEFUNCS_H_ */
|
||||||
|
|
|
@ -30,11 +30,7 @@
|
||||||
/* name of directory where configuration, fonts and other data
|
/* name of directory where configuration, fonts and other data
|
||||||
* files are stored */
|
* files are stored */
|
||||||
#ifdef __PCTOOL__
|
#ifdef __PCTOOL__
|
||||||
#undef ROCKBOX_DIR
|
|
||||||
#undef ROCKBOX_DIR_LEN
|
|
||||||
#undef WPS_DIR
|
#undef WPS_DIR
|
||||||
#define ROCKBOX_DIR "."
|
|
||||||
#define ROCKBOX_DIR_LEN 1
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */
|
/* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */
|
||||||
|
|
|
@ -54,7 +54,7 @@ extern int app_rename(const char* path, const char* newname);
|
||||||
# define write(x,y,z) sim_write(x,y,z)
|
# define write(x,y,z) sim_write(x,y,z)
|
||||||
# define close(x) sim_close(x)
|
# define close(x) sim_close(x)
|
||||||
# endif
|
# endif
|
||||||
#elif defined(SIMULATOR)
|
#elif defined(SIMULATOR) || defined(DBTOOL)
|
||||||
# define open(x, ...) sim_open(x, __VA_ARGS__)
|
# define open(x, ...) sim_open(x, __VA_ARGS__)
|
||||||
# define creat(x,m) sim_creat(x,m)
|
# define creat(x,m) sim_creat(x,m)
|
||||||
# define remove(x) sim_remove(x)
|
# define remove(x) sim_remove(x)
|
||||||
|
|
10
tools/configure
vendored
10
tools/configure
vendored
|
@ -3530,6 +3530,7 @@ fi
|
||||||
toolset='';
|
toolset='';
|
||||||
t_cpu='';
|
t_cpu='';
|
||||||
GCCOPTS='';
|
GCCOPTS='';
|
||||||
|
rbdir='.'
|
||||||
extradefines="$extradefines -DDEBUG"
|
extradefines="$extradefines -DDEBUG"
|
||||||
appsdir='$(ROOTDIR)/tools/checkwps';
|
appsdir='$(ROOTDIR)/tools/checkwps';
|
||||||
output='checkwps.'${modelname};
|
output='checkwps.'${modelname};
|
||||||
|
@ -3538,10 +3539,8 @@ fi
|
||||||
;;
|
;;
|
||||||
[Dd])
|
[Dd])
|
||||||
uname=`uname`
|
uname=`uname`
|
||||||
simcc "database"
|
simcc "database-sdl"
|
||||||
toolset='';
|
toolset='';
|
||||||
t_cpu='';
|
|
||||||
GCCOPTS='';
|
|
||||||
appsdir='$(ROOTDIR)/tools/database';
|
appsdir='$(ROOTDIR)/tools/database';
|
||||||
archosrom='';
|
archosrom='';
|
||||||
|
|
||||||
|
@ -3553,7 +3552,10 @@ fi
|
||||||
output='database.'${modelname};
|
output='database.'${modelname};
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
# architecture, manufacturer and model for the target-tree build
|
||||||
|
t_cpu="hosted"
|
||||||
|
t_manufacturer="sdl"
|
||||||
|
t_model="database"
|
||||||
echo "Database tool build selected"
|
echo "Database tool build selected"
|
||||||
;;
|
;;
|
||||||
[Ww])
|
[Ww])
|
||||||
|
|
|
@ -2,26 +2,37 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "tagcache.h"
|
#include "tagcache.h"
|
||||||
|
#include "dir.h"
|
||||||
|
|
||||||
|
/* This is meant to be run on the root of the dap. it'll put the db files into
|
||||||
|
* a .rockbox subdir */
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
if (mkdir(ROCKBOX_DIR) == -1 && errno != EEXIST)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* / is actually ., will get translated in io.c
|
||||||
|
* (with the help of sim_root_dir below */
|
||||||
|
const char *paths[] = { "/", NULL };
|
||||||
tagcache_init();
|
tagcache_init();
|
||||||
tagcache_build(".");
|
do_tagcache_build(paths);
|
||||||
tagcache_reverse_scan();
|
tagcache_reverse_scan();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stub to avoid including all of apps/misc.c */
|
/* needed for io.c */
|
||||||
bool file_exists(const char *file)
|
const char *sim_root_dir = ".";
|
||||||
{
|
|
||||||
struct stat s;
|
|
||||||
if (!stat(file, &s))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* stubs to avoid including thread-sdl.c */
|
/* stubs to avoid including thread-sdl.c */
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
# $Id: checkwps.make 22680 2009-09-11 17:58:17Z gevaerts $
|
# $Id: checkwps.make 22680 2009-09-11 17:58:17Z gevaerts $
|
||||||
#
|
#
|
||||||
|
|
||||||
DBDEFINES=-g -DDEBUG -D__PCTOOL__
|
GCCOPTS += -g -DDEBUG -D__PCTOOL__ -DDBTOOL
|
||||||
CFLAGS+=$(DBDEFINES)
|
|
||||||
|
|
||||||
createsrc = $(shell cat $(1) > $(3); echo "\#if CONFIG_CODEC == SWCODEC" >> $(3); \
|
createsrc = $(shell cat $(1) > $(3); echo "\#if CONFIG_CODEC == SWCODEC" >> $(3); \
|
||||||
echo $(2) | sed 's/ /\n/g' >> $(3); \
|
echo $(2) | sed 's/ /\n/g' >> $(3); \
|
||||||
|
@ -21,44 +20,25 @@ SRCFILE := $(call createsrc, $(TOOLSDIR)/database/SOURCES, \
|
||||||
$(METADATAS), \
|
$(METADATAS), \
|
||||||
$(TOOLSDIR)/database/SOURCES.build)
|
$(TOOLSDIR)/database/SOURCES.build)
|
||||||
|
|
||||||
SRC= $(call preprocess, $(SRCFILE))
|
DATABASE_SRC = $(call preprocess, $(SRCFILE))
|
||||||
|
DATABASE_OBJ = $(call c2obj,$(DATABASE_SRC))
|
||||||
|
|
||||||
INCLUDES = -I$(ROOTDIR)/apps/gui \
|
OTHER_SRC += $(DATABASE_SRC)
|
||||||
-I$(ROOTDIR)/firmware/export \
|
|
||||||
-I$(ROOTDIR)/firmware/include \
|
|
||||||
-I$(ROOTDIR)/apps \
|
|
||||||
-I$(ROOTDIR)/apps/recorder \
|
|
||||||
-I$(ROOTDIR)/lib/rbcodec \
|
|
||||||
-I$(ROOTDIR)/lib/rbcodec/metadata \
|
|
||||||
-I$(ROOTDIR)/lib/rbcodec/dsp \
|
|
||||||
-I$(APPSDIR) \
|
|
||||||
-I$(BUILDDIR) \
|
|
||||||
|
|
||||||
SIMINCLUDES += -I$(FIRMDIR)/target/hosted/sdl -I$(FIRMDIR)/target/hosted \
|
INCLUDES += -I$(ROOTDIR)/apps/gui \
|
||||||
-I$(ROOTDIR)/uisimulator/common -I$(FIRMDIR)/export -I$(BUILDDIR) -I$(APPSDIR)
|
-I$(ROOTDIR)/firmware/export \
|
||||||
|
-I$(ROOTDIR)/firmware/include \
|
||||||
|
-I$(ROOTDIR)/apps \
|
||||||
|
-I$(ROOTDIR)/apps/recorder \
|
||||||
|
-I$(ROOTDIR)/lib/rbcodec \
|
||||||
|
-I$(ROOTDIR)/lib/rbcodec/metadata \
|
||||||
|
-I$(ROOTDIR)/lib/rbcodec/dsp \
|
||||||
|
-I$(APPSDIR) \
|
||||||
|
-I$(BUILDDIR)
|
||||||
|
|
||||||
# Makes mkdepfile happy
|
|
||||||
GCCOPTS+=`$(SDLCONFIG) --cflags`
|
|
||||||
OLDGCCOPTS:=$(GCCOPTS)
|
|
||||||
GCCOPTS+=-D__PCTOOL__ -fno-builtin $(INCLUDES) $(SIMINCLUDES)
|
|
||||||
|
|
||||||
LIBS=`$(SDLCONFIG) --libs` -lc
|
|
||||||
ifneq ($(findstring MINGW,$(shell uname)),MINGW)
|
|
||||||
LIBS += -ldl
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SECONDEXPANSION: # $$(OBJ) is not populated until after this
|
.SECONDEXPANSION: # $$(OBJ) is not populated until after this
|
||||||
|
|
||||||
SIMFLAGS += $(SIMINCLUDES) $(DBDEFINES) -DHAVE_CONFIG_H $(OLDGCCOPTS) $(INCLUDES)
|
$(BUILDDIR)/$(BINARY): $$(DATABASE_OBJ)
|
||||||
|
$(call PRINTS,LD $(BINARY))
|
||||||
$(BUILDDIR)/$(BINARY): $$(OBJ)
|
$(SILENT)$(HOSTCC) -o $@ $+
|
||||||
@echo LD $(BINARY)
|
|
||||||
$(SILENT)$(HOSTCC) $(SIMFLAGS) $(LIBS) -o $@ $+
|
|
||||||
|
|
||||||
$(BUILDDIR)/tools/database/../../uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c
|
|
||||||
$(SILENT)mkdir -p $(dir $@)
|
|
||||||
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SIMFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
$(BUILDDIR)/tools/database/database.o: $(APPSDIR)/database.c
|
|
||||||
$(SILENT)mkdir -p $(dir $@)
|
|
||||||
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SIMFLAGS) -c $< -o $@
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ static ssize_t io_trigger_and_wait(enum io_dir cmd)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__PCTOOL__) && !defined(APPLICATION)
|
#if !defined(APPLICATION)
|
||||||
static const char *get_sim_pathname(const char *name)
|
static const char *get_sim_pathname(const char *name)
|
||||||
{
|
{
|
||||||
static char buffer[MAX_PATH]; /* sufficiently big */
|
static char buffer[MAX_PATH]; /* sufficiently big */
|
||||||
|
|
Loading…
Reference in a new issue