1 $! Compare_curl_source.com
5 $! This procedure compares the files in two directories and reports the
6 $! differences. It is customized for the vmsports repository layout.
8 $! It needs to be customized to the local site directories.
10 $! This is used by me for these purposes:
11 $! 1. Compare the original source of a project with an existing
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.
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.
22 $! Then the files are are only in the copy directory are listed.
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.
31 $! This needs to be run on an ODS-5 volume.
33 $! If UPDATE is given as a second parameter, files missing or different in the
34 $! copy directory will be updated.
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
42 $! The copy directory is vms_root:[project_name]
43 $! The UPDATE parameter is ignored.
45 $! This setting is used to make sure that the working vms directory
46 $! and the repository checkout directory have the same contents.
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]
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.
55 $! This is to make sure that the backup save set for the unmodified
56 $! source is up to date.
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.
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]
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.
69 $! This is to make sure that the backup save set for the unmodified
70 $! source is up to date.
72 $! Copyright 2011, John Malmberg
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.
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.
86 $! 18-Aug-2011 J. Malmberg
87 $!==========================================================================
89 $! Update missing/changed files.
91 $ if (p2 .eqs. "UPDATE")
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")
109 $ ref_base_dir = myprocdir
110 $ wrk_base_dir = mydir
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
129 $ if p1 .eqs. "SRCBCK"
131 $ ref_base_dir = "curl"
132 $ wrk_base_dir = "curl"
133 $ ref = "src_root:[" + ref_base_dir
134 $ wrk = "src_root1:[" + wrk_base_dir
137 $ if f$search("src_root1:[000000]curl.dir") .eqs. ""
139 $ create/dir/prot=o:rwed src_root1:[curl]
145 $ if p1 .eqs. "VMSBCK"
147 $ ref_base_dir = "curl"
148 $ wrk_base_dir = "curl"
149 $ ref = "vms_root:[" + ref_base_dir
150 $ wrk = "vms_root1:[" + wrk_base_dir
153 $ if f$search("vms_root1:[000000]curl.dir") .eqs. ""
155 $ create/dir/prot=o:rwed vms_root1:[curl]
163 $ write sys$output "Unknown compare type specified!"
168 $! Future - check the device types involved for the
169 $! the syntax to check.
174 $ vax = f$getsyi("HW_MODEL") .lt. 1024
182 $ if .not. ODS2_SYNTAX
184 $ set proc/parse=extended
188 $ ref_spec = f$search("''ref'...]*.*;",1)
189 $ if ref_spec .eqs. "" then goto loop_end
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")
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
206 $! if rel_path .eqs. ".examples.scripts^.noah]"
208 $! rel_path = ".examples.scripts_noah]"
210 $! if rel_path .eqs. ".examples.scripts^.v2]"
212 $! rel_path = ".examples.scripts_v2]"
216 $ wrk_path = wrk + rel_path
218 $ ref_name_type = ref_name + ref_type
224 $ wrk_spec = wrk_path + ref_name_type
227 $ wrk_chk = f$search(wrk_spec, 0)
228 $ if wrk_chk .eqs. ""
232 $ write sys$output "''wrk_spec' is missing"
236 $ copy/log 'ref_spec' 'wrk_spec'
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
246 $ if ref_fname .nes. wrk_fname
248 $ write sys$output "''wrk_spc' wrong name, should be ""''ref_fname'"""
251 $ ref_type = f$edit(ref_type, "UPCASE")
252 $ if ref_type .eqs. ".DIR" then goto loop
256 $ ref_fname = f$edit(ref_fname, "LOWERCASE")
259 $! These files are in the wrong format for VMS diff, and we don't change them.
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. "."
267 $ if f$locate("test", ref_fname) .eq. 0 then ref_skip = 1
268 $ if ref_fname .eqs. "configure." then ref_skip = 1
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
282 $ write sys$output "Skipping diff of ''ref_fname'"
288 $ wrk_ver = f$parse(wrk_chk,,,"VERSION")
289 $ if wrk_ver .nes. ";1"
291 $ write sys$output "Version for ''wrk_spec' is not 1"
294 $ diff/out=nl: 'wrk_spec' 'ref_spec'
295 $ if $severity .nes. "1"
297 $ write sys$output "''wrk_spec' is different from ''ref_spec'"
300 $ delete 'wrk_spec';*
301 $ copy/log 'ref_spec' 'wrk_spec'
312 $! For missing loop, check the latest generation.
313 $ ref_spec = f$search("''wrk'...]*.*;")
314 $ if ref_spec .eqs. "" then goto missing_loop_end
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
323 $ rel_path = ref_dir - "[" - wrk_base_dir
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")
331 $ wrk_fname = wrk_name + wrk_type"
332 $ ref_fname = ref_name + ref_type
335 $ ref_utype = f$edit(ref_type,"UPCASE")
336 $ ref_ufname = f$edit(ref_fname,"UPCASE")
340 $ wrk_chk = f$search(wrk_spec, 0)
341 $ if wrk_chk .eqs. ""
345 $ write sys$output "''wrk_spec' is missing"
353 $ if ref_fname .nes. wrk_fname
355 $ write sys$output "''wrk_spc' wrong name, should be ""''ref_fname'"""
358 $ if ref_utype .eqs. ".DIR" then goto missing_loop
360 $ wrk_ver = f$parse(wrk_chk,,,"VERSION")
361 $ if wrk_ver .nes. ";1"
363 $ write sys$output "Version for ''wrk_spec' is not 1"