Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
1. Tutti i miei sbagli
Gli errori di un Wannabe Open Source Developer
Andrea Francia
Thursday, March 8, 12
2. Il progetto
Gli Sbagli
• Generic Naming Issue
• Using Bash for functional
testing
Contenuti •
•
Feedback
License
• Project hosting
Una cosa giusta
Conclusioni
Applausi
Thursday, March 8, 12
5. Comandi del pacchetto
trash Butta un file
empty-trash Svuota tutto il cestino
list-trash Elenca il contenuto
restore-trash Recupera un file
Thursday, March 8, 12
8. Debian
trash OK
list-trash
restore-trash
empty-trash QA
rejected
Fedora
Thursday, March 8, 12
9. Command name changes
trash trash-put
list-trash trash-list
restore-trash trash-restore
empty-trash trash-empty
Thursday, March 8, 12
10. Risultato
Debian --> vecchi nomi
Upstream --> nomi nuovi
Fedora --> Niente!!! (perdita di interesse
dal package maintainer)
Thursday, March 8, 12
11. Lessons Learned
Non cambiare mai il nome dei comandi
Non cedere alle pressioni dei revisori
(tanto cambiano)
More at: https://github.com/andreafrancia/trash-cli/blob/
master/docs/about-the-generic-naming-issue.txt
Thursday, March 8, 12
14. Results
Very slow tests
Unreadable failure messages
Complex fixture set up
Two test suites (bash+python)
Thursday, March 8, 12
15. Lessons Learned
Test di Integrazione? Ok, ser vono ma
meglio che siano pochi.
Test Funzionali? Meglio che siano
omogenei con i test di unità
Per la bash non sono necessarie librerie/
framework di test
Thursday, March 8, 12
16. Bash for Testing(1)
#!/bin/bash
set
-‐o
errexit
set
-‐o
nounset
Thursday, March 8, 12
17. Bash for Testing(2)
touch
foo
trash-‐put
foo
#
foo
should
have
been
deleted
test
!
-‐f
foo
Thursday, March 8, 12
18. Bash for Testing(3)
diff
<(trash-‐list)
-‐
<<
EXPECTED_RESULT
2012-‐03-‐02
19:43:44
/Users/andrea/foo
2012-‐03-‐02
19:44:04
/Users/andrea/foo
EXPECTED_RESULT
Thursday, March 8, 12
22. Lessons Learned (1)
Licenze già fatte sono comode ma vanno
capite
Thursday, March 8, 12
23. Lessons Learned (2)
Il papiro all’inizio del file é una rottura
Thursday, March 8, 12
24. Papiro della GPL
#!/usr/bin/python
# list-trash: list trashed files
#
# Copyright (C) 2007,2008 Andrea Francia Trivolzio(PV) Italy
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
from libtrash import TrashDirectory
for trashed_file in TrashDirectory.trashed_files() :
print "%s %s" % (trashed_file.deletion_date, trashed_file.path)
Thursday, March 8, 12
25. Lessons learned (3)
A volte conviene usare licenze più
semplici
Thursday, March 8, 12
31. Gnome
KDE
TrashDir
cli
XFCE
Thursday, March 8, 12
32. How it works
$
trash-‐put
pippo.txt
~/.local/share/Trash/
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
info/
,-‐-‐-‐-‐-‐|
[Trash
Info]
|
pippo.txt.trashinfo
|
Path=/tmp/pippo.txt
|
files/
|
DeletionDate=2012-‐02-‐29T00:13:54|
pippo.txt
+-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐+
`.
`-‐
original
file
moved
here
Thursday, March 8, 12
33. How it works
$
touch
pippo.txt;
trash-‐put
pippo.txt
#
again
$
touch
pippo.txt;
trash-‐put
pippo.txt
#
again
$
touch
pippo.txt;
trash-‐put
pippo.txt
#
again
~/.local/share/Trash/
info/
pippo.txt.trashinfo
pippo_1.txt.trashinfo
pippo_2.txt.trashinfo
pippo_3.txt.trashinfo
files/
pippo.txt
pippo_1.txt
pippo_2.txt
pippo_3.txt
Thursday, March 8, 12
34. Gnome
KDE
TrashDir
cli
XFCE
Thursday, March 8, 12
40. Lezioni miste (1)
Utenti: va bene ascoltarli ma la vision la
devi avere tu (WONTFIX, parallelo)
Promozione per distro: Non vale la pena
se poi non lo aggiornano
Thursday, March 8, 12
41. Lezioni miste (2)
Code Review? Utilissime, basta chiedere
in lista.
Occhio alle librerie e ai framework
(OptionParser, Unipath)
Thursday, March 8, 12
42. Lezioni miste (3)
Tempo a disposizione? Peggio che al
lavoro!
Alta coesione e basso accoppiamento e
test veloci sono indispensabili
Thursday, March 8, 12
43. Lezioni miste (4)
È vero che Git sembra più complicato di Subversion?
Però
è più facile integrare le patch degli altri
meno conflitti inesistenti
commit locali
non si incasina se sposti una directory
capisce da solo se hai rinominato un file
Thursday, March 8, 12
44. Lezioni miste (5)
Collaboration tools (wiki, blog, mailing-
list)
➡Cominciano ad essere usati solo dopo
quando c’e’ veramente tanto interesse
➡Si può aspettare a farli.
Thursday, March 8, 12