summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2005-07-29 18:22:32 +0000
committerschodet2005-07-29 18:22:32 +0000
commit62662d162c217d2457df4abb9355165b79de816d (patch)
tree94a392f470988bef0f383d4075f86c9e6f73a156
parent1ae2a29d75aca1dc612aebe5238ec4df109c1418 (diff)
Ajout des scripts de mise à jour de svnco.
-rwxr-xr-xd/sys/lampion/local/bin/scan-svnco56
-rwxr-xr-xd/sys/lampion/local/bin/update-svnco46
2 files changed, 102 insertions, 0 deletions
diff --git a/d/sys/lampion/local/bin/scan-svnco b/d/sys/lampion/local/bin/scan-svnco
new file mode 100755
index 0000000..7b087e7
--- /dev/null
+++ b/d/sys/lampion/local/bin/scan-svnco
@@ -0,0 +1,56 @@
+#!/usr/bin/perl -w
+#
+# Ceci est un script sur mesure pour update-scnco.
+#
+use strict;
+
+sub find_files
+{
+ my ($dir, $want) = @_;
+ local $_;
+ my $d;
+ # Look for a Makefile.
+ if (-f "$dir/Makefile")
+ {
+ print $dir, "\n" if $want eq 'make';
+ # Only html keep running.
+ return unless $want eq 'html';
+ }
+ # For each file.
+ if (opendir $d, $dir)
+ {
+ while ($_ = readdir $d)
+ {
+ my $f = $dir . '/' . $_;
+ # Skip ., .., and hidden files.
+ next if /^\./;
+ # Skip Doxygen dirs.
+ next if $_ eq 'html';
+ # Skip robot www dir.
+ next if $_ eq 'www';
+ # Recurse to subdirs.
+ if (-d $f)
+ {
+ find_files ($f, $want);
+ }
+ # Find (aft) text files or recent html files.
+ elsif ($want eq 'txt' && /\.txt$/
+ || $want eq 'html' && /\.html$/ && -M $f < 10)
+ {
+ print $f, "\n";
+ }
+ }
+ closedir $d;
+ }
+}
+
+if (scalar @ARGV != 1 || $ARGV[0] !~ /^(?:make|txt|html)$/)
+{
+ print <<EOF;
+scan-svnco - scan a svn check out and find interresting files or directories.
+scan-svnco txt|make|html
+EOF
+ exit 1;
+}
+
+find_files ('.', @ARGV);
diff --git a/d/sys/lampion/local/bin/update-svnco b/d/sys/lampion/local/bin/update-svnco
new file mode 100755
index 0000000..a377d2c
--- /dev/null
+++ b/d/sys/lampion/local/bin/update-svnco
@@ -0,0 +1,46 @@
+#!/usr/bin/zsh
+
+export PATH=$PATH:/usr/local/bin
+
+svncodir=/var/data/svnco
+readme=README.html
+
+cd $svncodir || exit 1
+
+exec 1> /tmp/update-svnco-output
+
+# Update SVN.
+
+svn up || echo "Error in svn up" >&2
+for i in $(scan-svnco make)
+do
+ make -C $i doc
+done
+for i in $(scan-svnco txt)
+do
+ echo "AFT $i"
+ grep -q '^*Title' $i && aft $i && [[ -f $i-TOC ]] && aft $i
+done
+
+exec 1> $readme
+
+cat <<EOF
+<pre>Codes :
+-------
+
+a : électronique analogique.
+b : bureau.
+d : outils et méthodes de dévelopement.
+i : informatique.
+n : électronique numérique.
+m : mécanique.
+p : gestion de projet.
+
+Documentation récente :
+-----------------------
+
+EOF
+scan-svnco html | \
+sed -ne 's|^\./\(.*\)/\([^/]*\.html\)$|<a href="\1/">\1</a>/<a href="\1/\2">\2</a>|p' \
+ -e 's|^\./\(.*\)/\([^/]*\)$|<a href="\1/">\1</a>/\2|p'
+echo '</pre>'