Commit fe501713 authored by Pierre-Yves Chibon's avatar Pierre-Yves Chibon

Rename progit to pagure

Fixes http://209.132.184.222/progit/issue/47
parent d5d3459c
include LICENSE README.rst requirements.txt
include createdb.py
recursive-include progit *
recursive-include pagure *
recursive-include files *
ProGit
Pagure
======
:Author: Pierre-Yves Chibon <pingou@pingoured.fr>
ProGit is a light-weight git-centered forge based on pygit2.
Pagure is a light-weight git-centered forge based on pygit2.
Currently, ProGit offers a decent web-interface for git repositories, a
Currently, Pagure offers a decent web-interface for git repositories, a
simplistic ticket system (that needs improvements) and possibilities to create
new projects, fork existing ones and create/merge pull-requests across or
within projects.
Homepage: https://github.com/pypingou/ProGit
Homepage: https://github.com/pypingou/pagure
Dev instance: http://209.132.184.222/ (/!\\ May change unexpectedly, it's a dev instance ;-))
......@@ -22,7 +22,7 @@ Get it running
* Retrieve the sources::
git clone git://github.com/pypingou/progit
git clone git://github.com/pypingou/pagure
* Create the folder that will receive the projects, forks, docs and tickets'
......@@ -49,42 +49,42 @@ UI overview
.. image:: screenshots/overview_home.png
:scale: 50 %
:alt: ProGit's home page overview
:alt: Pagure's home page overview
:align: center
:target: https://github.com/pypingou/ProGit/raw/master/screenshots/overview_home.png
:target: https://github.com/pypingou/pagure/raw/master/screenshots/overview_home.png
.. image:: screenshots/overview_main.png
:scale: 50 %
:alt: ProGit's project page overview
:alt: Pagure's project page overview
:align: center
:target: https://github.com/pypingou/ProGit/raw/master/screenshots/overview_main.png
:target: https://github.com/pypingou/pagure/raw/master/screenshots/overview_main.png
.. image:: screenshots/overview_commit.png
:scale: 50 %
:alt: ProGit's commit overview
:alt: Pagure's commit overview
:align: center
:target: https://github.com/pypingou/ProGit/raw/master/screenshots/overview_commit.png
:target: https://github.com/pypingou/pagure/raw/master/screenshots/overview_commit.png
.. image:: screenshots/overview_request_pull.png
:scale: 50 %
:alt: ProGit's pull-request overview
:alt: Pagure's pull-request overview
:align: center
:target: https://github.com/pypingou/ProGit/raw/master/screenshots/overview_request_pull.png
:target: https://github.com/pypingou/pagure/raw/master/screenshots/overview_request_pull.png
.. image:: screenshots/overview_issues_list.png
:scale: 50 %
:alt: ProGit's issues list overview
:alt: Pagure's issues list overview
:align: center
:target: https://github.com/pypingou/ProGit/raw/master/screenshots/overview_issues_list.png
:target: https://github.com/pypingou/pagure/raw/master/screenshots/overview_issues_list.png
.. image:: screenshots/overview_issue.png
:scale: 50 %
:alt: ProGit's issue overview
:alt: Pagure's issue overview
:align: center
:target: https://github.com/pypingou/ProGit/raw/master/screenshots/overview_issue.png
:target: https://github.com/pypingou/pagure/raw/master/screenshots/overview_issue.png
.. image:: screenshots/overview_users.png
:scale: 50 %
:alt: ProGit's users overview
:alt: Pagure's users overview
:align: center
:target: https://github.com/pypingou/ProGit/raw/master/screenshots/overview_users.png
:target: https://github.com/pypingou/pagure/raw/master/screenshots/overview_users.png
......@@ -4,8 +4,8 @@
__requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']
import pkg_resources
from progit import APP
from progit.lib import model
from pagure import APP
from pagure.lib import model
model.create_tables(
APP.config['DB_URL'],
......
......@@ -5,19 +5,19 @@ SECRET_KEY='<The web application secret key>'
### url to the database server:
#DB_URL=mysql://user:pass@host/db_name
#DB_URL=postgres://user:pass@host/db_name
DB_URL = 'sqlite:////var/tmp/progit_dev.sqlite'
DB_URL = 'sqlite:////var/tmp/pagure_dev.sqlite'
### The FAS group in which the admin of progit are
### The FAS group in which the admin of pagure are
ADMIN_GROUP = ['sysadmin-main', 'sysadmin-cvs']
### The email address to which the flask.log will send the errors (tracebacks)
EMAIL_ERROR = 'pingou@pingoured.fr'
### The URL at which the project is available.
APP_URL = 'https://fedorahosted.org/progit/'
APP_URL = 'https://fedorahosted.org/pagure/'
### The URL to use to clone git repositories.
GIT_URL = 'git@progit.fedorahosted.org'
GIT_URL = 'git@pagure.fedorahosted.org'
### Folder containing to the git repos
GIT_FOLDER = os.path.join(
......@@ -69,7 +69,7 @@ GL_BINDIR = None
#SMTP_SERVER = 'localhost'
### Email used to sent emails
#FROM_EMAIL = 'progit@fedoraproject.org'
#FROM_EMAIL = 'pagure@fedoraproject.org'
### the number of items (packages, packagers..) to display on the search
### pages
......
# Apache configuration file for progit
# Apache configuration file for pagure
#WSGIDaemonProcess progit user=apache maximum-requests=1000 display-name=progit processes=2 threads=1
#WSGIDaemonProcess pagure user=apache maximum-requests=1000 display-name=pagure processes=2 threads=1
#WSGISocketPrefix run/wsgi
#WSGIRestrictStdout On
#WSGIRestrictSignal Off
#WSGIPythonOptimize 1
#WSGIScriptAlias /progit /usr/share/progit/progit.wsgi
#WSGIScriptAlias /pagure /usr/share/pagure/pagure.wsgi
#<Location />
# WSGIProcessGroup progit
# WSGIProcessGroup pagure
# <IfModule mod_authz_core.c>
# # Apache 2.4
# Require all granted
......
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from
%distutils.sysconfig import get_python_lib; print (get_python_lib())")}
Name: progit
Name: pagure
Version: 0.0
Release: 1.20141008%{?dist}
Summary: A git-centered forge
License: GPLv2+
URL: http://fedorahosted.org/progit/
Source0: https://fedorahosted.org/releases/p/r/progit/%{name}-%{version}.tar.gz
URL: http://fedorahosted.org/pagure/
Source0: https://fedorahosted.org/releases/p/r/pagure/%{name}-%{version}.tar.gz
BuildArch: noarch
......@@ -59,12 +59,11 @@ Requires: python-wtforms
Requires: mod_wsgi
%description
ProGit is a light-weight git-centered forge based on pygit2.
Pagure is a light-weight git-centered forge based on pygit2.
Currently, ProGit offers a decent web-interface for git repositories, a
simplistic ticket system (that needs improvements) and possibilities to
create new projects, fork existing ones and create/merge pull-requests
across or within projects.
Currently, Pagure offers a web-interface for git repositories, a ticket
system and possibilities to create new projects, fork existing ones and
create/merge pull-requests across or within projects.
%prep
%setup -q
......@@ -80,28 +79,28 @@ rm -rf $RPM_BUILD_ROOT
# Install apache configuration file
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/
install -m 644 files/progit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/progit.conf
install -m 644 files/pagure.conf $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/pagure.conf
# Install configuration file
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/progit
install -m 644 files/progit.cfg.sample $RPM_BUILD_ROOT/%{_sysconfdir}/progit/progit.cfg
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/pagure
install -m 644 files/pagure.cfg.sample $RPM_BUILD_ROOT/%{_sysconfdir}/pagure/pagure.cfg
# Install WSGI file
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/progit
install -m 644 files/progit.wsgi $RPM_BUILD_ROOT/%{_datadir}/progit/progit.wsgi
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/pagure
install -m 644 files/pagure.wsgi $RPM_BUILD_ROOT/%{_datadir}/pagure/pagure.wsgi
# Install the createdb script
install -m 644 createdb.py $RPM_BUILD_ROOT/%{_datadir}/progit/progit_createdb.py
install -m 644 createdb.py $RPM_BUILD_ROOT/%{_datadir}/pagure/pagure_createdb.py
%files
%doc README.rst LICENSE
%config(noreplace) %{_sysconfdir}/httpd/conf.d/progit.conf
%config(noreplace) %{_sysconfdir}/progit/progit.cfg
%dir %{_sysconfdir}/progit/
%{_datadir}/progit/
%{python_sitelib}/progit/
%{python_sitelib}/progit*.egg-info
%config(noreplace) %{_sysconfdir}/httpd/conf.d/pagure.conf
%config(noreplace) %{_sysconfdir}/pagure/pagure.cfg
%dir %{_sysconfdir}/pagure/
%{_datadir}/pagure/
%{python_sitelib}/pagure/
%{python_sitelib}/pagure*.egg-info
%changelog
......
......@@ -9,14 +9,14 @@
#import os
## Set the environment variable pointing to the configuration file
#os.environ['PROGIT_CONFIG'] = '/etc/progit/progit.cfg'
#os.environ['PAGURE_CONFIG'] = '/etc/pagure/pagure.cfg'
## The following is only needed if you did not install progit
## The following is only needed if you did not install pagure
## as a python module (for example if you run it from a git clone).
#import sys
#sys.path.insert(0, '/path/to/progit/')
#sys.path.insert(0, '/path/to/pagure/')
## The most import line to make the wsgi working
#from progit import APP as application
#from pagure import APP as application
#application.debug = True
......@@ -29,10 +29,10 @@ from flask_fas_openid import FAS
from functools import wraps
from sqlalchemy.exc import SQLAlchemyError
import progit.lib
import progit.mail_logging
import progit.doc_utils
import progit.login_forms
import pagure.lib
import pagure.mail_logging
import pagure.doc_utils
import pagure.login_forms
from pygments import highlight
from pygments.lexers.text import DiffLexer
......@@ -44,17 +44,17 @@ APP.jinja_env.trim_blocks = True
APP.jinja_env.lstrip_blocks = True
# set up FAS
APP.config.from_object('progit.default_config')
APP.config.from_object('pagure.default_config')
if 'PROGIT_CONFIG' in os.environ:
APP.config.from_envvar('PROGIT_CONFIG')
if 'PAGURE_CONFIG' in os.environ:
APP.config.from_envvar('PAGURE_CONFIG')
FAS = FAS(APP)
SESSION = progit.lib.create_session(APP.config['DB_URL'])
SESSION = pagure.lib.create_session(APP.config['DB_URL'])
if not APP.debug:
APP.logger.addHandler(progit.mail_logging.get_mail_handler(
APP.logger.addHandler(pagure.mail_logging.get_mail_handler(
smtp_server=APP.config.get('SMTP_SERVER', '127.0.0.1'),
mail_admin=APP.config.get('MAIL_ADMIN', APP.config['EMAIL_ERROR'])
))
......@@ -106,7 +106,7 @@ def is_admin():
user = flask.g.fas_user
auth_method = APP.config.get('PROGIT_AUTH', None)
auth_method = APP.config.get('PAGURE_AUTH', None)
if auth_method == 'fas':
if not user.cla_done or len(user.groups) < 1:
return False
......@@ -134,7 +134,7 @@ def is_repo_admin(repo_obj):
def generate_gitolite_acls():
""" Generate the gitolite configuration file for all repos
"""
progit.lib.git.write_gitolite_acls(
pagure.lib.git.write_gitolite_acls(
SESSION, APP.config['GITOLITE_CONFIG'])
gitolite_folder = APP.config.get('GITOLITE_HOME', None)
......@@ -166,7 +166,7 @@ def generate_authorized_key_file():
"""
gitolite_home = APP.config.get('GITOLITE_HOME', None)
if gitolite_home:
users = progit.lib.search_user(SESSION)
users = pagure.lib.search_user(SESSION)
authorized_file = os.path.join(
gitolite_home, '.ssh', 'authorized_keys')
......@@ -189,7 +189,7 @@ To use this decorator you need to have a function named 'auth_login'.
Without that function the redirect if the user is not logged in will not
work.
"""
auth_method = APP.config.get('PROGIT_AUTH', None)
auth_method = APP.config.get('PAGURE_AUTH', None)
@wraps(function)
def decorated_function(*args, **kwargs):
......@@ -199,7 +199,7 @@ work.
flask.url_for('auth_login', next=flask.request.url))
elif auth_method == 'fas' and not flask.g.fas_user.cla_done:
flask.flash('You must sign the FPCA (Fedora Project Contributor '
'Agreement to use progit', 'errors')
'Agreement to use pagure', 'errors')
return flask.redirect(flask.url_for('.index'))
return function(*args, **kwargs)
return decorated_function
......@@ -229,7 +229,7 @@ def set_session():
def set_user(return_url):
''' After login method. '''
try:
progit.lib.set_up_user(
pagure.lib.set_up_user(
session=SESSION,
username=flask.g.fas_user.username,
fullname=flask.g.fas_user.fullname,
......@@ -281,10 +281,10 @@ def auth_login():
else: # pragma: no cover
admins = set(admins)
if APP.config.get('PROGIT_AUTH', None) == 'fas':
if APP.config.get('PAGURE_AUTH', None) == 'fas':
return FAS.login(return_url=return_point, groups=admins)
elif APP.config.get('PROGIT_AUTH', None) == 'local':
form = progit.login_forms.LoginForm()
elif APP.config.get('PAGURE_AUTH', None) == 'local':
form = pagure.login_forms.LoginForm()
return flask.render_template(
'login/login.html',
next_url=return_point,
......@@ -303,11 +303,11 @@ def auth_logout():
if not authenticated():
return flask.redirect(return_point)
if APP.config.get('PROGIT_AUTH', None) == 'fas':
if APP.config.get('PAGURE_AUTH', None) == 'fas':
if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None:
FAS.logout()
flask.flash("You are no longer logged-in")
elif APP.config.get('PROGIT_AUTH', None) == 'local':
elif APP.config.get('PAGURE_AUTH', None) == 'local':
login.logout()
return flask.redirect(return_point)
......@@ -344,20 +344,20 @@ def get_repo_path(repo):
# Import the application
import progit.ui.app
import progit.ui.admin
import progit.ui.docs
import progit.ui.fork
import progit.ui.issues
import progit.ui.plugins
import progit.ui.repo
import pagure.ui.app
import pagure.ui.admin
import pagure.ui.docs
import pagure.ui.fork
import pagure.ui.issues
import pagure.ui.plugins
import pagure.ui.repo
import progit.api
APP.register_blueprint(progit.api.API)
import pagure.api
APP.register_blueprint(pagure.api.API)
# Only import the login controller if the app is set up for local login
if APP.config.get('PROGIT_AUTH', None) == 'local':
import progit.ui.login as login
if APP.config.get('PAGURE_AUTH', None) == 'local':
import pagure.ui.login as login
APP.before_request(login._check_session_cookie)
APP.after_request(login._send_session_cookie)
......@@ -15,9 +15,9 @@ import flask
API = flask.Blueprint('api_ns', __name__, url_prefix='/api/0')
from progit import __api_version__, APP, SESSION
import progit
import progit.lib
from pagure import __api_version__, APP, SESSION
import pagure
import pagure.lib
@API.route('/version/')
......@@ -52,7 +52,7 @@ def api_users():
'''
List users
-----------
Returns the list of all users that have logged into this progit instances.
Returns the list of all users that have logged into this pagure instances.
This can then be used as input for autocompletion in some forms/fields.
::
......@@ -78,7 +78,7 @@ def api_users():
{
'users': [
user.username
for user in progit.lib.search_user(
for user in pagure.lib.search_user(
SESSION, pattern=pattern)
]
}
......@@ -116,7 +116,7 @@ def api_project_tags(repo, username=None):
if pattern is not None and not pattern.endswith('*'):
pattern += '*'
project = progit.lib.get_project(SESSION, repo, username)
project = pagure.lib.get_project(SESSION, repo, username)
if not project:
output = {'output': 'notok', 'error': 'Project not found'}
jsonout = flask.jsonify(output)
......@@ -127,7 +127,7 @@ def api_project_tags(repo, username=None):
{
'tags': [
tag.tag
for tag in progit.lib.get_tags_of_project(
for tag in pagure.lib.get_tags_of_project(
SESSION, project, pattern=pattern)
]
}
......
......@@ -19,20 +19,20 @@ ADMIN_SESSION_LIFETIME = timedelta(minutes=20)
SECRET_KEY = '<insert here your own key>'
# url to the database server:
DB_URL = 'sqlite:////var/tmp/progit_dev.sqlite'
DB_URL = 'sqlite:////var/tmp/pagure_dev.sqlite'
# The FAS group in which the admin of progit are
# The FAS group in which the admin of pagure are
ADMIN_GROUP = 'sysadmin-main'
# The email address to which the flask.log will send the errors (tracebacks)
EMAIL_ERROR = 'pingou@pingoured.fr'
# The URL at which the project is available.
APP_URL = 'https://fedorahosted.org/progit/'
APP_URL = 'https://fedorahosted.org/pagure/'
# The URL to use to clone the git repositories.
GIT_URL_SSH = 'git@progit.fedorahosted.org'
GIT_URL_GIT = 'git://progit.fedorahosted.org'
GIT_URL_SSH = 'git@pagure.fedorahosted.org'
GIT_URL_GIT = 'git://pagure.fedorahosted.org'
# Number of items displayed per page
......@@ -99,12 +99,12 @@ GL_BINDIR = None
SMTP_SERVER = 'localhost'
# Email used to sent emails
FROM_EMAIL = 'progit@fedoraproject.org'
FROM_EMAIL = 'pagure@fedoraproject.org'
# Specify which authentication method to use, defaults to `fas` can be or
# `local`
# Default: ``fas``.
PROGIT_AUTH = 'fas'
PAGURE_AUTH = 'fas'
# When this is set to True, the session cookie will only be returned to the
# server via ssl (https). If you connect to the server via plain http, the
......@@ -112,11 +112,11 @@ PROGIT_AUTH = 'fas'
# This may be set to False when testing your application but should always
# be set to True in production.
# Default: ``True``.
PROGIT_COOKIE_REQUIRES_HTTPS = False
PAGURE_COOKIE_REQUIRES_HTTPS = False
# The name of the cookie used to store the session id.
# Default: ``.MirrorManager``.
PROGIT_COOKIE_NAME = 'progit'
PAGURE_COOKIE_NAME = 'pagure'
# If not specified the application will rely on the root_url when sending
# emails, otherwise it will use this URL
......
......@@ -9,21 +9,21 @@
"""
class ProgitException(Exception):
''' Parent class of all the exception for all Progit specific
class PagureException(Exception):
''' Parent class of all the exception for all Pagure specific
exceptions.
'''
pass
class RepoExistsException(ProgitException):
class RepoExistsException(PagureException):
''' Exception thrown when trying to create a repository that already
exists.
'''
pass
class FileNotFoundException(ProgitException):
class FileNotFoundException(PagureException):
''' Exception thrown when trying to create a repository that already
exists.
'''
......
......@@ -12,7 +12,7 @@ import os
import shutil
import wtforms
from progit import APP, get_repo_path
from pagure import APP, get_repo_path
class RequiredIf(wtforms.validators.Required):
......@@ -37,7 +37,7 @@ class RequiredIf(wtforms.validators.Required):
class BaseHook(object):
''' Base class for progit's hooks. '''
''' Base class for pagure's hooks. '''
name = None
form = None
......@@ -69,7 +69,7 @@ class BaseHook(object):
def install(cls, project, dbobj): # pragma: no cover
''' Method called to install the hook for a project.
:arg project: a ``progit.model.Project`` object to which the hook
:arg project: a ``pagure.model.Project`` object to which the hook
should be installed
:arg dbobj: the DB object the hook uses to store the settings
information.
......@@ -81,7 +81,7 @@ class BaseHook(object):
def remove(cls, project): # pragma: no cover
''' Method called to remove the hook of a project.
:arg project: a ``progit.model.Project`` object to which the hook
:arg project: a ``pagure.model.Project`` object to which the hook
should be installed
'''
......
#! /usr/bin/env python2
"""Progit specific hook to add comment on issues if the commits fixes or
"""Pagure specific hook to add comment on issues if the commits fixes or
relates to an issue.
"""
......@@ -11,15 +11,15 @@ import sys
import subprocess
if 'PROGIT_CONFIG' not in os.environ \
and os.path.exists('/etc/progit/progit.cfg'):
print 'Using configuration file `/etc/progit/progit.cfg`'
os.environ['PROGIT_CONFIG'] = '/etc/progit/progit.cfg'
if 'PAGURE_CONFIG' not in os.environ \
and os.path.exists('/etc/pagure/pagure.cfg'):
print 'Using configuration file `/etc/pagure/pagure.cfg`'
os.environ['PAGURE_CONFIG'] = '/etc/pagure/pagure.cfg'
import progit
import progit.exceptions
import progit.lib.link
import pagure
import pagure.exceptions
import pagure.lib.link
def read_git_output(args, input=None, keepends=False, **kw):
......@@ -68,15 +68,15 @@ def generate_revision_change_log(new_commits_list):
line = line.strip()
print '*', line
for issue in progit.lib.link.get_relation(
progit.SESSION, get_repo_name(), get_username(),
for issue in pagure.lib.link.get_relation(
pagure.SESSION, get_repo_name(), get_username(),
line, 'fixes'):
fixes_commit(commitid, issue, progit.APP.config.get('APP_URL'))
fixes_commit(commitid, issue, pagure.APP.config.get('APP_URL'))
for issue in progit.lib.link.get_relation(
progit.SESSION, get_repo_name(), get_username(),
for issue in pagure.lib.link.get_relation(
pagure.SESSION, get_repo_name(), get_username(),
line, 'relates'):
relates_commit(commitid, issue, progit.APP.config.get('APP_URL'))
relates_commit(commitid, issue, pagure.APP.config.get('APP_URL'))
def relates_commit(commitid, issue, app_url=None):
......@@ -95,19 +95,19 @@ def relates_commit(commitid, issue, app_url=None):
commitid[:8], url)
try:
message = progit.lib.add_issue_comment(
progit.SESSION,
message = pagure.lib.add_issue_comment(
pagure.SESSION,
issue=issue,
comment=comment,
user=get_pusher(commitid),
ticketfolder=progit.APP.config['TICKETS_FOLDER'],
ticketfolder=pagure.APP.config['TICKETS_FOLDER'],
)
progit.SESSION.commit()
except progit.exceptions.ProgitException as err:
pagure.SESSION.commit()
except pagure.exceptions.PagureException as err:
print err
except SQLAlchemyError, err: # pragma: no cover
progit.SESSION.rollback()
progit.APP.logger.exception(err)
pagure.SESSION.rollback()
pagure.APP.logger.exception(err)
def fixes_commit(commitid, issue, app_url=None):
......@@ -127,19 +127,19 @@ def fixes_commit(commitid, issue, app_url=None):
commitid[:8], url)
try:
message = progit.lib.add_issue_comment(
progit.SESSION,
message = pagure.lib.add_issue_comment(
pagure.SESSION,
issue=issue,
comment=comment,
user=get_pusher(commitid),
ticketfolder=progit.APP.config['TICKETS_FOLDER'],
ticketfolder=pagure.APP.config['TICKETS_FOLDER'],
)
progit.SESSION.commit()
except progit.exceptions.ProgitException as err:
pagure.SESSION.commit()
except pagure.exceptions.PagureException as err:
print err
except SQLAlchemyError, err: # pragma: no cover
progit.SESSION.rollback()
progit.APP.logger.exception(err)
pagure.SESSION.rollback()
pagure.APP.logger.exception(err)
branches = [
item.replace('* ', '') for item in read_git_lines(
......@@ -149,17 +149,17 @@ def fixes_commit(commitid, issue, app_url=None):
if 'master' in branches:
try:
progit.lib.edit_issue(
progit.SESSION,
pagure.lib.edit_issue(