Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dcs_classifier
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
dcs_classifier
Commits
1ddf657e
Commit
1ddf657e
authored
Aug 05, 2015
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse multiple db files, include filenames and checksums in boilerplate
parent
9ffcf56a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
36 deletions
+49
-36
gen_dcs_classifier.pl
src/gen/gen_dcs_classifier.pl
+49
-36
No files found.
src/gen/gen_dcs_classifier.pl
View file @
1ddf657e
...
...
@@ -315,8 +315,8 @@ EOF
$dbboilerplate
=~
s/^\s*\*?/ */mog
;
_VCL
(
$out
,
VCL_TOP
,
<<
'EOF'
);
*
the
contents
of
this
file
have
been
generated
from
a
database
file
which
*
included
the
following
notice:
*
the
contents
of
this
file
have
been
generated
from
database
files
which
*
included
the
following
notice
s
:
*
EOF
_VCL
(
$out
,
VCL_TOP
,
$dbboilerplate
);
...
...
@@ -605,11 +605,13 @@ GetOptions ('key=s' => \$opt{key},
# remaining arguments are db files
my
@dbrefs
;
my
@dbnames
;
my
@dbchecksums
;
foreach
my
$f
(
@ARGV
)
{
my
(
$dbref
,
$dbchecksum
)
=
load_classifier_db
(
$f
,
$opt
{
key
});
push
@dbrefs
,
(
$dbref
);
push
@dbnames
,
(
$f
);
push
@dbchecksums
,
(
$dbchecksum
);
}
...
...
@@ -703,48 +705,59 @@ my %special_entries;
## build @entries, except that not all fields are filled
my
%
subkeys_count
;
my
$dbchecksum
=
join
(
", "
,
@dbchecksums
);
my
$dbboilerplate
=
"checksum "
.
$dbchecksum
.
"\n"
;
foreach
(
split
(
/[\n\r\f]/
,
$
{
$dbrefs
[
0
]}))
{
if
(
/^\s*#/
)
{
$dbboilerplate
.=
$_
.
"\n"
;
next
;
}
my
$dbboilerplate
=
" ** checksums "
.
$dbchecksum
.
"\n *\n"
;
my
(
$key
,
$type
)
=
split
(
/\t/
,
$_
);
for
(
my
$i
=
0
;
$i
<=
$#dbrefs
;
$i
++
)
{
my
$dbref
=
$dbrefs
[
$i
];
die
"empty key on line "
.
$line
unless
(
defined
(
$key
)
&&
(
$key
ne
""
));
die
"empty type on line "
.
$line
unless
(
defined
(
$type
)
&&
(
$type
ne
""
));
$dbboilerplate
.=
" *\n"
.
" ******\n"
.
' ** file '
.
$dbnames
[
$i
]
.
' checksum '
.
$dbchecksums
[
$i
]
.
"\n"
;
$key
=
lc
(
$key
);
foreach
(
split
(
/[\n\r\f]/
,
$$dbref
))
{
if
(
/^\s*#/
)
{
$dbboilerplate
.=
$_
.
"\n"
;
next
;
}
# remove any subkey which is wholly contained in another subkey
# sort reverse by length, only remove shorter ones
my
@sks
;
{
my
@skss
=
(
sort
{
length
(
$b
)
<=>
length
(
$a
)
}
split
(
/\*/
,
$key
));
skss:
for
(
my
$i
=
0
;
$i
<=
$#skss
;
$i
++
)
{
for
(
my
$j
=
0
;
$j
<=
$#sks
;
$j
++
)
{
if
(
index
(
$sks
[
$j
],
$skss
[
$i
])
!=
-
1
)
{
next
skss
;
my
(
$key
,
$type
)
=
split
(
/\t/
,
$_
);
die
"empty key on line "
.
$line
unless
(
defined
(
$key
)
&&
(
$key
ne
""
));
die
"empty type on line "
.
$line
unless
(
defined
(
$type
)
&&
(
$type
ne
""
));
$key
=
lc
(
$key
);
# remove any subkey which is wholly contained in another subkey
# sort reverse by length, only remove shorter ones
my
@sks
;
{
my
@skss
=
(
sort
{
length
(
$b
)
<=>
length
(
$a
)
}
split
(
/\*/
,
$key
));
skss:
for
(
my
$i
=
0
;
$i
<=
$#skss
;
$i
++
)
{
for
(
my
$j
=
0
;
$j
<=
$#sks
;
$j
++
)
{
if
(
index
(
$sks
[
$j
],
$skss
[
$i
])
!=
-
1
)
{
next
skss
;
}
}
push
@sks
,
(
$skss
[
$i
]);
$subkeys_count
{
$skss
[
$i
]}
++
;
}
push
@sks
,
(
$skss
[
$i
]);
$subkeys_count
{
$skss
[
$i
]}
++
;
}
}
my
@e
;
$e
[
ENTRY_ID
]
=
$line
;
$e
[
ENTRY_ORDER
]
=
$line
;
$e
[
ENTRY_ACTIVE
]
=
0
;
$e
[
ENTRY_TYPE
]
=
type_enum
(
$type
);
$e
[
ENTRY_KEY
]
=
\
$key
;
$e
[
ENTRY_SUBKEYS
]
=
\
@sks
;
$e
[
ENTRY_INITMASK
]
=
0
;
$entries
[
$line
++
]
=
\
@e
;
my
@e
;
$e
[
ENTRY_ID
]
=
$line
;
$e
[
ENTRY_ORDER
]
=
$line
;
$e
[
ENTRY_ACTIVE
]
=
0
;
$e
[
ENTRY_TYPE
]
=
type_enum
(
$type
);
$e
[
ENTRY_KEY
]
=
\
$key
;
$e
[
ENTRY_SUBKEYS
]
=
\
@sks
;
$e
[
ENTRY_INITMASK
]
=
0
;
$entries
[
$line
++
]
=
\
@e
;
}
}
# value is bitmask
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment