First cut at handling git patch numbers on VMS.
[p5sagit/p5-mst-13.2.git] / make_patchnum.com
1 $! MAKE_PATCHNUM.COM
2 $!
3 $ open/read pf .patch
4 $ read pf line_in
5 $ close pf
6 $ line_in = f$edit(line_in, "TRIM,COMPRESS")
7 $ branch = f$element(0, " ", line_in)
8 $ snapshot_created = f$element(1, " ", line_in)
9 $ commit_id = f$element(2, " ", line_in)
10 $ describe = f$element(3, " ", line_in)
11 $!
12 $ changed=""
13 $ extra_info="git_snapshot_date='" + snapshot_created + "'"
14 $ commit_title="Snapshot of:"
15 $!
16 $ write sys$output "Updating .patchnum and lib/Config_git.pl"
17 $!
18 $ create .patchnum
19 $ open/append pn .patchnum
20 $ write pn "describe: ''describe'"
21 $ close pn
22 $!
23 $ create unpushed.h
24 $ open/append unp unpushed.h
25 $ write unp "/**********************************************************************"
26 $ write unp "* WARNING: unpushed.h is automatically generated by make_patchnum.com *"
27 $ write unp "*          DO NOT EDIT DIRECTLY - edit make_patchnum.com instead      *"
28 $ write unp "**********************************************************************/"
29 $ write unp "#define PERL_GIT_UNPUSHED_COMMITS       /*no-op*/"
30 $ write unp "/*leave-this-comment*/"
31 $ close unp
32 $!
33 $ create [.lib]Config_git.pl
34 $ open/append cfg [.lib]Config_git.pl
35 $ write cfg "##################################################################"
36 $ write cfg "# WARNING: lib/Config_git.pl is generated by make_patchnum.com   #"
37 $ write cfg "#          DO NOT EDIT DIRECTLY - edit make_patchnum.com instead #"
38 $ write cfg "##################################################################"
39 $ write cfg "$Config::Git_Data=<<'ENDOFGIT';"
40 $ write cfg "git_commit_id='" + commit_id + "'"
41 $ write cfg "git_describe='" + describe + "'"
42 $ write cfg "git_branch='" + branch + "'"
43 $ write cfg "git_uncommitted_changes='" + changed + "'"
44 $ write cfg "git_commit_id_title='" + commit_title + "'"
45 $ write cfg "''extra_info'"
46 $ write cfg "ENDOFGIT"
47 $ close cfg
48 $ exit