2 messages in com.perforce.perforce-user[p4] maintaining p4 protect tables| From | Sent On | Attachments |
|---|---|---|
| Grills, Jeff | 20 May 2003 15:24 | |
| Chuck Karish | 21 May 2003 13:32 |
| Subject: | [p4] maintaining p4 protect tables![]() |
|---|---|
| From: | Grills, Jeff (jgri...@soe.sony.com) |
| Date: | 05/20/2003 03:24:43 PM |
| List: | com.perforce.perforce-user |
I recently wrote a script to maintain our perforce protect table in a more sane manner. I traded some emails with the perforce tech support while working on it, and they suggested posting it to the public depot and announcing it on this list. So here it is. Here's the readme and a sample "high level" protection table.
j
----- readme -----
Have you ever been frustrated with the p4 protect table? I know I have. So, I decided to do something about it. I have written a perl script which processes a higher-level protection table and generates a perforce-compatible one. An example of the higher-level table is in the file "sample" located in the same directory as this readme.
The main thing I realized is that I wanted to control access primarily by directory, and I also wanted to be able to comment the file. You'll notice that the file has lines that start with perforce file specifications, followed by the access lines for the specification. Multiple specifications can be placed together, and multiple access lines can come after them, which will generate one protection line for each file specification and access line pair. Lines that begin with // or -// are considered file specifications, and lines that begin with the pound sign (#) are comments. Leading and trailing whitespace is ignored. All other lines are treated as access lines. The script will generate output in the order of the input access lines.
You should run the script like this:
perl protect.pl sample > protect.txt (examine protect.txt here to make sure it's correct) p4 protect -i < protect.txt
You can, of course, pipe the output directly into p4 protect like so:
perl protect.pl sample | p4 protect -i
The script does not support IP ranges, but if you would like to add it I'd be happy to integrate the changes when you are done. It should be trivial to do for someone that knows perl.
jeff grills
----- sample -----
# ---------------------------------------------------------------------- # //depot/project/current # ----------------------------------------------------------------------
//depot/project/current/data/... write group project_designers write group project_leads write group project_programmers read user proxy
//depot/project/current/doc/... write group project_designers write group project_leads write group project_programmers
-//depot/project/current/doc/leads/... list user *
//depot/project/current/doc/leads/... write group project_leads
//depot/project/current/src/... write group project_programmers read user proxy
//depot/project/current/src/a/b/c/special_one.h //depot/project/current/src/a/b/c/special_two.h //depot/project/current/src/a/b/c/special_three.h write user trusted_one write user trusted_two write user trusted_three
# ---------------------------------------------------------------------- # user directories # ----------------------------------------------------------------------
//depot/user/jgrills/... write user jgrills read user proxy
# ---------------------------------------------------------------------- # counter access # ----------------------------------------------------------------------
//depot/review/... review user jgrills
# ---------------------------------------------------------------------- # keep super last # ----------------------------------------------------------------------
//... super user perforce




