•  
      request #6549 Interface gitweb with tuleap
    Infos
    #6549
    Nouha Terzi (terzino)
    2014-07-04 09:31
    2014-03-25 15:38
    6618
    Details
    Interface gitweb with tuleap
    As a git user
    I would like to display my git repository using gitweb
    In order to have more options than gitphp

    This feature, should respect gitolite permisisons, project privacy and users status.
    SCM/Git
    Empty
    Empty
    • [x] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Nouha Terzi (terzino)
    Closed
    2014-07-04
    Attachments
    References
    Referencing request #6549

    Artifact Tracker v5

    rel #7022 7.3
    Referenced by request #6549

    Follow-ups

    User avatar
    • Status changed from New to Closed
    • Assigned to changed from None to Nouha Terzi (terzino)
    • Close date set to 2014-07-04
    User avatar

    Back here as I have to attach thing to move forward.

    I get the exact same behaviour than my comment on centos5 one month ago

    Can't locate object method "quote" via package "db_connect" (perhaps you forgot to load "db_connect"?) at tuleap.pl line 87.

    I attach the package I generate so you can test on your side. If it works for you, I'll publish it.


    User avatar
    Just in case of, I made comments on the review.

    PS: I suppose you read the notification email, hence I will not update this artifact each time I'm reviewing the code.
    User avatar
    I don't get the question. I should be root for what, to run rpmbuild ?
    Why should I be root ?


    mock is the only clean way to build a rpm (and to guarranty there is no dependency with the environment), it cannot be run as root.
    User avatar

    I didn't manage to build the package with mock (mock allows to build a rpm a fully clean environement):

    $> time mock --autocache --arch=x86_64 -r centos-5-x86_64 /tmp/gitweb-tuleap-1.8.2.1-1.src.rpm
    Installing /builddir/build/SRPMS/gitweb-tuleap-1.8.2.1-1.src.rpm
    Building target platforms: x86_64
    Building for target x86_64
    Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.92295
    + umask 022
    + cd /builddir/build/BUILD
    + LANG=C
    + export LANG
    + unset DISPLAY
    + cd /builddir/build/BUILD
    + rm -rf gitweb
    + tar -xf /builddir/build/SOURCES/gitweb-1.8.2.1.tar.gz
    + cd gitweb
    ++ /usr/bin/id -u
    + '[' 500 = 0 ']'
    ++ /usr/bin/id -u
    + '[' 500 = 0 ']'
    + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + cd ..
    + echo 'Patch #0 (0001-Allow-browsing-repository-regarding-user-permissions.patch):'
    Patch #0 (0001-Allow-browsing-repository-regarding-user-permissions.patch):
    + patch -p1 -s
    + cd gitweb
    + cat
    + sed -e 's|@PROJECTROOT@|/var/lib/codendi/gitolite/repositories|g' /builddir/build/SOURCES/gitweb.conf.in
    + sed -i 's/^#our $projectroot/our $projectroot/g' gitweb.conf
    + sed -i -e '$a\our $projects_list = \"/var/lib/gitolite/projects.list\";' gitweb.conf
    + exit 0
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.92295
    + umask 022
    + cd /builddir/build/BUILD
    + cd gitweb
    + LANG=C
    + export LANG
    + unset DISPLAY
    + make prefix=/usr
        SUBDIR ../
    make[1]: *** No rule to make target `GIT-VERSION-FILE'.  Stop.
        GEN gitweb.cgi
        GEN static/gitweb.js
    + exit 0
    Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.92295
    + umask 022
    + cd /builddir/build/BUILD
    + cd gitweb
    + LANG=C
    + export LANG
    + unset DISPLAY
    + make install gitwebdir=/usr/share/gitweb-tuleap GITWEB_PROJECTROOT=/var/lib/codendi/gitolite/repositories bindir=/usr/bin
        SUBDIR ../
    make[1]: *** No rule to make target `GIT-VERSION-FILE'.  Stop.
    install -d -m 755 '/usr/share/gitweb-tuleap'
    install: cannot create directory `/usr/share/gitweb-tuleap': Permission denied
    make: *** [install] Error 1
    error: Bad exit status from /var/tmp/rpm-tmp.92295 (%install)
    
    RPM build errors:
        Bad exit status from /var/tmp/rpm-tmp.92295 (%install)

    In order to reproduce, you need to generate a src.rpm out of https://tuleap.net/plugins/git/tuleap/deps/tuleap/gitweb-tuleap (rpmbuild -bs) and then run mock

     

    User avatar
    Nouha Terzi (terzino)2014-05-15 13:11
    We are going to test the deployment on centos 5 + git 1.8.

    Is there any risk while upgrading the git version?
    User avatar

    \o/ I managed to got it works on a brand new CentOs 6.5 machine with rpmforge packages

    What I did:

    1. yum install --enablerepo=rpmforge-extras gitweb
    2. deploy gitweb.pl from your branch into /usr/share/tuleap/plugins/git
    3. edit /etc/gitweb.conf according to the README
    4. Apply the patch for gitweb
      1. patch -p 1 /usr/share/gitweb/gitweb.cgi < /tmp/gitweb.patch
    5. edit gitweb.cgi according to the README
    6. chown -R gitolite:gitolite /usr/share/gitweb
    7. touch /var/lib/tuleap/gitolite/repositories/gpig/blabla.git/export_repo_ok
    8. Deploy the following gitweb apache conf into /etc/httpd/conf.d/tuleap-plugins/gitweb.conf
    9. restart apache, it works
      Alias /gitweb /usr/share/gitweb
      
      <Directory /usr/share/gitweb>
          Options +ExecCGI
          AddHandler cgi-script .cgi
          DirectoryIndex gitweb.cgi
      </Directory>
      
      <Location /gitweb>
              AuthType Basic
              AuthName "Private Gitweb Access"
              Require valid-user
      
              AuthMYSQLEnable on
              AuthMySQLUser dbauthuser
              AuthMySQLPwEncryption md5
              AuthMySQLPassword dbpassword
              AuthMySQLDB tuleap
              AuthMySQLUserTable "user"
              AuthMySQLNameField user.user_name
              AuthMySQLPasswordField user.user_pw
              AuthMySQLUserCondition "user.status IN ('A', 'R')"
      </Location>

    On Centos5 + git 1.8 still no luck, event with the modification you suggested.

    What I can propose is:

    • I'll review and check with my working environement on centos6 (esp. gitweb.pl in tuleap sources and gitweb.cgi modifications)
    • I cannot commit for this to be working on Centos5 as I cannot reproduce a working environement on my own. It will be your responsability.

    What is not really fixed yet is the packaging:

    • On centos5, with git provided by epel, gitweb-tuleap should be based on that and apply the patch you developed (so git 1.8.2.1 at the time of writing). It also means that you shoud upgrade to git 1.8.2.1
    • On centos6, with git provied by rpforge, gitweb-tuleap should be based on this version: gitweb-1.7.12.4-1.el6.rfx.

    What do you think ?

     
    User avatar
    Nouha Terzi (terzino)2014-05-14 16:08
    last edited by: Nouha Terzi (terzino) 2014-05-14 16:17

    I tested on a CentOs 6.4 x86_64. My perl version is v5.10.1.

    Could you please modify this line 87 at /usr/share/tuleap/plugins/git/gitweb.pl to &db_connect;

    User avatar
    Whow...
    Where this issue can come from ?
    Code ?
    Configuration ?
    Other ?

    On which platform did you test ?
    User avatar
    Ahmed HOSNI (hosniah)2014-05-07 16:40

    Hi Manuel,

    It works properly for me on my dev environement ( centos 5.8 i386 running perl V5.8.8) and T&I server (centos 5.9 x86_64 running perl V5.8.8).

    I put the Tuleap customisation part (attached above) under /usr/share/codendi/src/utils

    [root@crx19007 utils]# pwd
    /usr/share/codendi/src/utils
    [root@crx19007 utils]# perl -wc gitweb.pl
    gitweb.pl syntax OK

     

    Regards,

    Ahmed

    User avatar
    I don't know, I'm not a perl expert, I don't understand the issue I get :/

    Does it work for anyone else on your side ?
    User avatar
    Nouha Terzi (terzino)2014-05-07 13:54
    I've the the same result :/

    How can we progress? Does anyone else can test with us?
    User avatar
    [root@shunt:~] # perl -wc /usr/share/tuleap/plugins/git/gitweb.pl
    Scalar value @user_row[0] better written as $user_row[0] at /usr/share/tuleap/plugins/git/gitweb.pl line 21.
    Scalar value @repo_row[0] better written as $repo_row[0] at /usr/share/tuleap/plugins/git/gitweb.pl line 64.
    Scalar value @user_row[0] better written as $user_row[0] at /usr/share/tuleap/plugins/git/gitweb.pl line 79.
    Scalar value @row[0] better written as $row[0] at /usr/share/tuleap/plugins/git/gitweb.pl line 146.
    Name "main::res" used only once: possible typo at /usr/share/tuleap/plugins/git/gitweb.pl line 39.
    /usr/share/tuleap/plugins/git/gitweb.pl syntax OK

     

    User avatar
    Nouha Terzi (terzino)2014-05-06 16:57
    Hello Manuel,

    What is the result of this command, please:
    perl -wc /usr/share/tuleap/plugins/git/gitweb.pl

    regards,
    Nouha
    User avatar

    Sorry I was busy with Tuleap7 I didn't had time to have a look at your proposal. I just did what you propose but I still have the same error.

    My code looks like (plugins/git/gitweb.pl):

    ---------------------------------------------------------------------------------
    use warnings;
    use DBI;
    
    #our $utils_path = $ENV{'CODENDI_UTILS_PREFIX'} || "/usr/share/tuleap/src/utils";
    require "/usr/share/codendi/src/utils/include.pl";
    
    ##### Fix issues with Codex permissions #####
    ---------------------------------------------------------------------------------

     

     
    User avatar
    Nouha Terzi (terzino)2014-04-22 15:58
    The include.pl seems to be not recognized. It is may be a path issue @:
    our $utils_path = $ENV{'CODENDI_UTILS_PREFIX'} || "/usr/share/tuleap/src/utils";
    require $utils_path."/include.pl";
    could you please hardcode you right path to the include.pl file in the script?
    User avatar
    The HTML is still the same:
    Can't locate object method &quot;quote&quot; via package &quot;db_connect&quot; (perhaps you forgot to load &quot;db_connect&quot;?) at /usr/share/tuleap/plugins/git/gitweb.pl line 87.
    User avatar
    Nouha Terzi (terzino)2014-04-22 15:15
    Could you please revert the patch and send us back your html. I don't think it is the same RC for the broken display since your user_id seems to be valid.
    User avatar
    Ok I managed to have a working conf with DB auth instead of LDAP.

    I still have the same error, how/where do you want me to dump the value ?
    User avatar
    I don't manage to get a working httpd git.conf file, can you attach a sample one please (becarful with passwords)
    User avatar
    Nouha Terzi (terzino)2014-04-18 17:10
    According to your html, you seem to have this error:
    Can't locate object method &quot;quote&quot; via package &quot;db_connect&quot; (perhaps you forgot to load &quot;db_connect&quot;?) at /usr/share/tuleap/plugins/git/gitweb.pl line 87.
    this line corresponds to:
    my $user_id = $dbh->quote($_[0]);
    so the issue seems to come from your user as said before.
    Could you please dump its value?
    User avatar

    I applied the patch from your git change (see attached) and now the output is completly broken (see attached html) with this error:

    XML Parsing Error: XML or text declaration not at start of entity Location: http://shunt.cro.enalean.com/gitweb/ Line Number 30, Column 1:<?xml version="1.0" encoding="utf-8"?> ^

    User avatar
    Nouha Terzi (terzino)2014-04-18 16:44
    ok, great.

    Then, now we need to put the gitweb.pl from gerrit #2189 under plugins/git/ and modify the gitweb.perl under /var/www/git/ (no need to replace the file, just update the modified section in the file).

    However, since you are not using ldap, I am not sure about the cgi->remote_user that will be passed to gitweb.pl file in you case, the one will be used to compute your membership project list.
    User avatar
    I installed the stock gitweb package, replaced gitweb.conf and httpd git.conf and it works, I can see the 2 "exported" repositories.
    User avatar
    Nouha Terzi (terzino)2014-04-18 14:26
    I think it would be better if we try to make it work before applying the modification.

    So let's comment first thsi line from the /etc/gitweb.conf
    #$export_ok = "export_repo_ok";

    and do not replace the cgi with the modified one.

    you should be able to list all the repositories.
    User avatar
    I continue the discussion here as it's barely usable with so many comments.
    As suggested by nouha, I attach both gitweb, gitolite conf and a screenshot of the result.

    I suspect there is a problem with the cgi.
    I installed (on centos5.10 with git & gitweb EPEL packages) and then I copied the gitweb.perl from gerrit #2241
    It seems there are some kind of pattern matching not done, do I need to do something else than copy/paste + chown ?

    User avatar
    As usual, if you want us to review your code, you have to add "tuleap-integrators" group as reviewer
    User avatar
    As usual, if you want us to review your code, you have to add "tuleap-integrators" group as reviewer