Index: trunk/l10n-support/ca/scripts/doc_parse_dates.sh =================================================================== --- trunk/l10n-support/ca/scripts/doc_parse_dates.sh (revision 1517295) +++ trunk/l10n-support/ca/scripts/doc_parse_dates.sh (revision 1517296) @@ -1,135 +1,135 @@ #!/bin/bash # # The goal is parse screenshots date changes in KDE tranlations. # - kio-extras is problematic # - trunk and kf5 only # - working fine ;-) # ... LANGCODE="$LANGUAGE" # 'ca' code for Catalan GITREPO="https://cgit.kde.org" SVNREPO="svn://anonsvn.kde.org" header_table() { echo -e "\n Screenshot name Git date SVN date" echo " |--------------------------------------------------|---------------|---------------|" } footer_table() { echo -e " |--------------------------------------------------|---------------|---------------|\n" } found_ss() { ls documentation/$MODULE/$DOCDIR/{*.jpg,*.png} 2>/dev/null | head -1; } MODULE0="" # Search folders created with DocBook files that are in the repo translations. for docdir in $(find $LANGCODE/docs/* -type f -name *.docbook | xargs dirname | sort | uniq) do MODULE=$(dirname $docdir | cut -f 3 -d'/') # applications DOCDIR0=$(dirname $docdir | cut -f 4 -d'/') # kioslave, kcontrol5 or kioslave5 DOCDIR=$(basename $docdir) # keditbookmarks if [ -n $MODULE0 ];then [ "$MODULE" != "$MODULE0" ] && read -p "'$MODULE' be parsed: Are you sure? Y/y or N/n: " && [[ $REPLY =~ ^[Nn]$ ]] && exit 0 fi MODULE0="$MODULE" # wacomtablet, gopher, gdrive, kcm_ssl, kcron, kamera, cddbretrieval5, audiocd # blockdevices, desktop, kgamma5, khotkeys, kwindecoration, kwineffects, kwinscreenedges # kwintabbox, plasma-pa, powerdevil, screenlocker, windowbehaviour, windowspecific if [[ "$DOCDIR" = +(wacomtablet|gopher|gdrive|kcm_ssl|kcron|kamera|cddbretrieval5|audiocd|blockdevices|desktop|kgamma5|khotkeys|kwindecoration|kwineffects|kwinscreenedges|kwintabbox|plasma-pa|powerdevil|screenlocker|windowbehaviour|windowspecific) ]]; then GITDIR=$(grep "/$DOCDIR " scripts/documentation_paths) DOCDIR=$(echo "$GITDIR" | cut -f 2 -d' ') # calligra elif [[ "$DOCDIR" = +(calligra|sheets|stage) ]]; then GITDIR="$GITREPO/calligra.git HEAD:doc/$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 3 -d':' | sed -e 's/doc\///') # plasma-sdk elif [[ "$DOCDIR" = +(engineexplorer|plasmoidviewer) ]]; then GITDIR="$(grep "^entry plasma-sdk " scripts/documentation_paths)$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 2 -d' ') # plasma-desktop elif [[ "$DOCDIR" = +(autostart|baloo|clock|colors|componentchooser|cursortheme|desktopthemedetails|emoticons|fontinst|fonts|formats|icons|joystick|kcmaccess|kcmlaunchfeedback|kcmnotify|kcmsmserver|kcmstyle|kded|keyboard|keys|mouse|paths|phonon|solid-actions|solid-device-automounter|spellchecking|splashscreen|translations|workspaceoptions) ]]; then GITDIR="$GITREPO/plasma-desktop.git HEAD:doc/kcontrol/$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 3 -d':' | sed -e 's/doc\///') # konqueror - kcontrol5 elif [[ "$DOCDIR" = +(bookmarks|filemanager|history|kcmcss|khtml-adblock|khtml-behavior|khtml-general|khtml-java-js|performance) ]]; then GITDIR="$GITREPO/konqueror.git HEAD:doc/kcontrol5/$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 3 -d':' | sed -e 's/doc\///') # kio elif [[ "$DOCDIR" = +(cache|cookies|netpref|proxy|smb|trash|useragent|webshortcuts) ]]; then [ "$DOCDIR" = "smb" ] && [ "$DOCDIR0" = "kioslave5" ] && continue GITDIR="$GITREPO/kio.git HEAD:docs/kcontrol5/$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 3 -d':' | sed -e 's/docs\///') elif [[ "$DOCDIR" = +(data|file|ftp|help|documentationnotfound|http|mailto|telnet|webdav) ]]; then GITDIR="$GITREPO/kio.git HEAD:docs/kioslave5/$DOCDIR" test "$DOCDIR" = documentationnotfound && GITDIR="$GITREPO/kio.git HEAD:docs/kioslave5/help/$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 3 -d':' | sed -e 's/docs\///') # kde-cli-tools elif [ "$DOCDIR" = "filetypes" ]; then GITDIR="$GITREPO/kde-cli-tools.git HEAD:docs/kcontrol5/$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 3 -d':' | sed -e 's/docs\///') # kio-extras elif [[ "$DOCDIR" = +(bookmarks|bzip2|fish|gzip|info|man|network|nfs|recentdocuments|sftp|smb|tar|thumbnail|xz) ]]; then [ "$DOCDIR" = "smb" ] && [ "$DOCDIR0" = "kcontrol5" ] && continue GITDIR="$GITREPO/kio-extras.git HEAD:doc/kioslave5/$DOCDIR" DOCDIR=$(echo "$GITDIR" | cut -f 3 -d':' | sed -e 's/doc\///') # ldap, pop3, sieve elif [[ "$DOCDIR" = +(ldap|pop3|sieve) ]]; then GITDIR=$(grep "/$DOCDIR " scripts/documentation_paths) DOCDIR=$(echo "$GITDIR" | cut -f 2 -d' ') else GITDIR=$(grep "^entry $DOCDIR " scripts/documentation_paths) fi [ -z "$GITDIR" ] && GITDIR="\e[0;31m** Solve GITDIR var! **\e[0m" echo -e "** $docdir -> $GITDIR" # NOTE: If GITDIR var is empty, add or change above # Var empty, not pparsed [ -z "$GITDIR" ] && continue # Without screenshots, not parsed [ -z $(found_ss) ] && continue # Translated index.docbook = doc is released if [ $(find $docdir/* -type f -name "index.docbook") ]; then [ -n $(found_ss) ] && header_table # Find item/s into documentation/'module'/'app' local dir for screenshot in $(find documentation/$MODULE/$DOCDIR/* -type f -name "*.png" -o -name "*.jpg") do GITM=$(echo $GITDIR | awk '{print $3}' FS=".git" | cut -f 2 -d'/') GITD=$(echo $GITDIR | awk '{print $2}' FS="HEAD:") SCREENSHOT=$(basename $screenshot) OUTPUT_FILE="$MODULE-$DOCDIR0$DOCDIR-$SCREENSHOT.html" # Git: date get from the svn web server (I do not know any other option within the KDE infrastructure) wget --quiet --tries=100 --output-document=$OUTPUT_FILE $GITREPO/$GITM.git/log/$GITD/$SCREENSHOT DATE_G=$(grep "^" $OUTPUT_FILE | tail -n 1 | awk '{print $2}' FS="" | tr -d '\-') # SVN: date get from nonsvn.kde.org (in the local file, it can be incorrect) if [ -f $docdir/$SCREENSHOT ]; then DATE_S=$(svn log $SVNREPO/home/kde/trunk/l10n-kf5/$docdir/$SCREENSHOT | grep "^r" | head -1 | awk '{print $5}' | tr -d '-') [ $DATE_S -gt $DATE_G ] && DATE_S="\e[0;32m$DATE_S\e[0m" || DATE_S="\e[0;31m$DATE_S\e[0m" else - DATE_S="\e[1;31mNot found!\e[0m |" + DATE_S="\e[1;31mNot found!\e[0m" fi - printf "%-63s %-15s %-15s \n" " - $(echo -e "\e[0;36m$SCREENSHOT\e[0m")" "| $DATE_G" "| $(echo -e $DATE_S) |" + printf "%-63s %-15s %-26s %0s \n" " - $(echo -e "\e[0;36m$SCREENSHOT\e[0m")" "| $DATE_G" "| $(echo -e $DATE_S)" "|" rm -f $OUTPUT_FILE done [ -n $(found_ss) ] && footer_table # Detect possible screenshot/s that no longer exist for screenshot in $(ls $docdir/{*.jpg,*.png} 2>/dev/null) do SCREENSHOT=$(basename $screenshot) [ -f "documentation/$MODULE/$DOCDIR/$SCREENSHOT" ] || NOTEXSIST="\e[1;31m$SCREENSHOT\e[0m $NOTEXSIST" done if [ -n "$NOTEXSIST" ];then - echo -e "\n These screenshots no longer exist! Remove it (or rename)" + echo -e " These screenshots no longer exist! Remove it (or rename)" echo -e " |----------------------------------------------------------------------------------|" - printf "%-85s" " - $(echo -e "$NOTEXSIST" | sort | sed -e 's/ /, /g' -e 's/, $//g')" + printf "%-85s" " - $(echo -e "$NOTEXSIST" | sort | sed -e 's/ /, /g' -e 's/, $//g')." echo -e "\n |----------------------------------------------------------------------------------|\n" fi fi done exit 0