From 20c9aff1b372231e86d0f5c8b3e43e8d813bebbf Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Thu, 29 Jul 2010 05:57:19 -0700 Subject: architecture/data.mdwn: change global read/write bit to $GIT_DIR/objects --- architecture/data.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/architecture/data.mdwn b/architecture/data.mdwn index 7d6cc97..68b61f6 100644 --- a/architecture/data.mdwn +++ b/architecture/data.mdwn @@ -11,8 +11,8 @@ repoaccess #/etc/group git-$reponame entry # None reponame #/srv/git/$reponame.git # =~ /^[a-z0-9][a-z0-9.-]+$/ repodescription #/srv/git/$reponame.git/description # =~ /^[\x{0020}-\x{FDCF}\x{FDF0}-\x{FFFD}]{1,80}$/ repoowner #stat /srv/git/$reponame.git uid; might be better as first non-ikiwiki user in /etc/group git-$reponame entry # None -repoglobalwritable #stat /srv/git/$reponame.git all write bit # None -repoglobalreadable #stat /srv/git/$reponame.git all read bit # None +repoglobalwritable #stat /srv/git/$reponame.git/objects o+w bit # None +repoglobalreadable #stat /srv/git/$reponame.git/objects o+r bit # None repoikiwikidisable #UNDECIDED; probably in /srv/git/$reponame.git # None repointernaltemplates #UNDECIDED; probably in /srv/git/$reponame.git # None repospecialdomain #UNDECIDED; probably in /srv/git/$reponame.git # None -- cgit v1.2.3 From fa904279c38a28fd95af00012b4ebfa354b9e34e Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sun, 1 Aug 2010 20:08:20 -0700 Subject: Supporting per-repo config stuff. --- usr/src/libpiny/debian/changelog | 7 +++++++ usr/src/libpiny/debian/control | 2 +- usr/src/libpiny/lib/Piny/Repo.pm | 44 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/usr/src/libpiny/debian/changelog b/usr/src/libpiny/debian/changelog index 3dcd6c4..859caa4 100644 --- a/usr/src/libpiny/debian/changelog +++ b/usr/src/libpiny/debian/changelog @@ -1,3 +1,10 @@ +libpiny-perl (0.12) unstable; urgency=low + + * Support for per-repo configuration in the git config, section piny. + * Support for per-repo custom http/https base URLs. + + -- Julian Blake Kongslie Sun, 01 Aug 2010 20:07:44 -0700 + libpiny-perl (0.11) unstable; urgency=low * Destroying dead repos. diff --git a/usr/src/libpiny/debian/control b/usr/src/libpiny/debian/control index a626cd8..04f501e 100644 --- a/usr/src/libpiny/debian/control +++ b/usr/src/libpiny/debian/control @@ -7,7 +7,7 @@ Standards-version: 3.8.4 Package: libpiny-perl Architecture: all -Depends: ${perl:Depends}, ${misc:Depends}, libemail-valid-loose-perl, libmoose-perl, libmoosex-singleton-perl +Depends: ${perl:Depends}, ${misc:Depends}, libconfig-tiny-perl, libemail-valid-loose-perl, libmoose-perl, libmoosex-singleton-perl, libyaml-tiny-perl Description: Perl interface for the piny infrastructure This is a set of modules for accomplishing administrative tasks in the piny.be infrastructure. diff --git a/usr/src/libpiny/lib/Piny/Repo.pm b/usr/src/libpiny/lib/Piny/Repo.pm index 8b2045c..de8501b 100644 --- a/usr/src/libpiny/lib/Piny/Repo.pm +++ b/usr/src/libpiny/lib/Piny/Repo.pm @@ -6,6 +6,7 @@ package Piny::Repo; use Moose; use Moose::Util::TypeConstraints; +use Config::Tiny qw( ); use File::Find qw( find ); use File::Temp qw( ); use IO::Dir qw( ); @@ -162,6 +163,13 @@ has 'apache_config' => , init_arg => undef ); +has 'config' => + ( is => 'ro' + , isa => 'HashRef[Str]' + , lazy_build => 1 + , init_arg => undef + ); + # Public methods sub add_access { @@ -515,13 +523,21 @@ sub _build_ikiwiki_srcdir { sub _build_ikiwiki_url { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_url . $s->name; + if ( defined $s->config->{"http_url"} ) { + return $s->config->{"http_url"} . $s->name; + } else { + return Piny::Config->instance->ikiwiki_url . $s->name; + }; }; sub _build_ikiwiki_cgiurl { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_secure_url . "repos/" . $s->name . "/ikiwiki.cgi"; + if ( defined $s->config->{"https_url"} ) { + return $s->config->{"https_url"} . "repos/" . $s->name . "/ikiwiki.cgi"; + } else { + return Piny::Config->instance->ikiwiki_secure_url . "repos/" . $s->name . "/ikiwiki.cgi"; + }; }; sub _build_secure_path { @@ -539,13 +555,21 @@ sub _build_ikiwiki_cgipath { sub _build_ikiwiki_historyurl { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/log/[[file]]"; + if ( defined $s->config->{"https_url"} ) { + return $s->config->{"https_url"} . "cgit/" . $s->name . "/log/[[file]]"; + } else { + return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/log/[[file]]"; + }; }; sub _build_ikiwiki_diffurl { my ( $s ) = @_; - return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/diff/?id=[[sha1_commit]]"; + if ( defined $s->config->{"https_url"} ) { + return $s->config->{"https_url"} . "cgit/" . $s->name . "/diff/?id=[[sha1_commit]]"; + } else { + return Piny::Config->instance->ikiwiki_secure_url . "cgit/" . $s->name . "/diff/?id=[[sha1_commit]]"; + }; }; sub _build_apache_config { @@ -554,6 +578,18 @@ sub _build_apache_config { return "secure_path . ">\n AuthPAM_Enabled on\n AuthGROUP_Enabled on\n AuthPAM_FallThrough off\n AuthBasicAuthoritative off\n AuthType Basic\n AuthName \"User access to " . $s->name . " repository needed.\"\n Require group " . $s->group->name . "\n\n"; }; +sub _build_config { + my ( $s ) = @_; + + my $c = Config::Tiny->read( $s->path . "/config" ); + + if ( defined $c and defined $c->{"piny"}) { + return $c->{"piny"}; + } else { + return { }; + }; +}; + # Moose boilerplate __PACKAGE__->meta->make_immutable; -- cgit v1.2.3