README.rst
pagure-utility
==============

This repository contains a few scripts useful when running/managing a pagure
instance.


License: GPLv2 or any later version


Run the scripts
---------------

To run the script, either you have a configuration file at
``/etc/pagure/pagure.cfg`` and it will use it, or you can specify one using the
environment variable ``PAGURE_CONFIG`` when calling the script.

In other words:

* if you have ``/etc/pagure/pagure.cfg``, call the script directly::

  python <script>.py

* if you want to specify the configuration file, use ``PAGURE_CONFIG``::

  PAGURE_CONFIG=/path/to/pagure.cfg python <script>.py


check_account_status
~~~~~~~~~~~~~~~~~~~~

For pagure instances configured to authenticate against a `FAS
<https://github.com/fedora-infra/fas/>`_ instance this script allows to
block user accounts in pagure that are marked as inactive in this FAS
instance.


.. warning:: Requires pagure 5.0+


check_post_receive
~~~~~~~~~~~~~~~~~~

This script goes through all git repositories on disk and ensure the
post-receive hook they use is the expected symlink, otherwise, if asked
it replaces it.


clean_up_user_project
~~~~~~~~~~~~~~~~~~~~~

This script can be used to delete all the projects of a specific user.


fill_logs_from_db
~~~~~~~~~~~~~~~~~

This script takes all the tickets, pull-requests and their comments and
insert a corresponding entry in the pagure_logs table (available from
2.9).


fill_logs_from_gits
~~~~~~~~~~~~~~~~~~~

This script browses all the git repo in the specified directory, and for
each commits insert a corresponding entry in the pagure_logs table
(available from 2.9).


load_from_disk_simplified
~~~~~~~~~~~~~~~~~~~~~~~~~

This is an *example* script browses all the git repo in the specified
directory, and creating the corresponding project in the database with
the specified (hard-coded) namespace and main admin.


regen_checksums
~~~~~~~~~~~~~~~

This script allows regenerating the CHECKSUMS file of the specified
directory of releases.
(Available from 3.9)


sync_db_disk
~~~~~~~~~~~~

This script queries all the projects stored in the DB and the files present
on disk and report any discrepancies with the possibility to fix them
automatically.


sync_fas_group_membership
~~~~~~~~~~~~~~~~~~~~~~~~~

This script syncs the group membership from FAS to pagure. It can be told
to only delete in pagure members that are no longer listed in FAS or delete
and add new members.
It can be told to sync a specific group or all of them (default).