Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
a29fca70
Commit
a29fca70
authored
Jan 16, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the production of vcs_version.h and vmod_abi.h to libvcc/generate.py
parent
d38082e0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
49 deletions
+56
-49
Makefile.am
include/Makefile.am
+10
-48
generate.py
lib/libvcc/generate.py
+46
-1
No files found.
include/Makefile.am
View file @
a29fca70
...
...
@@ -102,59 +102,21 @@ nobase_noinst_HEADERS = \
vut.h
\
vut_options.h
tbl/vrt_stv_var.h tbl/vcl_returns.h tbl/vcc_types.h vrt_obj.h
:
vcl.h
vcl.h
:
$(top_srcdir)/lib/libvcc/generate.py $(top_srcdir)/include/vrt.h
GENERATED_H
=
\
tbl/vrt_stv_var.h
\
tbl/vcl_returns.h
\
tbl/vcc_types.h
\
vrt_obj.h
\
vcl.h
\
vcs_version.h
\
vmod_abi.h
$(GENERATED_H)
:
$(top_srcdir)/lib/libvcc/generate.py $(top_srcdir)/include/vrt.h
mkdir
-p
tbl
@
PYTHON@
$(top_srcdir)
/lib/libvcc/generate.py
$(top_srcdir)
$(top_builddir)
BUILT_SOURCES
=
vcs_version.h vmod_abi.h
MAINTAINERCLEANFILES
=
vcs_version.h
vcs_version.h
:
FORCE
@
if
[
-d
"
$(top_srcdir)
/.git"
]
;
then
\
V
=
"
$$
(git --git-dir=
$(top_srcdir)
/.git show -s --pretty=format:%h)"
\
B
=
"
$$
(git --git-dir=
$(top_srcdir)
/.git rev-parse --abbrev-ref HEAD)"
\
H
=
"
$$
(head -n 1 vcs_version.h 2>/dev/null || true)"
;
\
if
[
"/*
$$
V */"
!=
"
$$
H"
]
;
then
\
(
\
echo
"/*
$$
V */"
;
\
echo
'/*'
;
\
echo
' * NB: This file is machine generated, DO NOT EDIT!'
;
\
echo
' *'
;
\
echo
' * Run make to regenerate'
;
\
echo
' *'
;
\
echo
' */'
;
\
echo
"/*
$$
V */"
;
\
echo
''
;
\
echo
"#define VCS_Version
\"
$$
V
\"
"
;
\
echo
"#define VCS_Branch
\"
$$
B
\"
"
\
)
>
vcs_version.h
;
\
fi
\
else
\
if
[
!
-f
vcs_version.h
]
;
then
\
(
\
echo
"/* NOGIT */"
;
\
echo
'/* No git commit ID available, see include/Makefile.am for explanation */'
;
\
echo
'#define VCS_Version "NOGIT"'
;
\
echo
'#define VCS_Branch "NOGIT"'
\
)
>
vcs_version.h
;
\
fi
\
fi
FORCE
:
# If vcs_version contains NOGIT, Varnish has not been built from a
# tarball made with make dist, nor from a git checkout, so there's no
# way for us to give strong guarantees about what version you're
# actually running.
#
# The way to fix this is to either build Varnish from a tarball made
# with `make dist` or a git checkout.
vmod_abi.h
:
vcs_version.h
@
GITID
=
$$
(
sed
's/[^0-9a-f]//g;q'
vcs_version.h
)
;
\
if
[
-z
"
$$
GITID"
]
;
then
\
echo
"warning: weak VMOD ABI checking, see include/Makefile.am"
;
\
fi
;
\
echo
"#define VMOD_ABI_Version
\"
@PACKAGE_STRING@
$$
GITID
\"
"
>
vmod_abi.h
CLEANFILES
=
\
tbl/vcl_returns.h
\
...
...
lib/libvcc/generate.py
View file @
a29fca70
...
...
@@ -30,6 +30,11 @@
# Generate various .c and .h files for the VCL compiler and the interfaces
# for it.
from
__future__
import
print_function
import
subprocess
import
os
#######################################################################
# These are our tokens
...
...
@@ -984,7 +989,7 @@ def file_header(fo):
fo
.
write
(
"""/*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run generate.py instead.
* Edit and run
lib/libvcc/
generate.py instead.
*/
"""
)
...
...
@@ -1371,3 +1376,43 @@ for i in stv_variables:
fp_vclvar
.
write
(
"
\t
%
s
\n
"
%
j
.
strip
())
fp_vclvar
.
close
()
#######################################################################
if
os
.
path
.
isdir
(
os
.
path
.
join
(
srcroot
,
".git"
)):
v
=
subprocess
.
check_output
([
"git --git-dir="
+
os
.
path
.
join
(
srcroot
,
".git"
)
+
" show -s --pretty=format:
%
h"
],
shell
=
True
,
universal_newlines
=
True
)
b
=
subprocess
.
check_output
([
"git --git-dir="
+
os
.
path
.
join
(
srcroot
,
".git"
)
+
" rev-parse --abbrev-ref HEAD"
],
shell
=
True
,
universal_newlines
=
True
)
b
=
b
.
strip
()
else
:
b
=
"NOGIT"
v
=
"NOGIT"
vcsfn
=
os
.
path
.
join
(
srcroot
,
"include"
,
"vcs_version.h"
)
try
:
i
=
open
(
vcsfn
)
.
readline
()
except
IOError
:
i
=
""
if
i
!=
"/* "
+
v
+
" */"
:
fo
=
open
(
vcsfn
,
"w"
)
file_header
(
fo
)
fo
.
write
(
'#define VCS_Version "
%
s"
\n
'
%
v
)
fo
.
write
(
'#define VCS_Branch "
%
s"
\n
'
%
b
)
fo
.
close
()
for
i
in
open
(
os
.
path
.
join
(
srcroot
,
"Makefile"
)):
if
i
[:
14
]
==
"PACKAGE_STRING"
:
break
i
=
i
.
split
(
"="
)[
1
]
.
strip
()
fo
=
open
(
os
.
path
.
join
(
srcroot
,
"include"
,
"vmod_abi.h"
),
"w"
)
file_header
(
fo
)
fo
.
write
(
'#define VMOD_ABI_Version "
%
s
%
s"
\n
'
%
(
i
,
v
))
fo
.
close
()
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