Commit graph

42 commits

Author SHA1 Message Date
Sitaram Chamarty e1c7e546aa cpu-time command -> CpuTime trigger module...
...now that triggers are not restricted to external programs and can be
perl code called by gitolite-shell (thus in the same PID), there's no
need to compute and pass along the times() array.

This also changes the arguments to POST_GIT; they're now the same as
PRE_GIT's.
2012-04-06 17:26:27 +05:30
Sitaram Chamarty 8df28a02db (minor) comments and clarifications in default rc 2012-04-04 05:01:10 +05:30
gitolite tester 8e8ccb50f4 additions to default rc (commented out) for mirroring 2012-04-02 13:18:30 +05:30
Sitaram Chamarty b78466b164 put the VERSION file in the right place
I don't know why I had put VERSION in GL_ADMIN_BASE, which is pretty
stupid.  It should be in GL_BINDIR.

It also has nothing to do with setup -- the file needs to be generated
at 'install' time.
2012-04-02 13:18:30 +05:30
Sitaram Chamarty 906ed4cbe2 logging, tracing, and perltidy, ...
...plus renamed a couple of log events for consistency
2012-03-30 23:07:46 +05:30
Sitaram Chamarty 2bec551009 'writes' -> 'writable', order of arguments changed 2012-03-27 19:42:30 +05:30
gitolite tester cc8b10483b allow perl modules as triggers also...
...and move "check_repo_write_enabled" to that mode ("writable")
2012-03-27 19:42:30 +05:30
Sitaram Chamarty 1cf062fad5 ACCESS_CHECK split into ACCESS_1 and ACCESS_2; docs updated 2012-03-27 19:42:30 +05:30
Sitaram Chamarty 61f6967f67 partial-copy fixed...
...there was one real bug, plus I had forgotten to put a comented out
line in the rc file, but most of the rest of the effort was moving the
test script over.

oh and I'd also forgotten to move this from 'commands' to 'triggers' :-)
2012-03-26 21:27:49 +05:30
Sitaram Chamarty 07cf7fedfe move triggers into their own subdir...
...otherwise 'gitolite help' was getting too confusing, mixing up stuff
that users should not be running directly (even on the server)

----

implementation notes:

those who are worried about the '../triggers/' in various parts of the
code here, remember you can only do that from a command line on the
server.  Remote users can only use commands that have been explicitly
listed in the COMMANDS hash in the rc file.  This means they can't even
access other commands in the same directory as, say, the 'info' command,
so a '../' is definitely not going to work.
2012-03-26 11:02:57 +05:30
Sitaram Chamarty 2139099706 arguments in rc for triggered programs...
...using 'renice' as example and first user

(also had to re-arrange rc file to a more sensible order)
2012-03-25 12:17:37 +05:30
Sitaram Chamarty 3ed923f503 new check-g2-compat, lots of migration related changes
- rc differences moved to their own file
  - main g2migr now helps interpret output of check-g2-compat
  - Gitolite::Compat gone; no point...
2012-03-25 09:43:23 +05:30
Sitaram Chamarty 0748b1225b external programs can get settings from rc; see below
non-core programs can get their settings from the rc file also.
cpu-time is a perl example and desc is a shell example.

(info is not a good example because it does not use "Gitolite::Easy")
2012-03-24 10:30:46 +05:30
Sitaram Chamarty 0b8b144630 trigger prefixes an extra first argument -- the trigger name 2012-03-24 10:30:46 +05:30
Sitaram Chamarty 14e1354433 query-rc learns '-q' option 2012-03-24 10:30:45 +05:30
Sitaram Chamarty e9ea674be9 (minor) fixup various TODOs and such
some got junked, some were already done or got done, and some were
converted into actual todo items in the 'todo' file.
2012-03-24 10:30:45 +05:30
Sitaram Chamarty 1c590e633f run compat checks when old rc found
(also removed legacy-delegation sugar script)
2012-03-24 10:30:45 +05:30
Sitaram Chamarty 320356d66c cleaned up logging quite a bit; details:
- a remote "id" (usually the IP) is generated and logged on the first
    log message in a "transaction"

  - speaking of which, a new "transaction ID" is logged that stays the
    same for each input command/invocation, tying together all the
    spawned commands

  - so now time stamps can be generated each time they are needed,
    rather than re-use the one at the beginning

  - log messages have a keyword at the start now
        remote, (create), check1 -- from gitolite-shell
        update, check2 -- from update
        post-up -- from post-update
        command -- from gitolite
        die, system -- from anywhere
2012-03-24 10:30:45 +05:30
Sitaram Chamarty bb9f045ec3 trigger POST_CREATE from user actions
- uncomment the POST_CREATE section in rc by default now
  - have perms call 'gitolite trigger POST_CREATE'
2012-03-24 10:30:45 +05:30
Sitaram Chamarty 98a6b08ff4 'desc' command added (manually smoke tested only; no test script) 2012-03-24 10:30:45 +05:30
Sitaram Chamarty 999f9cd39d make site-local scripts easier to write
- new Gitolite::Easy module hides all the other stuff
  - (put GL_ADMIN_BASE and GL_REPO_BASE into %ENV)
  - new 'gitolite creator' shell command
  - 'writes' command modified to use Gitolite::Easy.  It is also the
    only dual mode command -- it can be invoked remotely as well as
    locally.  I deem that the required trick to make other remote-only
    commands work locally is too much trouble for what is probably a
    rarely used command.
2012-03-24 10:30:45 +05:30
Sitaram Chamarty af11919025 git-configs update code done 2012-03-24 10:30:44 +05:30
Sitaram Chamarty b1a75b7889 gitweb/daemon post-create scripts done 2012-03-24 10:30:44 +05:30
Sitaram Chamarty d853c58ada (!!) trigger mechanism... read below
new triggers:

  - PRE_GIT and POST_GIT in gitolite-shell
  - PRE_CREATE and POST_CREATE when a new wild repo is created
  - (POST_COMPILE had already existed)
  - ACCESS_CHECK triggers both in gitolite-shell and the update hook

  - trace() learned to print the file name if called from top level and
    a function name is not available

note: trigger was called 'run-all' and only had POST_COMPILE.  The code
existed in gitolite-shell, but is now moved to Rc.pm.
2012-03-24 10:30:44 +05:30
Sitaram Chamarty 4c1017a529 new sugar 'legacy-delegation-abort', enabled by default 2012-03-24 10:30:44 +05:30
Sitaram Chamarty e743cab1a3 perms command done (smoke tested) 2012-03-24 10:30:43 +05:30
Sitaram Chamarty 44e6bc4bb2 logging (but see below)
The logging is both for paranoia and parsing/automated processing.  The
ones you're probably interested in parsing should be easy to pick out
and are very likely to have tab-delimited fields already.
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 941de722da gl-perms handling and roles, first cut
(additional memberships that user has when accessing a specific repo)
2012-03-24 10:30:43 +05:30
Sitaram Chamarty f21d17e086 git_configs almost done, but
real testing can only happen after wildrepos is finished (specifically,
when memberships() can return regex repo names also)
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 876b554fb5 changes to custom command invocation etc.; see below
- 'post-compile' subdir moved under 'commands/' but only for
    sanity; has no real significance now

  - new, internal use only, gitolite command run-all, as in

        gitolite run-all POST_COMPILE

    which runs all the commands in @{ $rc{POST_COMPILE} } in sequence.
    You can sdo this for any section of course, though this is the only
    one in the rc right now.

    (Future candidates: PRE_GIT, POST_GIT, PRE_CREATE, POST_CREATE)
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 38cb9bfda9 trace messages rationalised to 3 levels 2012-03-24 10:30:43 +05:30
Sitaram Chamarty 8714b77eae (perltidy) 2012-03-24 10:30:43 +05:30
Sitaram Chamarty afcd974afa record and maintain a 'version' (for info and elsewhere) 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 876f6517f5 (testing help) allow a *testing* rc to override the normal one 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 7f8020adc5 'info' command, plus lots more changes:
- usage() gets a little smarter; it now knows what function it was called
    from and tries to find a '=for function_name' chunk of data in the script

  - the various list-* functions now work off a dispatcher in Load.pm
  - (...and they all use the new usage() magic to print their helps!)

  - src/gitolite got a lot leaner due to this dispatcher

  - src/gitolite-shell became a lot more easier to read/flow

  - rc acquired '{COMMANDS}', which gitolite-shell now refers to
  - comments in the default rc file changed a bit
  - rc got a new REMOTE_COMMAND_PATT (in place of ADC_CMD_ARGS_PATT)

the rest is perltidy and stuff like that
2012-03-24 10:30:42 +05:30
Sitaram Chamarty 0aeb0cd5e2 ssh-authkeys done! 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 84422ccf30 (rc) prefix GL_BINDIR to PATH
Needed when the user didn't actually "install" but is just running it by
using the full path to "gitolite".  Without this, every time my code
runs "gitolite <some sub-command>" I have to prefix "gitolite" with
$ENV{GL_BINDIR}, which is kinda painful...
2012-03-24 10:30:42 +05:30
Sitaram Chamarty 428485086f query-rc learned '-n' to avoid the need to chomp() the result 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 877f6eb31b catch older gitolite.rc and die gracefully 2012-03-24 10:30:41 +05:30
Sitaram Chamarty a9d5adcd10 example sugar script 'continuation-lines' added 2012-03-24 10:30:41 +05:30
Sitaram Chamarty 379b0c9549 install/test made easy (WARNING: read below)
(1) testing is very easy, just run this from a clone

        t/g3-clean-install-setup-test

    BUT BE WARNED THIS IS DESTRUCTIVE; details in t/WARNING

(2) install is equally simple; see 'INSTALL' in the main directory
2012-03-24 10:30:41 +05:30
Sitaram Chamarty 8ffc5307d6 (lotsa files affected) rc file format changed; see below
The rc file used to be a bunch of variables, each one requiring to be
declared before being used.  While this was nice and all, it was a
little cumbersome to add a new flag or option.

If you disregard the "catch typos" aspect of having to predeclare
variables, it's a lot more useful to have all of rc be in a hash and use
any hash keys you want.

There could be other uses; for instance it could hold arbitrary data
that you would currently put in %ENV, without having to pollute %ENV if
you don't need child tasks to inherit it.

----

NOTE: I also ran perltidy, which I don't always remember to :)
2012-03-24 10:30:41 +05:30