I've been working on adding a new linker mapfile check (mapfilechk) to cadmium, patterned on cddlchk, as detailed in the CR:
6785284 Mapfile versioning rules need to be more visible to gatelings In a nutshell, there will be a standard comment in all of the OSnet link-editor mapfiles, and the mapfilechk command will be used to keep them intact. I already have it working, largely by copying cddlchk, and modifying it to suit. However, I've hit a problem with cdm.py that I'd appreciate some help with. mapfilechk examines any file with a name that matches '*mapfile*', and ignores all others. However, there are a small number of files in OSnet that match this pattern that are not actually mapfiles. For instance, mapfilechk itself. I need to have an exceptions list for these files. I am using the .NOT file mechanism supported in cdm.py via the not_check() function. Using cddlchk as an example: def cdm_cddlchk(ui, repo, *args, **opts): ... filelist = opts.get('filelist') or _buildfilelist(repo, args) ... exclude = not_check(repo, 'cddlchk') for f, e in filelist.iteritems(): if e and e.is_removed(): continue elif (e or opts.get('honour_nots')) and exclude(f): ui.status('Skipping %s...\n' % f) continue ... The problem I'm encountering is that the list of files returned by _buildfilelist() is relative to the working directory, while the list of file path exceptions needs to be relative to the workspace root. Consequently, exclude() only matches if my working directory is set to the workspace root. In my exceptions (.NOT) file, I currently have: usr/src/lib/README.mapfiles usr/src/tools/scripts/mapfilechk.1 When I run my mapfilechk command while my working directory is usr/src/tool, I get: % hg mapfilechk Mapfile comment check: Warning: No mapfile header block in file scripts/mapfilechk.1 Warning: No mapfile header block in file ../lib/README.mapfiles which is wrong. If I move to my workspace root however: % cd ../../.. % hg mapfilechk Mapfile comment check: Skipping usr/src/lib/README.mapfiles... Skipping usr/src/tools/scripts/mapfilechk.1... which is correct. Is the use of working directory relative paths for the exclude mechanism intentional? It prevents the use of path components in the .NOT files, which is a pretty big limitation. For the moment, I'm just testing from the root of my workspace, but I can't integrate it this way. I'd appreciate some help with finding a solution that is not working directory dependent. Thanks... - Ali