Outils pour utilisateurs

Outils du site


blog

Notes git Trac

Install

Dépendance

# ​pysqlite
​setuptools
​Genshi 
babel
docutils
Pygments​
pytz
sudo apt-get install python-pysqlite2 apache2-utils sqlite3 python-setuptools
 
easy_install --user pip
export PATH=$PATH:$HOME/.local/bin
pip install --user --upgrade pip
 
pip install --user Genshi babel docutils Pygments pytz
pip install --user trac
trac-admin projet1 initenv
 
cd projet1
htpasswd -c .htpasswd jean
trac-admin /home/jean/trac/projet1 permission add jean TRAC_ADMIN

Lancement

tracd -p 8000 --pidfile=/var/run/z_trac-8000.pid --basic-auth="projet1,projet1/.htpasswd,acme.fr" --protocol=http  -s ~/projet1

trac.ini

[trac]
repository_type = git
repository_dir = /home/jean/trac/repo/.git
 
[components]
tracopt.versioncontrol.git.* = enabled
 
[logging]
log_level = WARN

On efface les pages Wiki par défaut

trac-admin ~/trac/projet1 'wiki remove *'

Config compte utilisateur Jean

trac-admin ~/trac/projet1 'session set email jean jean@acme.fr'
trac-admin ~/trac/projet1 'session set name jean "Prenom NOM"'

Un peu de français

trac-admin ~/trac/projet1 'ticket_type change task Tâche'
trac-admin ~/trac/projet1 'ticket_type change defect Incident'
trac-admin ~/trac/projet1 'ticket_type change enhancement Amélioration'
 
trac-admin ~/trac/projet1 'priority change blocker Bloquant'
trac-admin ~/trac/projet1 'priority change critical Critique'
trac-admin ~/trac/projet1 'priority change major Majeur'
trac-admin ~/trac/projet1 'priority change minor Mineur'
 
trac-admin ~/trac/projet1 'resolution change fixed Résolut'
trac-admin ~/trac/projet1 'resolution change wontfix Rejeté'
trac-admin ~/trac/projet1 'resolution change duplicate Doublon'

Racine du site sur Wiki, ou Ticket ou autre

trac.ini

[trac]
#default_handler = TicketModule
default_handler = WikiModule
Changement des droits par défauts
trac-admin trac/projet1 'permission remove anonymous BROWSER_VIEW'
trac-admin trac/projet1 'permission remove anonymous CHANGESET_VIEW'
trac-admin trac/projet1 'permission remove anonymous FILE_VIEW'
trac-admin trac/projet1 'permission remove anonymous LOG_VIEW'     
trac-admin trac/projet1 'permission remove anonymous MILESTONE_VIEW'
trac-admin trac/projet1 'permission remove anonymous REPORT_SQL_VIEW'
trac-admin trac/projet1 'permission remove anonymous REPORT_VIEW'
trac-admin trac/projet1 'permission remove anonymous ROADMAP_VIEW'   
trac-admin trac/projet1 'permission remove anonymous SEARCH_VIEW'  
trac-admin trac/projet1 'permission remove anonymous TICKET_VIEW'   
trac-admin trac/projet1 'permission remove anonymous TIMELINE_VIEW'  
#trac-admin trac/projet1 'permission remove anonymous WIKI_VIEW'
 
trac-admin trac/projet1 'permission add authenticated TICKET_VIEW'
#trac-admin trac/projet1 'permission add authenticated WIKI_VIEW'
 
trac-admin trac/projet1 'permission add jean BROWSER_VIEW'
trac-admin trac/projet1 'permission add jean CHANGESET_VIEW'
trac-admin trac/projet1 'permission add jean FILE_VIEW'
trac-admin trac/projet1 'permission add jean LOG_VIEW'     
trac-admin trac/projet1 'permission add jean MILESTONE_VIEW'
trac-admin trac/projet1 'permission add jean REPORT_SQL_VIEW'
trac-admin trac/projet1 'permission add jean REPORT_VIEW'
trac-admin trac/projet1 'permission add jean ROADMAP_VIEW'   
trac-admin trac/projet1 'permission add jean SEARCH_VIEW'  
trac-admin trac/projet1 'permission add jean TICKET_VIEW'   
trac-admin trac/projet1 'permission add jean TIMELINE_VIEW'
 
# Autoriser tous les utilisateurs authentifié à changer le champ Description des tickets
trac-admin ~/trac/projet1 'permission add authenticated TICKET_EDIT_DESCRIPTION'
 
# Autoriser l'utilisateur jean à modifier les commentaires des tickets
trac-admin ~/trac/projet1 'permission add jean TICKET_EDIT_COMMENT'
Gestion plus fine des droits

Installation PrivateTicketsPlugin

easy_install -Z -U --user https://trac-hacks.org/svn/privateticketsplugin/

trac.ini

[privatetickets]
group_blacklist = anonymous, authenticated, labusers
 
[components]
privatetickets.* = enabled
 
[trac]
permission_policies = PrivateTicketsPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
# Il faut garder TICKET_VIEW !
# permission remove authenticated  TICKET_VIEW
# Il faut aussi garder TICKET_MODIFY si l'utilisateur doit pouvoir éditer ses tickets
# permission remove authenticated  TICKET_MODIFY
 
trac-admin trac/projet1 'permission add authenticated TICKET_VIEW_OWNER'
trac-admin trac/projet1 'permission add authenticated TICKET_VIEW_SELF'

Placer logo.png dans projet1/htdocs/logo.png

trac.ini

[header_logo]
alt = ACME logo
height = 53
link = /report/8
src = site/logo.png
width = 393

Thème

Cacher les liens vers le guide d'utilisation.
Ne pas montrer les différents liens vers les pages d'aide. Ceci permet de réduire la verbosité des pages.

Hide help links.
Don't show the various help links. This reduces the verbosity of the pages.

http://trac.edgewall.org/ticket/2911

Config derrière Nginx en proxy

Voir :

Bloquons le port depuis extérieure

iptables -A INPUT -i venet0 -p tcp -m tcp --dport 8000 -j REJECT 

Pour rendre les règles persistantes

apt-get install iptables-persistent

/etc/nginx/sites-available/trac

  upstream trac_backend {
          server  127.0.0.1:8000;
          #server  127.0.0.1:8001;
          #server  127.0.0.1:8002;
}
 
  server {
          listen          80;
          server_name     trac.acme.fr ;
 
          access_log      /var/log/nginx/trac-acme.log ;
          error_log       /var/log/nginx/trac-acme-error.log info;
 
          location / {
                  rewrite         ^/(.*)$ https://trac.acme.fr/$1 redirect;
          }
 
  }
  server {
          listen          443;
          server_name     trac.acme.fr;
 
          access_log      /var/log/nginx/trac-acme-ssl.log ;
          error_log       /var/log/nginx/trac-acme-ssl-error.log info;
 
          client_max_body_size 4M;
 
          ssl                  on;
          ssl_certificate /etc/ssl/private/wiki.acme.fr.crt;
          ssl_certificate_key /etc/ssl/private/wiki.acme.fr.key;
          ssl_session_timeout 5m;
          ssl_prefer_server_ciphers on;
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
          ssl_ciphers ALL:!aNULL:!eNULL:!LOW:!EXP:!RC4:!3DES:+HIGH:+MEDIUM;
          ssl_dhparam /etc/ssl/private/dh2048.pem;
          add_header Strict-Transport-Security max-age=2678400;
 
          add_header           Front-End-Https    on;
 
          location / {
                  proxy_pass      http://trac_backend;
                  include         /etc/nginx/proxy_params;
                  # my system doesn't have the proxy.conf file so I needed to add the following two lines to get redirects working:
                  # proxy_set_header Host $host;
          }
 
  }
ln -s /etc/nginx/sites-available/trac /etc/nginx/sites-enabled/

Config des modules / extensions

TestManager

http://sourceforge.net/projects/testman4trac/

Voir https://www.youtube.com/watch?v=BIi3QMT0rT4

Ordre d'installation des extensions

  1. TracGenericClass
  2. TracGenericWorkflow
  3. TestManager

Gestion de plusieurs clients

# Comme le plugin est sur un dépôt SVN nous avons besoin du /usr/bin/svn
sudo apt-get install subversion
 
# Dépendance de ce plugin
sudo apt-get install python-lxml
 
easy_install -Z -U --user https://trac-hacks.org/svn/clientsplugin/trunk/

Désactivation création de liens camelCase

trac.ini

[wiki]
ignore_missing_pages = true

Création d'une date d'échéance (deadline)

Création de champ personalisé

Ce plugin est intégré dans la nouvelle version de Trac

easy_install -U -Z --user https://trac-hacks.org/svn/customfieldadminplugin/0.11

trac.ini

[components]
customfieldadmin.* = enabled
Ajout d'un type Date

https://trac-hacks.org/wiki/DateFieldPlugin

easy_install -U -Z --user https://trac-hacks.org/svn/datefieldplugin/1.0/

trac.ini

[components]
datefield.* = enabled
 
[ticket-custom]
due_date = text
due_date.date = true
due_date.label = Echéance
# special value <now> works with 1.0 branch only
#due_date.value = <now>
due_date.value =
due_date.date_empty = true

Désactiver une rubrique

trac.ini

[metanav]
help = disabled
about = disabled
# Cache API link (XmlRpcPlugin)
rpc = disabled
 
[mainnav]
roadmap = disabled

Rubrique principale / Racine du site

trac.ini

[trac]
#default_handler = WikiModule
default_handler = TicketModule

Clients en ligne de commande

Cartman

https://tamentis.com/projects/cartman/

pip install --user git+https://github.com/tamentis/cartman
~/.local/bin/cm help
Tracshell

Voir :

easy_install --user pyyaml

Droits en écriture requis sur /usr/local/bin

pip install --user git+https://github.com/stefanv/tracshell-fixes

Programmation API

Perl

Python 3

import xmlrpc.client
server = xmlrpc.client.ServerProxy("https://user:P@ssw0rd@trac.acme.fr/login/xmlrpc")
multicall = xmlrpc.client.MultiCall(server)
 
print( server.ticket.query('max=0') )
 
for t in server.ticket.query('max=0&status!=closed,format=count'):
        print(t);
 
server.ticket.get(5)
 
 
server.system.listMethods()
 
print(server.system.methodHelp('ticket.query'))

Cloner un ticket

import xmlrpc.client
s = xmlrpc.client.ServerProxy("https://user:P@ssw0rd@trac.acme.fr/login/xmlrpc")
ticket=s.ticket.get(30)
 
summary=ticket[3]["summary"]
description=ticket[3]["description"]
 
del ticket[3]["summary"]
del ticket[3]["description"]
del ticket[3]["_ts"]
del ticket[3]["time"]
del ticket[3]["changetime"]
 
s.ticket.create(summary, description, ticket[3], False, datetime.datetime.now() )

Obtenir la liste des tickets ayant une échéance

#! /usr/bin/env python3
 
import datetime
from operator import itemgetter, attrgetter
import xmlrpc.client
 
s = xmlrpc.client.ServerProxy("https://user:pass@trac.acme.fr/login/xmlrpc")
 
Tickets = []
for num in s.ticket.query('max=0&due_date!=&status!=closed'):
    ticket=s.ticket.get(num);
    if 'due_date' in ticket[3].keys():
        due_date=ticket[3]["due_date"]
        due_date=datetime.datetime.strptime(due_date, "%d/%m/%Y").strftime("%Y-%m-%d")
    else:
        due_date=''
 
    summary=ticket[3]["summary"]
    summary=summary.replace('\'', '')
    summary=summary.replace('"', '')
    summary=summary.replace(';', '')
    Tickets.append([num, due_date, summary])
 
for num, date, summary in sorted(Tickets, key=itemgetter(1), reverse=False):
    print(num, date, summary)
2025/03/24 15:06

AWS Cloud S3FS

S3 Alternatives

Voir :

  • MinIO
  • Scality-s3
  • riakcs
  • Zenko (multi-cloud)
  • Garage S3

Voir aussi :

  • Ceph
  • IPFS

/etc/systemd/system/mnt-shared.mount

[Unit]
Description=Partage S3
 
[Mount]
What=bucketname
Where=/mnt/shared
Type=fuse.s3fs
Options=_netdev,noatime,noexec,nosuid,nodev,allow_other,iam_role=auto,umask=0000,endpoint=eu-central-1,url=http://s3-eu-central-1.amazonaws.com
Environment= "http_proxy=" "https_proxy="
 
# If supported by the version of systemd. Really necessary ?
#LazyUnmount=True
 
[Install]
WantedBy=multi-user.target

/etc/systemd/system/mnt-shared.automount

[Unit]
Description=Automount Partage S3
Requires=network-online.target
After=network-online.service
 
[Automount]
Where=/mnt/shared
TimeoutIdleSec=10
 
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl disable mnt-shared.mount
systemctl enable mnt-shared.automount

Debug

systemctl status /mnt/shared
journalctl -u /mnt/shared
killall s3fs
killall -9 s3fs
umount -l /mnt/shared
systemctl stop mnt-shared.mount
systemctl stop mnt-shared.automount
 
s3fs bucketname /mnt/s3 -o endpoint=eu-central-1 -o url=http://s3-eu-central-1.amazonaws.com -o iam_role=auto -o dbglevel=info -o curldbg -d -f

Autres

Client S3

Voir :

Ansible
- name: service mount
  systemd: daemon_reload=yes name=mnt-shared.mount

- name: service automount
  systemd: enabled=yes daemon_reload=yes name=mnt-shared.mount.automount
Scality-S3
MinIO
2025/03/24 15:06

Config Firefox

Proxy

Downthemall Adblock Noscript Scriptish Unplug

userscript : http://userscripts.org/scripts/review/84291

search engine : yandex youtube seeks.fr


xpinstall.enabled;false dom.allow_scripts_to_close_windows;false pref.advanced.javascript.disable_button.advanced;false services.sync.prefs.sync.pref.advanced.javascript.disable_button.advanced;false privacy.donottrackheader.enabled;true network.http.sendRefererHeader;0 geo.enabled;false network.dns.disableIPv6;true browser.safebrowsing.enabled;false browser.safebrowsing.malware.enabled;false media.autoplay.enabled;false

social.activation.whitelist; social.active;false social.enabled;false social.manifest.facebook; social.sidebar.open;false social.toast-notifications.enabled;false

network.http.pipelining;true network.http.pipelining.ssl;true network.http.proxy.pipelining;true

full-screen-api.approval-required;false

media.autoplay.enabled;false

  1. GIF animées

image.animation_mode none

  1. KDE
  2. ui.allow_platform_file_picker;false
  1. Pb redirection www.localhost.com

browser.fixup.alternate.enabled:false

Installer des modules non-signé xpinstall.signatures.required;false


change in about:config

browser.download.manager.scanWhenDone = false browser.send_pings = false dom.disable_window_open_feature.menubar = true dom.disable_window_open_feature.scrollbars = true intl.accept_charsets;utf-8 intl.accept_languages;en intl.charset.default;utf-8 intl.charsetmenu.browser.cache;UTF-8 keyword.enabled = false layout.css.visited_links_enabled = false network.http.sendRefererHeader;0 network.http.accept.default;*/* network.prefetch-next = false network.proxy.socks_remote_dns = true

  1. #

add to about:config (for faking the user agent)

new - string: general.useragent.override - value: Mozilla/5.0 (en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2

  1. #

change settings (in firefox 3.5 and higher first choose “user default” to change some settings)

javascript:disabled java: disabled history: disabled chronicle: disabled save data: disabled cookies: disabled clear private data: enabled (all) remember passwords: disabled offline storage: 0 mb cache

  1. #

search engines

delete / disable all

  1. #

add network settings

set manual proxy configuration to freenet-default http-proxy 127.0.0.1 port 8888 use this proxy server for all protocols You should put these changes in a separate profile and use this profile exclusively for …

Estimation du nom de domaine

https://support.mozilla.org/t5/Learn-the-Basics-get-started/Rechercher-sur-Internet-depuis-la-barre-d-adresse/ta-p/16797 browser.fixup.alternate.enabled = False

Désactiver la recherche sur le Web dans la barre d'adresse keyword.enabled= false

Auto-complétion de l'URL browser.urlbar.autoFill = True (default)

2025/03/24 15:06

Notes git svn

Config

Source : http://labs.excilys.com/2012/04/30/git-svn/

git svn init -s http://subversion-server/monprojet/

Changer

.git/config

[svn-remote "svn"]
    url = svn://serveur-svn:3690
    fetch = monprojet/trunk:refs/remotes/origin/trunk
    branches = monprojet/branches/*:refs/remotes/origin/*
    tags = monprojet/tags/*:refs/remotes/origin/tags/*

En

.git/config

[svn-remote "svn"]
    url = svn://serveur-svn:3690/monprojet
    fetch = trunk:refs/remotes/svn/trunk
    branches = branches/*:refs/remotes/svn/branches/*
    tags = tags/*:refs/remotes/svn/tags/*

Récupération

git svn fetch

Utilisation

Commande locales normales (add, commit)

git commit -a -m "* test"

Push sur SVN

git svn fetch
git svn rebase --dry-run
git svn rebase
git svn dcommit

Push sur git (si utilisation en parallèle d'un dépôt git)

git pull
git push

Exemple - fichier .git/config

.git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
 
[svn-remote "svn"]
    url = svn://serveur-svn:3690/monprojet
    fetch = trunk:refs/remotes/svn/trunk
    branches = branches/*:refs/remotes/svn/branches/*
    tags = tags/*:refs/remotes/svn/tags/*
 
[remote "origin"]
    url = ssh://git@git.acme.fr:443/ACME/monprojet
    fetch = +refs/heads/*:refs/remotes/origin/*
 
[branch "master"]
        remote = origin
        merge = refs/heads/master

Migration

Voir https://git-scm.com/book/fr/v1/Git-et-les-autres-syst%C3%A8mes-Migrer-sur-Git

Source : https://stackoverflow.com/questions/12742263/git-svn-can-i-use-git-and-svn-at-the-same-time-no-need-interaction-between-gi

Clone du dépôt subversion

git svn clone svn://serveur-svn:3690/monprojet

The code will be available as a git repository. You can do your work there and make local commits as you please. There is a command line option to get a “shallow” checkout rather than the entire repository which is often useful. I forget what it is.

Anytime, you want to run the equivalent of
svn update, do a git svn rebase

. This will fetch new commits which were checked into SVN after you last synchronised and then rebase your changes onto the new tip.

When you're ready with your commits, do a git svn dcommit. This will send all your new commits to svn one by one. You can also squash your local commits into a single one and send it by first doing a local rebase and then an svn dcommit. This should be done on the initial branch (usually master).

The very fact that you're checking out from subversion and then working locally in git means that there is “interaction” between them so your last statement is not valid.

2025/03/24 15:06

Notes git bisect

Voir aussi :

source : https://opensource.com/article/22/11/git-bisect

Using Git bisect Using the git bisect command is very straightforward:

git bisect start
git bisect bad        # Git assumes you mean HEAD by default
git bisect good <ref> # specify a tag or commit ID for <ref>

Git checks out the commit in the middle and waits for you to declare either:

git bisect good
## or
git bisect bad

Then the bisect tool repeats checking out the commit halfway between good and bad commits until you tell it:

git bisect reset

Advanced users can even write scripts that determine good and bad states as well as any remediation actions to take upon finding the specific commit. You might not use the git bisect command every day of your life, but when you need it, it is a lifesaver.

2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki