This is a README for P4DB, a CGI based p4 depot browser written by Fredric Fredricson (fredric@mydata.se) (One part is written by Bob Sidebotham, no email available). The README is intended for administrators and others that want to install, maintain, and possibly contribute to, P4DB.
P4DB is designed to provide a
user friendly and intuitive interface to the p4 depot. Information is presented
using a web browser and most pages combine output from two or more p4 commands.
The driving force behind the development
has been my needs as a manager for a software team, the needs for our project
leaders to document changes in the code line and the need for our programmers
to analyze changes in the code line (and most important, of course, the
need for me as a frustrated software engineer promoted to my level of incompetence
to get my hands on a nice little programming project).
The browser is written in perl and developed on a Linux/Apache system and has been tested mainly with Netscape 4 although some of our users use MS Explorer and no problems has been reported.
P4DB is inspired by a depot browser, perfbrowse.perl, made available by Perforce at http://www.perforce.com/perforce/loadsupp.html#browse Perfbrowse.perl is written in perl and the author is unknown to me.
The idea is also stolen so I can't claim that one.
To view file a script by Bob Sidebotham called p4pr.perl is used. This script is also made available by Perforce at http://www.perforce.com/perforce/loadsupp.html#util (but I made some minor changes and one bug fix).
I liked perfbrowse.perl very much but wanted just a little more
functionality. I started to add functionality and it quickly got out
of hand. Soon I had a huuuge perl script that I could no
longer maintain.
Once I realized that I can write a perl script that is
about 2-4 times the size of the script that I can maintain I decided to
rewrite it all from the start as a set of small, maintainable, perl scripts.
I leave to others to judge if I succeeded in my mission.
(Maybe I should mention that it took much more time than I anticipated).
P4DB version 2.01 requires:
There is no real "list of supported platforms" simply because there is no real "support" for P4DB. I just write it, test it, and release it.
Http server:
P4DB is developed on a Linux box running
Suse 6.3 and Apache 1.3.9 , runs in production on RedHat 6.2/Apache 1.3.9,
and has been reported to run on SUN/Solaris and NT/IIS platforms as well.
The NT platform require MKS toolkit or similar and some tweaking, though.
Browser:
All development work is done using Netscape
4.7 but I perform some basic testing with MS-Explorer.
I expect P4DB to work reasonably well with any GUI browser
like Mozilla or Opera. because P4DB use almost only plain HTML
and just a little CSS (Cascaded Style Sheets).
P4DB is not designed for character mode browsers such as Lynx.
And, by the way, the browser should support cookies.
NOTE: This installation description assumes that the reader is familiar with http servers, cgi scripts and, to a small degree, perl.
Other than the obvious, that is somewhere in a http servers CGI path, I recommend you to set up a http server on your p4 server and run P4DB on that server. The main reasons are that it improves response time and reduce network load.
This is the theory, at least. I have not tested it on many systems
If install.pl don't work for you here is what it does that you need to do manually:
The basic configuration file is named P4DB.conf. The file is not included in the package but a sample configuration file called P4DB.conf.txt is.
Copy the file P4DB.conf.txt to P4DB.conf and modify it. The instructions are included in the file.
Security Note 1: Since the DEPOT field in the configuration file may contain passwords for p4 users it may be wise to move the file outside the file tree reachable by the web server. The path to the configuration file is specified at the top of P4CGI.pm.
Security Note 2 P4DB does not provide any access protection or other security. It is not possible to modify the depot using P4DB so poorly trained or inexperienced operators should not be able to damage the depot. If this security is not enough you have to rely on the authentication provided by the web server.
You must specify a p4 user for P4DB. If I understand Perforce Licensing policies correctly you should not have to use a separate user license for this user, but this is just my interpretation and I recommend that you verify this with Perforce.
It is possible to add a set of links to the P4DB index page using a "shortcut file". The idea is to add links that function as shortcuts into P4DB for the users. There can be more than one shortcut file and the user can select his/her favorite in the "set preferences" page.
The shortcut file is format is HTML plus some extra tags and comment syntax added by P4DB. The HTML code is inserted into the P4DB index page. There are no limits imposed by P4DB to the HTML code but there are an infinite number of bad ideas to avoid (like, for example, inserting a </BODY> tag in the shortcut file). Ill-formed HTML will probably break the index page.
Syntax | <P4DB>....</P4DB> |
---|---|
Attribute specifications |
These are the most important attribute specifications. More can be found if you study the URLs generated when you browse around in P4DB. The attributes corresponds more or less directly to the URL parameters. The one exception is the job list where field names are translated to field codes in the URL. |
Two sample shortcut files are included with the distribution: P4DB.shortcuts.txt and P4DB.shortcuts2.txt.
P4DB will let users view some file types using applications like MS-Word for Word-file etc. This can be configured in a file viewConfig.pm. Default will let you view HTML, gif, jpeg, MS-Word, MS-Powerpoint, and Acrobat (PDF) formats. See file viewConfig.pm for details.
Configuration file for 2.0 not compatible with 2.01
The difference is so huge that I do not care to list it. P4DB 2.0 can simply do much more than earlier versions.
There is no license for P4DB.
You are free to use, modify, resell, repackage, make money from (ha!),
P4DB. Your conscience is the limit ;-).
I might decide to apply GPL to it some
time in the future but I doubt that I will bother....
If you get any problems because of these scripts I promise to feel sorry for you. Other than that you are on your own.
Please note for the record that I do not even claim that
P4DB can be used to browse the P4 depot. I will also inform
you that even though the intention is that P4DB should not
in any way modify the depot
status I can make no promises that this is can not happen.
And please remember that it would be easy for someone to grab the
P4DB code, insert a few malicious lines of code, and
"release" it with this "Trojan Horse".
If you would like to contribute changes/improvements/new functions feel free to do so and mail them to me and I will add them to the next "release" (flames and flattery are also welcome).
Disclaimer: I may grow tired of this project or change job or die or something in which case my promise above probably expires.
I will be glad for any kind of contributions ranging from corrections of my bad English to new interesting functionality. Nice letters are also welcome.
The most important documentation is in the P4CGI.pm module. This modules is used by all scripts and contains a set of common functions that are useful or defines some common "look and feel" or both.
The P4CGI.pm module is documented using
perlpod (see perlpod man page). To get a HTML page
containing documentation
type:
pod2html P4CGI.pm >P4CGI.html
(There is one distributed with P4DB, for convenience)
For other files: more often than not the code is commented.
There are three different files 'types' in the design:
The code also uses the CGI.pm perl module. This module should be part of the "standard distribution" of perl (if there is such a thing). If you do not have the module it is available for download at www.cpan.org.
As a part of my personal religion the -w flag is always turned on and 'use strict' flag is also set. I have never had any reason to regret this particular peculiarity of mine but it might cause some warning messages that will be printed to the browsers error log.
Performance has not been a great issue. I assume that these cgi's will not have thousands of hits each day and the design has focused on ease of development rather than speed.
P4CGI.pm | A perl package that contains common functions |
index.cgi | Entry point or "main" cgi |
SetPreferences.cgi | Set user preferences
User preferences are stored in a cookie. If cookies are not enabled the user can not modify the user preferences and the default setting will be used. |
branchList.cgi | List branches |
branchView.cgi | View information about a branch |
changeByUsers.cgi | Select a set of users and groups to view changes for. Calls changeList.cgi to do the job. |
changeList.cgi |
List changes
NOTE: |
changeView.cgi | View a change |
clientList.cgi | List clients |
clientView.cgi | View a client spec. |
colorView.pm | Perl module used by fileViewer.cgi to handle color display of some file types. |
colorC.pl colorHtml.pl colorPerl.pl | Special designed filters that adds colors to C/C++ (colorC.pl), HTML code (colorHtml.pl) and perl (colorPerl.pl). The filters are quick hacks and more like demo examples. |
depotStats.cgi | View depot statistics |
depotTreeBrowser.cgi | Browse the depot file tree |
fileDiffView.cgi | View diff between two files or two revisions |
fileDownLoad.cgi | Download files |
fileLogView.cgi | View file history |
fileOpen.cgi | List open files |
fileSearch.cgi | Search for file matching file spec |
fileViewer.cgi | View a file |
filesChangedSince.cgi | List recently modified files |
groupView.cgi | View a group |
htmlFileView.cgi | "Smart" html file viewer that translates relative links to links into the depot |
javaDataView.cgi |
Java depot browser cgi
Provides data for java part of depot browser |
jobList.cgi | List jobs |
jobView.cgi | View info about a job |
labelDiffView.cgi |
Label diff viewer
View diff between two labels |
labelList.cgi | Display a list of all labels |
labelView.cgi | List info about a label |
p4race.cgi | The p4 submit race |
searchPattern.cgi |
Specify a search for a pattern in description field in changes.
Calls changeList.cgi to do the actual job. |
specialFileView.cgi |
Special
file viewer
Special file viewer for HTML, JPEG, GIF , MS-Word, MS-Powerpoint, RTF, and PDF file types. Downloads files with the appropriate Content-Type |
userList.cgi | Display a list of all users |
userView.cgi | View info about a user |
p4jdb/P4DirTreeApplet.java p4jdb/P4DirTree.java P4Jdb/P4File.java p4jdb/P4Folder.java p4jdb/TreeDisplay.java | Java source code for the GUI depot tree browser. |
Makefile | Make file for java classes (GNU make) |
p4jdb/*.class | Java files compiled from the .java files above |
An incomplete list of people that has contributed to P4DB in different ways:
There are more but these are the only names I found in my records.