compare_curl_source.com 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. $! Compare_curl_source.com
  2. $!
  3. $! $Id$
  4. $!
  5. $! This procedure compares the files in two directories and reports the
  6. $! differences. It is customized for the vmsports repository layout.
  7. $!
  8. $! It needs to be customized to the local site directories.
  9. $!
  10. $! This is used by me for these purposes:
  11. $! 1. Compare the original source of a project with an existing
  12. $! VMS port.
  13. $! 2. Compare the checked out repository of a project with the
  14. $! the local working copy to make sure they are in sync.
  15. $! 3. Keep a copy directory up to date. The third is needed by
  16. $! me because VMS Backup can create a saveset of files from a
  17. $! NFS mounted volume.
  18. $!
  19. $! First the files in the original source directory which is assumed to be
  20. $! under source codde control are compared with the copy directory.
  21. $!
  22. $! Then the files are are only in the copy directory are listed.
  23. $!
  24. $! The result will five diagnostics about of files:
  25. $! 1. Files that are not generation 1.
  26. $! 2. Files missing in the copy directory.
  27. $! 3. Files in the copy directory not in the source directory.
  28. $! 4. Files different from the source directory.
  29. $! 5. Files that VMS DIFF can not process.
  30. $!
  31. $! This needs to be run on an ODS-5 volume.
  32. $!
  33. $! If UPDATE is given as a second parameter, files missing or different in the
  34. $! copy directory will be updated.
  35. $!
  36. $! By default:
  37. $! The directory src_root:[project_name] will be translated to something like
  38. $! DISK:[dir.dir.reference.project_name] and this will be used
  39. $! to calculate DISK:[dir.dir.vms_source.project_name] for the VMS specific
  40. $! source directory.
  41. $!
  42. $! The copy directory is vms_root:[project_name]
  43. $! The UPDATE parameter is ignored.
  44. $!
  45. $! This setting is used to make sure that the working vms directory
  46. $! and the repository checkout directory have the same contents.
  47. $!
  48. $! If P1 is "SRCBCK" then this
  49. $! The source directory tree is: src_root:[project_name]
  50. $! The copy directory is src_root1:[project_name]
  51. $!
  52. $! src_root1:[project_name] is used by me to work around that VMS backup will
  53. $! not use NFS as a source directory so I need to make a copy.
  54. $!
  55. $! This is to make sure that the backup save set for the unmodified
  56. $! source is up to date.
  57. $!
  58. $! If your repository checkout is not on an NFS mounted volume, you do not
  59. $! need to use this option or have the logical name src_root1 defined.
  60. $!
  61. $! If P1 is "VMSBCK" then this changes the two directories:
  62. $! The source directory is vms_root:[project_name]
  63. $! The copy directory is vms_root1:[project_name]
  64. $!
  65. $! vms_root:[project_name] is where I do the VMS specific edits.
  66. $! vms_root1:[project_name] is used by me to work around that VMS backup will
  67. $! not use NFS as a source directory so I need to make a copy.
  68. $!
  69. $! This is to make sure that the backup save set for the unmodified
  70. $! source is up to date.
  71. $!
  72. $! Copyright 2011, John Malmberg
  73. $!
  74. $! Permission to use, copy, modify, and/or distribute this software for any
  75. $! purpose with or without fee is hereby granted, provided that the above
  76. $! copyright notice and this permission notice appear in all copies.
  77. $!
  78. $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  79. $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  80. $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  81. $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  82. $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  83. $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  84. $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  85. $!
  86. $! 18-Aug-2011 J. Malmberg
  87. $!==========================================================================
  88. $!
  89. $! Update missing/changed files.
  90. $ update_file = 0
  91. $ if (p2 .eqs. "UPDATE")
  92. $ then
  93. $ update_file = 1
  94. $ endif
  95. $!
  96. $ myproc = f$environment("PROCEDURE")
  97. $ myprocdir = f$parse(myproc,,,"DIRECTORY") - "[" - "]" - "<" - ">"
  98. $ myprocdir = f$edit(myprocdir, "LOWERCASE")
  99. $ mydefault = f$environment("DEFAULT")
  100. $ mydir = f$parse(mydefault,,,"DIRECTORY")
  101. $ mydir = f$edit(mydir, "LOWERCASE")
  102. $ odelim = f$extract(0, 1, mydir)
  103. $ mydir = mydir - "[" - "]" - "<" - ">"
  104. $ mydev = f$parse(mydefault,,,"DEVICE")
  105. $!
  106. $ ref = ""
  107. $ if P1 .eqs. ""
  108. $ then
  109. $ ref_base_dir = myprocdir
  110. $ wrk_base_dir = mydir
  111. $ update_file = 0
  112. $ resultd = f$parse("src_root:",,,,"NO_CONCEAL")
  113. $ resultd = f$edit(resultd, "LOWERCASE")
  114. $ resultd = resultd - "][" - "><" - ".;" - ".."
  115. $ resultd_len = f$length(resultd) - 1
  116. $ delim = f$extract(resultd_len, 1, resultd)
  117. $ ref_root_base = mydir + delim
  118. $ resultd = resultd - ref_root_base - "reference." + "vms_source."
  119. $ ref = resultd + ref_base_dir
  120. $ wrk = "VMS_ROOT:" + odelim + wrk_base_dir
  121. $ resultd_len = f$length(resultd) - 1
  122. $ resultd = f$extract(0, resultd_len, resultd) + delim
  123. $ ref_root_dir = f$parse(resultd,,,"DIRECTORY")
  124. $ ref_root_dir = f$edit(ref_root_dir, "LOWERCASE")
  125. $ ref_root_dir = ref_root_dir - "[" - "]"
  126. $ ref_base_dir = ref_root_dir + "." + ref_base_dir
  127. $ endif
  128. $!
  129. $ if p1 .eqs. "SRCBCK"
  130. $ then
  131. $ ref_base_dir = "curl"
  132. $ wrk_base_dir = "curl"
  133. $ ref = "src_root:[" + ref_base_dir
  134. $ wrk = "src_root1:[" + wrk_base_dir
  135. $ if update_file
  136. $ then
  137. $ if f$search("src_root1:[000000]curl.dir") .eqs. ""
  138. $ then
  139. $ create/dir/prot=o:rwed src_root1:[curl]
  140. $ endif
  141. $ endif
  142. $ endif
  143. $!
  144. $!
  145. $ if p1 .eqs. "VMSBCK"
  146. $ then
  147. $ ref_base_dir = "curl"
  148. $ wrk_base_dir = "curl"
  149. $ ref = "vms_root:[" + ref_base_dir
  150. $ wrk = "vms_root1:[" + wrk_base_dir
  151. $ if update_file
  152. $ then
  153. $ if f$search("vms_root1:[000000]curl.dir") .eqs. ""
  154. $ then
  155. $ create/dir/prot=o:rwed vms_root1:[curl]
  156. $ endif
  157. $ endif
  158. $ endif
  159. $!
  160. $!
  161. $ if ref .eqs. ""
  162. $ then
  163. $ write sys$output "Unknown compare type specified!"
  164. $ exit 44
  165. $ endif
  166. $!
  167. $!
  168. $! Future - check the device types involved for the
  169. $! the syntax to check.
  170. $ ODS2_SYNTAX = 0
  171. $ NFS_MANGLE = 0
  172. $ PWRK_MANGLE = 0
  173. $!
  174. $ vax = f$getsyi("HW_MODEL") .lt. 1024
  175. $ if vax
  176. $ then
  177. $ ODS2_SYNTAX = 1
  178. $ endif
  179. $!
  180. $ report_missing = 1
  181. $!
  182. $ if .not. ODS2_SYNTAX
  183. $ then
  184. $ set proc/parse=extended
  185. $ endif
  186. $!
  187. $loop:
  188. $ ref_spec = f$search("''ref'...]*.*;",1)
  189. $ if ref_spec .eqs. "" then goto loop_end
  190. $!
  191. $ ref_dev = f$parse(ref_spec,,,"DEVICE")
  192. $ ref_dir = f$parse(ref_spec,,,"DIRECTORY")
  193. $ ref_dir = f$edit(ref_dir, "LOWERCASE")
  194. $ ref_name = f$parse(ref_spec,,,"NAME")
  195. $ ref_type = f$parse(ref_spec,,,"TYPE")
  196. $!
  197. $!
  198. $ rel_path = ref_dir - "[" - ref_base_dir
  199. $! rel_path_len = f$length(rel_path) - 1
  200. $! delim = f$extract(rel_path_len, 1, rel_path)
  201. $! rel_path = rel_path - ".]" - ".>" - "]" - ">"
  202. $! rel_path = rel_path + delim
  203. $!
  204. $ if ODS2_SYNTAX
  205. $ then
  206. $! if rel_path .eqs. ".examples.scripts^.noah]"
  207. $! then
  208. $! rel_path = ".examples.scripts_noah]"
  209. $! endif
  210. $! if rel_path .eqs. ".examples.scripts^.v2]"
  211. $! then
  212. $! rel_path = ".examples.scripts_v2]"
  213. $! endif
  214. $ endif
  215. $!
  216. $ wrk_path = wrk + rel_path
  217. $!
  218. $ ref_name_type = ref_name + ref_type
  219. $!
  220. $ if ODS2_SYNTAX
  221. $ then
  222. $ endif
  223. $!
  224. $ wrk_spec = wrk_path + ref_name_type
  225. $!
  226. $!
  227. $ wrk_chk = f$search(wrk_spec, 0)
  228. $ if wrk_chk .eqs. ""
  229. $ then
  230. $ if report_missing
  231. $ then
  232. $ write sys$output "''wrk_spec' is missing"
  233. $ endif
  234. $ if update_file
  235. $ then
  236. $ copy/log 'ref_spec' 'wrk_spec'
  237. $ endif
  238. $ goto loop
  239. $ endif
  240. $!
  241. $ wrk_name = f$parse(wrk_spec,,,"NAME")
  242. $ wrk_type = f$parse(wrk_spec,,,"TYPE")
  243. $ wrk_fname = wrk_name + wrk_type"
  244. $ ref_fname = ref_name + ref_type
  245. $!
  246. $ if ref_fname .nes. wrk_fname
  247. $ then
  248. $ write sys$output "''wrk_spc' wrong name, should be ""''ref_fname'"""
  249. $ endif
  250. $!
  251. $ ref_type = f$edit(ref_type, "UPCASE")
  252. $ if ref_type .eqs. ".DIR" then goto loop
  253. $!
  254. $ if ODS2_SYNTAX
  255. $ then
  256. $ ref_fname = f$edit(ref_fname, "LOWERCASE")
  257. $ endif
  258. $!
  259. $! These files are in the wrong format for VMS diff, and we don't change them.
  260. $ ref_skip = 0
  261. $ if ref_type .eqs. ".PDF" then ref_skip = 1
  262. $ if ref_type .eqs. ".HTML" then ref_skip = 1
  263. $ if ref_type .eqs. ".HQX" then ref_skip = 1
  264. $ if ref_type .eqs. ".P12" then ref_skip = 1
  265. $ if ref_type .eqs. "."
  266. $ then
  267. $ if f$locate("test", ref_fname) .eq. 0 then ref_skip = 1
  268. $ if ref_fname .eqs. "configure." then ref_skip = 1
  269. $ endif
  270. $ if ref_fname .eqs. "MACINSTALL.TXT" then ref_skip = 1
  271. $ if ref_fname .eqs. "$macinstall.txt" then ref_skip = 1
  272. $ if ref_fname .eqs. "curl.mcp$5nxml$5nsit$5nhqx" then ref_skip = 1
  273. $ if ref_fname .eqs. "curl_GUSIConfig.cpp" then ref_skip = 1
  274. $ if ref_fname .eqs. "curl_$gusic$onfig.cpp" then ref_skip = 1
  275. $ if ref_fname .eqs. "macos_main.cpp" then ref_skip = 1
  276. $!
  277. $!
  278. $ if ref_skip .ne. 0
  279. $ then
  280. $ if report_missing
  281. $ then
  282. $ write sys$output "Skipping diff of ''ref_fname'"
  283. $ endif
  284. $ goto loop
  285. $ endif
  286. $!
  287. $!
  288. $ wrk_ver = f$parse(wrk_chk,,,"VERSION")
  289. $ if wrk_ver .nes. ";1"
  290. $ then
  291. $ write sys$output "Version for ''wrk_spec' is not 1"
  292. $ endif
  293. $ set noon
  294. $ diff/out=nl: 'wrk_spec' 'ref_spec'
  295. $ if $severity .nes. "1"
  296. $ then
  297. $ write sys$output "''wrk_spec' is different from ''ref_spec'"
  298. $ if update_file
  299. $ then
  300. $ delete 'wrk_spec';*
  301. $ copy/log 'ref_spec' 'wrk_spec'
  302. $ endif
  303. $ endif
  304. $ set on
  305. $
  306. $!
  307. $ goto loop
  308. $loop_end:
  309. $!
  310. $!
  311. $missing_loop:
  312. $! For missing loop, check the latest generation.
  313. $ ref_spec = f$search("''wrk'...]*.*;")
  314. $ if ref_spec .eqs. "" then goto missing_loop_end
  315. $!
  316. $ ref_dev = f$parse(ref_spec,,,"DEVICE")
  317. $ ref_dir = f$parse(ref_spec,,,"DIRECTORY")
  318. $ ref_dir = f$edit(ref_dir, "LOWERCASE")
  319. $ ref_name = f$parse(ref_spec,,,"NAME")
  320. $ ref_type = f$parse(ref_spec,,,"TYPE")
  321. $ ref_name_type = ref_name + ref_type
  322. $!
  323. $ rel_path = ref_dir - "[" - wrk_base_dir
  324. $!
  325. $!
  326. $ wrk_path = ref + rel_path
  327. $ wrk_spec = wrk_path + ref_name + ref_type
  328. $ wrk_name = f$parse(wrk_spec,,,"NAME")
  329. $ wrk_type = f$parse(wrk_spec,,,"TYPE")
  330. $!
  331. $ wrk_fname = wrk_name + wrk_type"
  332. $ ref_fname = ref_name + ref_type
  333. $!
  334. $ wrk_skip = 0
  335. $ ref_utype = f$edit(ref_type,"UPCASE")
  336. $ ref_ufname = f$edit(ref_fname,"UPCASE")
  337. $!
  338. $ if wrk_skip .eq. 0
  339. $ then
  340. $ wrk_chk = f$search(wrk_spec, 0)
  341. $ if wrk_chk .eqs. ""
  342. $ then
  343. $ if report_missing
  344. $ then
  345. $ write sys$output "''wrk_spec' is missing"
  346. $ endif
  347. $ goto missing_loop
  348. $ endif
  349. $ else
  350. $ goto missing_loop
  351. $ endif
  352. $!
  353. $ if ref_fname .nes. wrk_fname
  354. $ then
  355. $ write sys$output "''wrk_spc' wrong name, should be ""''ref_fname'"""
  356. $ endif
  357. $!
  358. $ if ref_utype .eqs. ".DIR" then goto missing_loop
  359. $!
  360. $ wrk_ver = f$parse(wrk_chk,,,"VERSION")
  361. $ if wrk_ver .nes. ";1"
  362. $ then
  363. $ write sys$output "Version for ''wrk_spec' is not 1"
  364. $ endif
  365. $!
  366. $ goto missing_loop
  367. $!
  368. $!
  369. $missing_loop_end:
  370. $!
  371. $exit