3213
by Omar Campagne
Uploading script and manpage |
1 |
#!/bin/bash
|
2 |
# AUTHOR: Omar Campagne, ocampagne at gmail dot com
|
|
3 |
||
3261
by Omar Campagne
some more info |
4 |
#### Follow this steps to get the whole gmpc l10n thing under dir A
|
5 |
||
6 |
# mkdir A && cd A && git clone elric/gmpc.git && mv gmpc gmpc-l10n && cd gmpc-l10n && ./update-lp.sh -u
|
|
7 |
||
8 |
####### ALERT !!!! #######
|
|
9 |
## rename this repo dir (gmpc) as gmpc-l10n before running
|
|
10 |
## the script, or use the command above
|
|
11 |
||
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
12 |
### this script creates/expects the following dir tree, and to be
|
13 |
### used from elric/gmpc.git repository.
|
|
14 |
||
3227
by Omar Campagne
fixing script |
15 |
#/parent
|
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
16 |
# /gmpc-l10n/script (this repo), you should run the script
|
17 |
# from this folder
|
|
3227
by Omar Campagne
fixing script |
18 |
# /l10nexport (LP's) translations
|
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
19 |
# /gmpc < -- main
|
20 |
# /gmpc-$plugin
|
|
3227
by Omar Campagne
fixing script |
21 |
|
22 |
||
3213
by Omar Campagne
Uploading script and manpage |
23 |
|
24 |
### DONE:
|
|
25 |
### Git to LP TRY MERGE LOCAL FILES
|
|
26 |
## Pull/clone from git -> Create/update POT and PO -> copy to elric/gmpc.git -> commit and push,
|
|
3219
by Omar Campagne
changes in script, adding one more |
27 |
## indirectly to LP
|
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
28 |
## Download from bzr, upload to git
|
3214
by Omar Campagne
adding a note |
29 |
|
3224
by Omar Campagne
added manpages (po4a) to script |
30 |
### Set here the name of the plugins/git repos (gmpc-$plugin.git) to manage,
|
31 |
## manpages is independent, works with po4a. Main gmpc POT is not automatically
|
|
32 |
## created for now.
|
|
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
33 |
|
3261
by Omar Campagne
some more info |
34 |
plugins="alarm discogs last.fm lyricwiki shout lyricsplugin mdcover tagedit " |
3213
by Omar Campagne
Uploading script and manpage |
35 |
|
3219
by Omar Campagne
changes in script, adding one more |
36 |
cd ../
|
37 |
||
3222
by Omar Campagne
making options |
38 |
update_po () { |
3213
by Omar Campagne
Uploading script and manpage |
39 |
# [1] Pulls updates if repo is present, otherwise, clone
|
40 |
||
41 |
||
42 |
for plugin in $plugins ; do |
|
43 |
if [ -d gmpc-$plugin ] ; then |
|
44 |
cd gmpc-$plugin |
|
45 |
echo "Updating gmpc-$plugin" |
|
46 |
git pull |
|
47 |
cd ..
|
|
48 |
else
|
|
49 |
git clone git://git.musicpd.org/qball/gmpc-$plugin.git ; |
|
50 |
fi
|
|
51 |
done
|
|
52 |
||
53 |
# [2] Create POT and update PO files
|
|
54 |
||
55 |
echo "Updating po files..." |
|
56 |
for plugin in $plugins ; do |
|
57 |
shopt -s nullglob
|
|
58 |
cd gmpc-$plugin/po |
|
59 |
intltool-update -p |
|
60 |
cd ../../
|
|
61 |
done
|
|
62 |
||
63 |
## [3] Copy POT to l10n git branch
|
|
64 |
||
65 |
cd gmpc-l10n
|
|
66 |
echo "Moving POTs to l10n branch" |
|
67 |
for plugin in $plugins ; do |
|
68 |
mkdir -p $plugin/
|
|
69 |
mv ../gmpc-$plugin/po/*.pot $plugin/ # git pull from local repo doesn't seem to work |
|
3219
by Omar Campagne
changes in script, adding one more |
70 |
git add $plugin # In case it doesn't exist |
3213
by Omar Campagne
Uploading script and manpage |
71 |
done
|
3224
by Omar Campagne
added manpages (po4a) to script |
72 |
cd ..
|
73 |
||
74 |
### Manpages with po4a
|
|
75 |
||
76 |
if [ ! -d gmpc ] ; then |
|
3258
by Omar Campagne
manpage updated |
77 |
git clone git://git.musicpd.org/qball/gmpc.git |
3253
by Omar Campagne
manpage updated |
78 |
cp gmpc/doc/gmpc.1 gmpc-l10n/gmpc-manpage/ |
79 |
cd gmpc-l10n/gmpc-manpage/
|
|
80 |
po4a po4a.cfg |
|
3258
by Omar Campagne
manpage updated |
81 |
rm gmpc.1 |
3253
by Omar Campagne
manpage updated |
82 |
cd ..
|
3224
by Omar Campagne
added manpages (po4a) to script |
83 |
else
|
84 |
cp gmpc/doc/gmpc.1 gmpc-l10n/gmpc-manpage/ |
|
85 |
cd gmpc-l10n/gmpc-manpage/
|
|
86 |
po4a po4a.cfg |
|
3253
by Omar Campagne
manpage updated |
87 |
rm gmpc.1 |
3227
by Omar Campagne
fixing script |
88 |
cd ..
|
3224
by Omar Campagne
added manpages (po4a) to script |
89 |
fi
|
3213
by Omar Campagne
Uploading script and manpage |
90 |
|
3253
by Omar Campagne
manpage updated |
91 |
|
3213
by Omar Campagne
Uploading script and manpage |
92 |
## [4] Update l10n branch (elric/gmpc.git) that syncs to LP
|
93 |
||
94 |
# One commit per plugin -> l10n "item"
|
|
95 |
for plugin in $plugins ; do |
|
96 |
cd $plugin/ |
|
97 |
git commit *.pot -m "$plugin updated" |
|
98 |
cd ..
|
|
99 |
done
|
|
100 |
||
3253
by Omar Campagne
manpage updated |
101 |
cd gmpc-manpage/po
|
102 |
git commit -a -m "manpage updated"
|
|
103 |
cd ../../
|
|
3228
by Omar Campagne
Ensure manpage POT gets commited. |
104 |
|
3213
by Omar Campagne
Uploading script and manpage |
105 |
git push origin master |
3222
by Omar Campagne
making options |
106 |
}
|
107 |
||
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
108 |
|
109 |
#### This function downloads the translation from LP
|
|
110 |
## and commits them to each git repository
|
|
3222
by Omar Campagne
making options |
111 |
bzr_download () { |
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
112 |
if [ -d l10nexport ] ; then |
113 |
cd l10nexport
|
|
114 |
echo "Fetching new revsions in LP" |
|
115 |
bzr update |
|
116 |
cd ..
|
|
3222
by Omar Campagne
making options |
117 |
else
|
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
118 |
echo "Downloading branch...." |
3222
by Omar Campagne
making options |
119 |
bzr branch lp:~gmpc-developers/gmpc/l10nexport |
120 |
fi
|
|
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
121 |
|
122 |
### Plugins update LP2git
|
|
123 |
||
124 |
cd l10nexport
|
|
125 |
for plugin in $plugins; do |
|
126 |
cd $plugin |
|
127 |
echo "Copying PO files to git repos" |
|
128 |
for file in . ; do |
|
129 |
cp -r $file ../../gmpc-$plugin/po/ ; |
|
130 |
done
|
|
131 |
cd ..
|
|
132 |
done
|
|
133 |
||
134 |
cd ..
|
|
135 |
||
136 |
for plugin in $plugins ; do |
|
137 |
cd gmpc-$plugin |
|
138 |
git commit -a "$plugin translations updated" |
|
139 |
git push origin master |
|
140 |
cd ..
|
|
141 |
done
|
|
3222
by Omar Campagne
making options |
142 |
}
|
143 |
||
3239
by Omar Campagne
Adding PO update in git repos from changes in LP |
144 |
### Manpages update
|
145 |
||
146 |
### Do be done when it is decided how to distribute the translations
|
|
147 |
||
148 |
### Messages update
|
|
149 |
||
3222
by Omar Campagne
making options |
150 |
help_message () { |
151 |
echo "$0 [option]" |
|
152 |
echo "-h This message" |
|
153 |
echo "-u, --update Full update process, from downloading/updating the po files in git " |
|
154 |
echo " to making them available in LP after the bzr sync" |
|
155 |
echo "-d, --download For now, only downloads/updates the bzr branch with" |
|
156 |
echo " LP translations. + alias than function" |
|
157 |
}
|
|
158 |
||
159 |
if [ ! -n "$1" ] ; then # Show usage if no parameter is given |
|
160 |
help_message |
|
161 |
exit 1 |
|
162 |
else
|
|
163 |
case $1 in |
|
164 |
-u|--update) update_po;; |
|
165 |
-d|--download) bzr_download;; |
|
166 |
-h|--help) help_message;; |
|
167 |
-*|--*) echo "The option '$1' doesn't exist";; |
|
168 |
esac
|
|
169 |
fi
|