1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

s3/rpc_server/mdssvc: Generate flex/bison files in build

Build the generated files at build time instead of using a committed version
generated at some point in the past.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12528

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Jan 28 13:26:01 CET 2017 on sn-devel-144
This commit is contained in:
Noel Power 2017-01-17 16:02:27 +00:00 committed by Ralph Boehme
parent 9a3b64a24c
commit 1820209b9e
11 changed files with 23 additions and 3976 deletions

View File

@ -1,13 +0,0 @@
BISON=bison
FLEX=flex
PARSER=sparql_parser
LEXER=sparql_lexer
all: $(PARSER).c $(LEXER).c
$(PARSER).c: $(PARSER).y
$(BISON) -d -o $@ $<
$(LEXER).c: $(LEXER).l
$(FLEX) -o $@ $<

View File

@ -27,7 +27,7 @@
#include "lib/dbwrap/dbwrap_rbt.h"
#include "libcli/security/dom_sid.h"
#include "mdssvc.h"
#include "sparql_parser.h"
#include "rpc_server/mdssvc/sparql_parser.tab.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
%{
#include "includes.h"
#include "sparql_parser.h"
#include "rpc_server/mdssvc/sparql_parser.tab.h"
#define YY_NO_INPUT
#define yyalloc SMB_MALLOC

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +0,0 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program 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/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_MDSYY_SPARQL_PARSER_H_INCLUDED
# define YY_MDSYY_SPARQL_PARSER_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int mdsyydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
WORD = 258,
BOOL = 259,
FUNC_INRANGE = 260,
DATE_ISO = 261,
OBRACE = 262,
CBRACE = 263,
EQUAL = 264,
UNEQUAL = 265,
GT = 266,
LT = 267,
COMMA = 268,
QUOTE = 269,
AND = 270,
OR = 271
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 61 "sparql_parser.y" /* yacc.c:1909 */
int ival;
const char *sval;
bool bval;
time_t tval;
#line 78 "sparql_parser.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE mdsyylval;
int mdsyyparse (void);
/* "%code provides" blocks. */
#line 53 "sparql_parser.y" /* yacc.c:1909 */
#include <stdbool.h>
#include "mdssvc.h"
#define SPRAW_TIME_OFFSET 978307200
extern int mdsyywrap(void);
extern bool map_spotlight_to_sparql_query(struct sl_query *slq);
#line 99 "sparql_parser.h" /* yacc.c:1909 */
#endif /* !YY_MDSYY_SPARQL_PARSER_H_INCLUDED */

View File

@ -20,9 +20,9 @@
%{
#include "includes.h"
#include "mdssvc.h"
#include "sparql_parser.h"
#include "sparql_mapping.h"
#include "rpc_server/mdssvc/mdssvc.h"
#include "rpc_server/mdssvc/sparql_parser.tab.h"
#include "rpc_server/mdssvc/sparql_mapping.h"
#define YYMALLOC SMB_MALLOC
#define YYREALLOC SMB_REALLOC
@ -52,7 +52,7 @@
%code provides {
#include <stdbool.h>
#include "mdssvc.h"
#include "rpc_server/mdssvc/mdssvc.h"
#define SPRAW_TIME_OFFSET 978307200
extern int mdsyywrap(void);
extern bool map_spotlight_to_sparql_query(struct sl_query *slq);

View File

@ -1,6 +1,6 @@
#include "includes.h"
#include "mdssvc.h"
#include "sparql_parser.h"
#include "rpc_server/mdssvc/sparql_parser.tab.h"
/*
* Examples:

View File

@ -145,8 +145,8 @@ bld.SAMBA3_MODULE('rpc_mdssvc_module',
mdssvc/dalloc.c
mdssvc/marshalling.c
mdssvc/sparql_mapping.c
mdssvc/sparql_parser.c
mdssvc/sparql_lexer.c
mdssvc/sparql_parser.y
mdssvc/sparql_lexer.l
mdssvc/srv_mdssvc_nt.c
../../librpc/gen_ndr/srv_mdssvc.c''',
init_function='',

View File

@ -10,6 +10,7 @@ import wafsamba, Options, Logs, Utils, Scripting
import build.charset
import samba_utils, samba_version
import samba3
import bison, flex
default_prefix = Options.default_prefix = '/usr/local/samba'
@ -1644,6 +1645,17 @@ main() {
conf.env['libtracker']=''
conf.env.with_spotlight = False
if Options.options.with_spotlight:
Logs.info("Requested Spotlight support, checking for bison")
bison.detect(conf)
if not conf.env['BISON']:
conf.fatal("Spotlight support requested but bison missing")
conf.CHECK_COMMAND('%s --version | head -n1' % conf.env['BISON'], msg='Using bison version', define=None, on_target=False)
Logs.info("Requested Spotlight support, checking for flex")
flex.detect(conf)
if not conf.env['FLEX']:
conf.fatal("Spotlight support requested but flex missing")
conf.CHECK_COMMAND('%s --version' % conf.env['FLEX'], msg='Using flex version', define=None, on_target=False)
versions = ['1.0', '0.16', '0.14']
for version in versions:
testlib = 'tracker-sparql-' + version

View File

@ -1329,8 +1329,8 @@ bld.SAMBA3_PYTHON('pylibsmb',
bld.SAMBA3_BINARY('spotlight2sparql',
source='''
rpc_server/mdssvc/sparql_parser_test.c
rpc_server/mdssvc/sparql_parser.c
rpc_server/mdssvc/sparql_lexer.c
rpc_server/mdssvc/sparql_parser.y
rpc_server/mdssvc/sparql_lexer.l
rpc_server/mdssvc/sparql_mapping.c''',
deps='samba3-util talloc ' + bld.env['libtracker'],
enabled=bld.env.with_spotlight,