basic svn capability
svn path=/trunk/; revision=31288
This commit is contained in:
parent
c92b1a0686
commit
02f1d40e09
85
build/arguments.sh
Executable file
85
build/arguments.sh
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
basedir="$(realpath -m "$0/../..")"
|
||||
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
-s|--statusdir|--status-dir)
|
||||
[ "$#" -gt 0 ] && shift 1 && statusdir="$1"
|
||||
;;
|
||||
--domain)
|
||||
[ "$#" -gt 0 ] && shift 1 && domain="$1"
|
||||
;;
|
||||
--source)
|
||||
[ "$#" -gt 0 ] && shift 1 && basedir="$1"
|
||||
;;
|
||||
-d|--dest|--destination)
|
||||
[ "$#" -gt 0 ] && shift 1 && target="$1"
|
||||
;;
|
||||
-h|--help)
|
||||
command="help"
|
||||
;;
|
||||
build_into)
|
||||
command="$1$command"
|
||||
[ "$#" -gt 0 ] && shift 1 && target="$1"
|
||||
;;
|
||||
svn_build_into)
|
||||
command="$1$command"
|
||||
[ "$#" -gt 0 ] && shift 1 && target="$1"
|
||||
;;
|
||||
build_xmlstream)
|
||||
command="$1$command"
|
||||
[ "$#" -gt 0 ] && shift 1 && workfile="$1"
|
||||
[ "$#" -gt 0 ] && shift 1 && olang="$1"
|
||||
;;
|
||||
tree_maker)
|
||||
command="$1$command"
|
||||
[ -n "$target" -o -n "$3" ] && shift 1 && tree="$1"
|
||||
shift 1; [ -n "$1" ] && target="$1"
|
||||
;;
|
||||
process_file)
|
||||
command="$1$command"
|
||||
[ "$#" -gt 0 ] && shift 1 && workfile="$1"
|
||||
[ "$#" -gt 0 ] && shift 1 && processor="$1"
|
||||
[ "$#" -gt 0 ] && shift 1 && olang="$1"
|
||||
;;
|
||||
sourceglobs)
|
||||
command="$1$command"
|
||||
[ "$#" -gt 0 ] && shift 1 && sourcesfile="$1"
|
||||
;;
|
||||
cast_globfile)
|
||||
command="$1$command"
|
||||
[ "$#" -gt 0 ] && shift 1 && sourceglobfile="$1"
|
||||
[ "$#" -gt 0 ] && shift 1 && lang="$1"
|
||||
[ "$#" -gt 0 ] && shift 1 && globfile="$1"
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
[ "$#" -gt 0 ] && shift 1
|
||||
done
|
||||
|
||||
olang="${olang:-en}"
|
||||
tree="${tree:-$basedir}"
|
||||
readonly tree="${tree:+$(realpath "$tree")}"
|
||||
readonly basedir="${basedir:+$(realpath "$basedir")}"
|
||||
readonly statusdir="${statusdir:+$(realpath "$statusdir")}"
|
||||
readonly target="${target:+$(realpath "$target")}"
|
||||
readonly domain="${domain:-www.fsfe.org}"
|
||||
readonly command
|
||||
|
||||
case "$command" in
|
||||
build_into) [ -z "$target" ] && die "Missing destination directory" ;;
|
||||
svn_build_into) [ -z "$target" ] && die "Missing destination directory" ;;
|
||||
process_file) [ -z "$workfile" ] && die "Need at least input file" ;;
|
||||
build_xmlstream) [ -z "$workfile" ] && die "Missing xhtml file name" ;;
|
||||
tree_maker) [ -z "$target" ] && die "Missing target location" ;;
|
||||
sourceglobs) [ -z "$sourcesfile" ] && die "Missing .sources file" ;;
|
||||
cast_globfile) [ -z "$sourceglobfile" -o -z "$lang" -o -z "$globfile" ] && die "Need source globfile language and globfile" ;;
|
||||
*help*) print_help; exit 0 ;;
|
||||
*) die "Urecognised command or no command given" ;;
|
||||
esac
|
||||
|
@ -1,129 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
basedir="$(realpath -m "$0/../..")"
|
||||
|
||||
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
|
||||
|
||||
. "$basedir/build/arguments.sh"
|
||||
|
||||
buildpids=$(
|
||||
ps -eo pid,command \
|
||||
| egrep 'sh .*[b]uild_main.sh .*' \
|
||||
| wc -l
|
||||
)
|
||||
if [ "$buildpids" -gt 2 ]; then
|
||||
if [ $command = "build_into" -o $command = "svn_build_into" ] && [ "$buildpids" -gt 2 ]; then
|
||||
print_error "build script is already running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
|
||||
[ -z "$inc_buildrun" ] && . "$basedir/build/buildrun.sh"
|
||||
[ -z "$inc_buildrun" ] && . "$basedir/build/buildrun.sh"
|
||||
[ -z "$inc_languages" ] && . "$basedir/build/languages.sh"
|
||||
[ -z "$inc_makerules" ] && . "$basedir/build/makerules.sh"
|
||||
[ -z "$inc_processor" ] && . "$basedir/build/processor.sh"
|
||||
[ -z "$inc_scaffold" ] && . "$basedir/build/scaffold.sh"
|
||||
[ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
|
||||
|
||||
domain="www.fsfe.org"
|
||||
|
||||
while [ -n "$*" ]; do
|
||||
case "$1" in
|
||||
-s|--statusdir|--status-dir)
|
||||
[ -n "$*" ] && shift 1 && statusdir="$1"
|
||||
;;
|
||||
--domain)
|
||||
[ -n "$*" ] && shift 1 && domain="$1"
|
||||
;;
|
||||
--source)
|
||||
[ -n "$*" ] && shift 1 && basedir="$1"
|
||||
;;
|
||||
-d|--dest|--destination)
|
||||
[ -n "$*" ] && shift 1 && target="$1"
|
||||
;;
|
||||
-h|--help)
|
||||
command="help"
|
||||
;;
|
||||
build_into)
|
||||
command="$1$command"
|
||||
[ -n "$*" ] && shift 1 && target="$1"
|
||||
;;
|
||||
build_xmlstream)
|
||||
command="$1$command"
|
||||
[ -n "$*" ] && shift 1 && workfile="$1"
|
||||
[ -n "$*" ] && shift 1 && olang="$1"
|
||||
;;
|
||||
tree_maker)
|
||||
command="$1$command"
|
||||
[ -n "$target" -o -n "$3" ] && shift 1 && tree="$1"
|
||||
shift 1; [ -n "$1" ] && target="$1"
|
||||
;;
|
||||
process_file)
|
||||
command="$1$command"
|
||||
[ -n "$*" ] && shift 1 && workfile="$1"
|
||||
[ -n "$*" ] && shift 1 && processor="$1"
|
||||
[ -n "$*" ] && shift 1 && olang="$1"
|
||||
;;
|
||||
sourceglobs)
|
||||
command="$1$command"
|
||||
[ -n "$*" ] && shift 1 && sourcesfile="$1"
|
||||
;;
|
||||
cast_globfile)
|
||||
command="$1$command"
|
||||
[ -n "$*" ] && shift 1 && sourceglobfile="$1"
|
||||
[ -n "$*" ] && shift 1 && lang="$1"
|
||||
[ -n "$*" ] && shift 1 && globfile="$1"
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
[ -n "$*" ] && shift 1
|
||||
done
|
||||
|
||||
[ -z "$tree" ] && tree="$basedir"
|
||||
tree="$(realpath "$tree")"
|
||||
basedir="$(realpath "$basedir")"
|
||||
target="$(realpath "$target")"
|
||||
[ -z "$inc_scaffold" ] && . "$basedir/build/scaffold.sh"
|
||||
[ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
|
||||
|
||||
if [ -n "$statusdir" ]; then
|
||||
mkdir -p "$statusdir"
|
||||
statusdir="$(realpath "$statusdir")"
|
||||
if [ ! -w "$statusdir" -o ! -d "$statusdir" ]; then
|
||||
print_error "Unable to set up status directory in \"$statusdir\",
|
||||
either select a status directory that exists and is writable,
|
||||
or run the build script without output to a status directory"
|
||||
exit 1
|
||||
fi
|
||||
[ ! -w "$statusdir" -o ! -d "$statusdir" ] && \
|
||||
die "Unable to set up status directory in \"$statusdir\",\n" \
|
||||
"either select a status directory that exists and is writable,\n" \
|
||||
"or run the build script without output to a status directory"
|
||||
fi
|
||||
|
||||
case "$command" in
|
||||
build_into)
|
||||
[ -z "$target" ] && print_error "Missing destination directory" && exit 1
|
||||
build_into
|
||||
;;
|
||||
process_file)
|
||||
[ -z "$workfile" ] && print_error "Need at least input file" && exit 1
|
||||
process_file "$workfile" "$processor" "$olang"
|
||||
;;
|
||||
build_xmlstream)
|
||||
[ -z "$workfile" ] && print_error "Missing xhtml file name" && exit 1
|
||||
build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" "$olang"
|
||||
;;
|
||||
tree_maker)
|
||||
[ -z "$target" ] && print_error "Missing target location" && exit 1
|
||||
tree_maker "$tree" "$target"
|
||||
;;
|
||||
sourceglobs)
|
||||
[ -z "$sourcesfile" ] && print_error "Missing .sources file" && exit 1
|
||||
sourceglobs "$sourcesfile"
|
||||
;;
|
||||
cast_globfile)
|
||||
[ -z "$sourceglobfile" -o -z "$lang" -o -z "$globfile" ] && print_error "Need source globfile language and globfile" && exit 1
|
||||
cast_globfile "$sourceglobfile" "$lang" "$globfile"
|
||||
;;
|
||||
*help*)
|
||||
print_help
|
||||
;;
|
||||
*)
|
||||
print_error "Urecognised command or no command given"
|
||||
;;
|
||||
build_into) build_into ;;
|
||||
svn_build_into) svn_build_into ;;
|
||||
process_file) process_file "$workfile" "$processor" "$olang" ;;
|
||||
build_xmlstream) build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" "$olang" ;;
|
||||
tree_maker) tree_maker "$tree" "$target" ;;
|
||||
sourceglobs) sourceglobs "$sourcesfile" ;;
|
||||
cast_globfile) cast_globfile "$sourceglobfile" "$lang" "$globfile" ;;
|
||||
esac
|
||||
|
@ -4,52 +4,7 @@ inc_buildrun=true
|
||||
[ -z "$inc_makerules" ] && . "$basedir/build/makerules.sh"
|
||||
[ -z "$inc_stirrups" ] && . "$basedir/build/stirrups.sh"
|
||||
[ -z "$inc_logging" ] && . "$basedir/build/logging.sh"
|
||||
|
||||
svn_update(){
|
||||
run_make=true
|
||||
regen_globs=false
|
||||
regen_xsldeps=false
|
||||
regen_xhtml=false
|
||||
regen_copy=false
|
||||
|
||||
svn update "$basedir" 2>&1 \
|
||||
| logstatus SVNchanges \
|
||||
| while read update; do
|
||||
case "$update" in
|
||||
Updating*) true;;
|
||||
Updated*) true;;
|
||||
"At revision"*) run_make=false;;
|
||||
C???" "*) conflict=true;;
|
||||
?C??" "*) conflict=true;;
|
||||
???C" "*) conflict=true;;
|
||||
A???" "*.xml) regen_globs=true;;
|
||||
[UGR]???" "*.xml) true;;
|
||||
????" "*.xml) regen_globs=true;;
|
||||
A???" "*.sources) echo "$update";;
|
||||
[UGR]???" "*.sources) regen_globs=true;;
|
||||
????" "*.sources) regen_globs=true;;
|
||||
A???" "*.xsl) echo "$update";;
|
||||
[UGR]???" "*.xsl) regen_xsldeps=true;;
|
||||
????" "*.xsl) regen_xsldeps=true;;
|
||||
A???" "*.xhtml) echo "$update"
|
||||
regen_globs=true;;
|
||||
[UGR]???" "*.xhtml) true;;
|
||||
????" "*.xhtml) regen_xhtml=true;;
|
||||
????" "*Makefile) true;;
|
||||
A???" "*) echo "$update";;
|
||||
[UGR]???" "*) true;;
|
||||
????" "*) regen_copy=true;;
|
||||
*) true;;
|
||||
esac
|
||||
done | cut -c6-
|
||||
}
|
||||
|
||||
svn_build_into(){
|
||||
svn_update \
|
||||
| logstatus additions
|
||||
|
||||
build_into
|
||||
}
|
||||
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
|
||||
|
||||
build_into(){
|
||||
ncpu="$(grep -c ^processor /proc/cpuinfo)"
|
||||
@ -61,7 +16,7 @@ build_into(){
|
||||
|
||||
dir_maker "$basedir" "$target"
|
||||
|
||||
tree_maker "$basedir" "$target" \
|
||||
tree_maker "$basedir" "$target" "$@" \
|
||||
| logstatus Makefile \
|
||||
| build_manifest \
|
||||
| logstatus manifest \
|
||||
@ -71,3 +26,40 @@ build_into(){
|
||||
make -j $ncpu -f "$(logname Makefile)" all \
|
||||
| logstatus buildlog
|
||||
}
|
||||
|
||||
svn_build_into(){
|
||||
forcelog SVNchanges; SVNchanges="$(logname SVNchanges)"
|
||||
forcelog SVNerrors; SVNerrors="$(logname SVNerrors)"
|
||||
|
||||
svn update "$basedir" >"$SVNchanges" 2>"$SVNerrors"
|
||||
|
||||
if [ -s "$SVNerrors" ]; then
|
||||
print_error "SVN reported the following problem:\n" \
|
||||
"$(cat "$SVNerrors")"
|
||||
exit 1
|
||||
elif egrep '^(C...|.C..|...C) .+' "$SVNchanges"; then
|
||||
print_error "SVN encountered a conflict:\n" \
|
||||
"$(cat "$SVNchanges")"
|
||||
exit 1
|
||||
elif egrep '^At revision [0-9]+\.' "$SVNchanges"; then
|
||||
debug "No changes to SVN:\n" \
|
||||
"$(cat "$SVNchanges")"
|
||||
exit 0
|
||||
else
|
||||
regen_globs=false
|
||||
regen_xhtml=false
|
||||
regen_xsldeps=false
|
||||
regen_copy=false
|
||||
|
||||
egrep -q '^[^UGR]... .*\.xml' "$SVNchanges" && regen_globs=true
|
||||
egrep -q '^[^A]... .*\.sources' "$SVNchanges" && regen_globs=true
|
||||
egrep -q '^A... .*\.xhtml' "$SVNchanges" && regen_globs=true
|
||||
egrep -q '^[^AUGR]... .*\.xhtml' "$SVNchanges" && regen_xhtml=true
|
||||
egrep -q '^A... .*\.xsl' "$SVNchanges" && regen_xhtml=true
|
||||
egrep -q '^[^A]... .*\.xsl' "$SVNchanges" && regen_xsldeps=true
|
||||
sed -r '/.*\.(xml|xsl|xhtml|sources)$/d;/Makefile$/d' "$SVNchanges" \
|
||||
| egrep -q '^[AUGR]... .*' && regen_copy=true
|
||||
|
||||
build_into $(sed -rn '/.*(Makefile|\.xml)$/d;s;^A... (.+)$;\1;p' "$SVNchanges")
|
||||
fi
|
||||
}
|
||||
|
@ -53,13 +53,25 @@ $(mes "$globfile"): $(mes "$sourceglobfile")
|
||||
MakeEND
|
||||
done
|
||||
}
|
||||
|
||||
glob_makers(){
|
||||
# generate make rules for globbing all .sources files
|
||||
# within input tree
|
||||
sourcefind -name '*.sources' \
|
||||
| while read filepath; do
|
||||
glob_maker "$filepath"
|
||||
done
|
||||
}
|
||||
|
||||
glob_additions(){
|
||||
printf "$input/%s\n" "$@" \
|
||||
| egrep '.+\.sources$' \
|
||||
| xargs realpath \
|
||||
| while read addition; do
|
||||
glob_maker "${addition#$input/}"
|
||||
done
|
||||
}
|
||||
|
||||
xhtml_maker(){
|
||||
# generate make rules for building html files out of xhtml
|
||||
# account for included xml files and xsl rules
|
||||
@ -106,19 +118,19 @@ xhtml_maker(){
|
||||
cat <<MakeEND
|
||||
all: $(mes "$outfile" "$outlink")
|
||||
$(mes "$outfile"): $(mes "$depfile" "$processor" "$textsen" "$textsfile" "$fundraisingfile" "$menufile" "$sourceglobs")
|
||||
\${PROCESSOR} \${PROCFLAGS} "${infile}" "$(mio "$processor")" "$olang" >"$outfile"
|
||||
\${PROCESSOR} \${PROCFLAGS} process_file "${infile}" "$(mio "$processor")" "$olang" >"$outfile"
|
||||
$(mes "$outlink"):
|
||||
ln -sf "${outbase}" "${outlink}"
|
||||
MakeEND
|
||||
$bool_rss && cat<<MakeEND
|
||||
all: $(mes "$rssfile")
|
||||
$(mes "$rssfile"): $(mes "$depfile" "${shortname}.rss.xsl" "$textsen" "$textsfile" "$fundraisingfile" "$menufile" "$sourceglobs")
|
||||
\${PROCESSOR} \${PROCFLAGS} "${infile}" "$(mio "${shortname}.rss.xsl")" "$olang" >"$rssfile"
|
||||
\${PROCESSOR} \${PROCFLAGS} process_file "${infile}" "$(mio "${shortname}.rss.xsl")" "$olang" >"$rssfile"
|
||||
MakeEND
|
||||
$bool_ics && cat<<MakeEND
|
||||
all: $(mes "$icsfile")
|
||||
$(mes "$icsfile"): $(mes "$depfile" "${shortname}.ics.xsl" "$textsen" "$textsfile" "$fundraisingfile" "$menufile" "$sourceglobs")
|
||||
\${PROCESSOR} \${PROCFLAGS} "${infile}" "$(mio "${shortname}.ics.xsl")" "$olang" >"$icsfile"
|
||||
\${PROCESSOR} \${PROCFLAGS} process_file "${infile}" "$(mio "${shortname}.ics.xsl")" "$olang" >"$icsfile"
|
||||
MakeEND
|
||||
$bool_indexname && cat <<MakeEND
|
||||
all: $(mes "$outpath/index.${lang}.html" "$outpath/index.html.$lang")
|
||||
@ -129,15 +141,27 @@ $(mes "$outpath/index.html.$lang"):
|
||||
MakeEND
|
||||
done
|
||||
}
|
||||
|
||||
xhtml_makers(){
|
||||
# generate make rules concerning all .xhtml files in source tree
|
||||
sourcefind -name '*.[a-z][a-z].xhtml' \
|
||||
| sed -r "s;^(.+)\.[a-z][a-z]\.xhtml$;\1;" \
|
||||
| sed -r 's;\.[a-z][a-z]\.xhtml$;;' \
|
||||
| sort -u \
|
||||
| while read shortpath; do
|
||||
xhtml_maker "$shortpath" "$(dirname "$shortpath")"
|
||||
done
|
||||
}
|
||||
|
||||
xhtml_additions(){
|
||||
printf "$input/%s\n" "$@" \
|
||||
| sed -rn 's;\.[a-z][a-z]\.xhtml$;;p' \
|
||||
| sort -u \
|
||||
| xargs realpath \
|
||||
| while read addition; do
|
||||
xhtml_maker "${addition#$input/}" "$(dirname "${addition#$input/}")"
|
||||
done
|
||||
}
|
||||
|
||||
copy_maker(){
|
||||
# generate make rule for copying a plain file
|
||||
infile="\${INPUTDIR}/$1"
|
||||
@ -150,7 +174,9 @@ $(mes "$outfile"): $(mes "$infile")
|
||||
cp "$infile" "$outfile"
|
||||
MakeEND
|
||||
}
|
||||
|
||||
copy_makers(){
|
||||
# generate copy rules for entire input tree
|
||||
sourcefind \! -name 'Makefile' \! -name '*.sourceglobs' \! -name '*.sources' \
|
||||
\! -name '*.xhtml' \! -name '*.xml' \! -name '*.xsl' \
|
||||
| while read filepath; do
|
||||
@ -158,7 +184,19 @@ copy_makers(){
|
||||
done
|
||||
}
|
||||
|
||||
copy_additions(){
|
||||
printf "$input/%s\n" "$@" \
|
||||
| egrep -v '.+(\.sources|\.sourceglobs|\.xhtml|\.xml|\.xsl|/Makefile|/)$' \
|
||||
| xargs realpath \
|
||||
| while read addition; do
|
||||
copy_maker "${addition#$input/}" "$(dirname "${addition#$input/}")"
|
||||
done
|
||||
}
|
||||
|
||||
xslt_dependencies(){
|
||||
# list referenced xsl files for a given xsl file
|
||||
# *not* recursive since Make will handle recursive
|
||||
# dependency resolution
|
||||
file="$1"
|
||||
|
||||
cat "$file" \
|
||||
@ -180,24 +218,47 @@ $(mes "$file"): $(mes $deps)
|
||||
touch "$(mio "$file")"
|
||||
MakeEND
|
||||
}
|
||||
|
||||
xslt_makers(){
|
||||
# generate make dependencies for all .xsl files in input tree
|
||||
sourcefind -name '*.xsl' \
|
||||
| while read filepath; do
|
||||
xslt_maker "$filepath"
|
||||
done
|
||||
}
|
||||
|
||||
xslt_additions(){
|
||||
printf "$input/%s\n" "$@" \
|
||||
| egrep '.+\.xsl$' \
|
||||
| xargs realpath \
|
||||
| while read addition; do
|
||||
xslt_maker "${addition#$input/}"
|
||||
done
|
||||
}
|
||||
|
||||
copy_sources(){
|
||||
# generate rules to copy all .xhtml files in the input to
|
||||
# the public source directory
|
||||
sourcefind -name '*.xhtml' \
|
||||
| while read filepath; do
|
||||
copy_maker "$filepath" "source/$(dirname "$filepath")"
|
||||
done
|
||||
}
|
||||
|
||||
copy_sourceadditions(){
|
||||
printf "$input/%s\n" "$@" \
|
||||
| egrep '.+\.xhtml$' \
|
||||
| xargs realpath \
|
||||
| while read addition; do
|
||||
copy_maker "${addition#$input/}" "source/$(dirname "${addition#$input/}")"
|
||||
done
|
||||
}
|
||||
|
||||
tree_maker(){
|
||||
# walk through file tree and issue Make rules according to file type
|
||||
input="$(realpath "$1")"
|
||||
output="$(realpath -m "$2")"
|
||||
output="$(realpath "$2")"
|
||||
shift 2
|
||||
|
||||
cache_textsfile
|
||||
cache_fundraising
|
||||
@ -219,21 +280,28 @@ tree_maker(){
|
||||
|
||||
trap "trap - 0 2 3 6 9 15; killall \"$(basename "$0")\"" 0 2 3 6 9 15
|
||||
|
||||
[ "$regen_globs" = false -a -s "$Make_globs" ] \
|
||||
[ "$regen_globs" = false -a -s "$Make_globs" ] && \
|
||||
glob_additions "$@" >>"$Make_globs" \
|
||||
|| glob_makers >"$Make_globs" &
|
||||
[ "$regen_xslt" = false -a -s "$Make_xslt" ] \
|
||||
[ "$regen_xslt" = false -a -s "$Make_xslt" ] && \
|
||||
xslt_additions "$@" >>"$Make_xslt" \
|
||||
|| xslt_makers >"$Make_xslt" &
|
||||
[ "$regen_copy" = false -a -s "$Make_copy" ] \
|
||||
[ "$regen_copy" = false -a -s "$Make_copy" ] && \
|
||||
copy_additions "$@" >>"$Make_copy" \
|
||||
|| copy_makers >"$Make_copy" &
|
||||
[ "$regen_xhtml" = false -a -s "$Make_sourcecopy" ] \
|
||||
[ "$regen_xhtml" = false -a -s "$Make_sourcecopy" ] && \
|
||||
copy_sourceadditions "$@" >>"$Make_sourcecopy" \
|
||||
|| copy_sources >"$Make_sourcecopy" &
|
||||
|
||||
[ "$regen_xhtml" = false -a -s "$Make_xhtml" ] && \
|
||||
cat "$Make_xhtml" \
|
||||
|| xhtml_makers |tee "$Make_xhtml"
|
||||
if [ "$regen_xhtml" = false -a -s "$Make_xhtml" ]; then
|
||||
cat "$Make_xhtml"
|
||||
xhtml_additions "$@" |tee -a "$Make_xhtml"
|
||||
else
|
||||
xhtml_makers |tee "$Make_xhtml"
|
||||
fi
|
||||
|
||||
wait
|
||||
trap - 0 2 3 6 9 15
|
||||
|
||||
cat "$Make_globs" "$Make_xslt" "$Make_copy" "$Make_sourcecopy"
|
||||
}
|
||||
|
||||
|
@ -25,3 +25,8 @@ print_error(){
|
||||
echo "Error: $@" |logstatus lasterror >/dev/stderr
|
||||
echo "Run '$0 --help' to see usage instructions" >/dev/stderr
|
||||
}
|
||||
|
||||
die(){
|
||||
print_error "$@"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,41 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
basedir="$(dirname $0)/.."
|
||||
|
||||
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
|
||||
[ -z "$inc_processor" ] && . "$basedir/build/processor.sh"
|
||||
|
||||
domain="www.fsfe.org"
|
||||
while [ -n "$*" ]; do
|
||||
case "$1" in
|
||||
-s|--statusdir|--status-dir)
|
||||
[ -n "$*" ] && shift 1 && statusdir="$1"
|
||||
;;
|
||||
--domain)
|
||||
[ -n "$*" ] && shift 1 && domain="$1"
|
||||
;;
|
||||
--source)
|
||||
[ -n "$*" ] && shift 1 && basedir="$1"
|
||||
;;
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
if [ -z "$workfile" ]; then
|
||||
workfile="$1"
|
||||
elif [ -z "$processor" ]; then
|
||||
processor="$1"
|
||||
elif [ -z "$olang" ]; then
|
||||
olang="$1"
|
||||
else
|
||||
print_error "Unknown option $1"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
[ -n "$*" ] && shift 1
|
||||
done
|
||||
. "$basedir/build/arguments.sh"
|
||||
|
||||
[ -z "$workfile" ] && print_error "Need at least input file" && exit 1
|
||||
process_file "$workfile" "$processor" "$olang"
|
||||
[ "$command" = process_file ] && process_file "$workfile" "$processor" "$olang" \
|
||||
|| die "Urecognised command or no command given"
|
||||
|
@ -1,16 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
inc_processor=true
|
||||
[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
|
||||
[ -z "$inc_scaffold" ] && . "$basedir/build/scaffold.sh"
|
||||
[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
|
||||
[ -z "$inc_scaffold" ] && . "$basedir/build/scaffold.sh"
|
||||
|
||||
process_file(){
|
||||
infile="$1"
|
||||
processor="$2"
|
||||
olang="$3"
|
||||
|
||||
[ -z "$domain" ] && domain="www.fsfe.org"
|
||||
|
||||
shortname=$(get_shortname "$infile")
|
||||
lang=$(get_language "$infile")
|
||||
[ -z "$processor" ] && processor="$(get_processor "$shortname")"
|
||||
|
@ -23,7 +23,6 @@ build_xmlstream(){
|
||||
time="$(date +%H:%M:%S)"
|
||||
outdated=no
|
||||
|
||||
[ -z "$olang" ] && olang="en"
|
||||
if [ -f "${shortname}.${lang}.xhtml" ]; then
|
||||
act_lang="$lang"
|
||||
[ "${shortname}.${olang}.xhtml" -nt "${shortname}.${lang}.xhtml" ] && outdated=yes
|
||||
|
@ -1,56 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
basedir="$(dirname $0)/.."
|
||||
|
||||
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
|
||||
[ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
|
||||
|
||||
while [ -n "$*" ]; do
|
||||
case "$1" in
|
||||
-s|--statusdir|--status-dir)
|
||||
[ -n "$*" ] && shift 1 && statusdir="$1"
|
||||
;;
|
||||
--domain)
|
||||
[ -n "$*" ] && shift 1 && domain="$1"
|
||||
;;
|
||||
--source)
|
||||
[ -n "$*" ] && shift 1 && basedir="$1"
|
||||
;;
|
||||
-d|--dest|--destination)
|
||||
[ -n "$*" ] && shift 1 && target="$1"
|
||||
;;
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
sourceglobs)
|
||||
command="$1$command"
|
||||
[ -n "$*" ] && shift 1 && sourcesfile="$1"
|
||||
;;
|
||||
cast_globfile)
|
||||
command="$1$command"
|
||||
[ -n "$*" ] && shift 1 && sourceglobfile="$1"
|
||||
[ -n "$*" ] && shift 1 && lang="$1"
|
||||
[ -n "$*" ] && shift 1 && globfile="$1"
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
[ -n "$*" ] && shift 1
|
||||
done
|
||||
. "$basedir/build/arguments.sh"
|
||||
|
||||
case "$command" in
|
||||
sourceglobs)
|
||||
[ -z "$sourcesfile" ] && print_error "Missing .sources file" && exit 1
|
||||
sourceglobs "$sourcesfile"
|
||||
;;
|
||||
cast_globfile)
|
||||
[ -z "$sourceglobfile" -o -z "$lang" -o -z "$globfile" ] && print_error "Need source globfile language and globfile" && exit 1
|
||||
cast_globfile "$sourceglobfile" "$lang" "$globfile"
|
||||
;;
|
||||
*)
|
||||
print_error "Urecognised command or no command given"
|
||||
;;
|
||||
sourceglobs) sourceglobs "$sourcesfile" ;;
|
||||
cast_globfile) cast_globfile "$sourceglobfile" "$lang" "$globfile" ;;
|
||||
*) die "Urecognised command or no command given" ;;
|
||||
esac
|
||||
|
@ -32,7 +32,7 @@ build_manifest(){
|
||||
remove_orphans(){
|
||||
# read list of files which should be in a directory tree
|
||||
# and remove everything else
|
||||
tree="${1%/}"
|
||||
dtree="${1%/}"
|
||||
|
||||
# Idea behind the algorithm:
|
||||
# `find` will list every existing file once.
|
||||
@ -42,10 +42,10 @@ remove_orphans(){
|
||||
# We use 'uniq -u' to drop those from the list.
|
||||
# Remaining single files exist only in the tree and are to be removed
|
||||
|
||||
(find "$tree" -type f -o -type l; sed "s;^.*$;$tree/&;") \
|
||||
(find "$dtree" -type f -o -type l; sed "s;^.*$;$dtree/&;") \
|
||||
| sort \
|
||||
| uniq -u \
|
||||
| while read file; do
|
||||
match "$file" "^$tree" && rm -v "$file"
|
||||
match "$file" "^$dtree" && rm -v "$file"
|
||||
done
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user