r817 - trunk/scripts

lizardo at linuxfromscratch.org lizardo at linuxfromscratch.org
Sat Aug 7 19:48:46 PDT 2004


Author: lizardo
Date: 2004-08-07 20:48:44 -0600 (Sat, 07 Aug 2004)
New Revision: 817

Added:
   trunk/scripts/rsync-ignore
   trunk/scripts/update-website.mk
Modified:
   trunk/scripts/genlist.sh
Log:
Added new makefile script and modified genlist.sh so it ignores non-standard-conforming hints.


Modified: trunk/scripts/genlist.sh
===================================================================
--- trunk/scripts/genlist.sh	2004-08-06 23:36:50 UTC (rev 816)
+++ trunk/scripts/genlist.sh	2004-08-08 02:48:44 UTC (rev 817)
@@ -5,12 +5,14 @@
 # by Olivier Pérès (Olivier Peres if your terminal cannot print accents)
 # Modified by Jeroen Coumans to conform to the LFS template
 # email: olivier dot peres at laposte dot net
-# Last updated September 15th, 2003
-# This version now expects the hint files to be valid
-#   (fields DATE, AUTHOR, LICENSE and SYNOPSIS must not be empty)
-#   since this is checked when hints are submitted.
 # License: GPL.
 
+# Changes by Anderson Lizardo:
+#	[2004-08-03]
+#	- Removed some redundant paths (../hints == current dir)
+#	- Assume .txt extension for hints, ignoring files like README and LICENSE
+#	- Skip hints not conforming to the default format
+
 # Usage: run in the hints/ subdirectory.
 
 #   Limitations
@@ -22,7 +24,7 @@
 
 # the file to which to write
 
-OUTPUTFILE="../hints/list.html"
+OUTPUTFILE="list.html"
 
 function output
 {
@@ -44,7 +46,7 @@
 # HINTS = list of all the files in reverse chronological order.
 #         (sorted according to their DATE fields, not to the file ages)
 
-HINTS=`grep -H "DATE:" ../hints/downloads/files/* | sort -fbi -r -k3 -t: | cut -f1 -d:`
+HINTS=`grep -H "DATE:" downloads/files/*.txt | sort -fbi -r -k3 -t: | cut -f1 -d:`
 
 # initialise output file
 
@@ -60,6 +62,8 @@
         cut -f2 -d: | sed 's/$/,/'\` | sed 's/,$//'`
 #    LICENSE=`echo \`grep -h "LICENSE:" $HINT | cut -f2 -d:\``
 
+	if [ -z "$DATE" -o -z "$SYNOPSIS" -o -z "$AUTHORS" ]; then continue; fi
+
     output "<li><h4><a href=\"$HINT\" title=\"$HINT\">$SYNOPSIS</a></h4>"
     output "<dl>"
     output "<dt>Author(s):</dt>"

Added: trunk/scripts/rsync-ignore
===================================================================
--- trunk/scripts/rsync-ignore	2004-08-06 23:36:50 UTC (rev 816)
+++ trunk/scripts/rsync-ignore	2004-08-08 02:48:44 UTC (rev 817)
@@ -0,0 +1,5 @@
+.svn
+logs
+scripts
+templates
+news-*.txt

Added: trunk/scripts/update-website.mk
===================================================================
--- trunk/scripts/update-website.mk	2004-08-06 23:36:50 UTC (rev 816)
+++ trunk/scripts/update-website.mk	2004-08-08 02:48:44 UTC (rev 817)
@@ -0,0 +1,191 @@
+#!/usr/bin/make -sf
+
+# Usage: first run "update-website.mk svn-checkout" to create an initial
+# repository on TARGET, if it does not exist yet. To update the website, run
+# update-website.mk without arguments.
+
+SVN = svn://svn.linuxfromscratch.org
+REV = HEAD
+TARGETDIR = /home/httpd/test.linuxfromscratch.org/rsync-test
+#TARGETDIR = /home/httpd/www.linuxfromscratch.org
+
+# Mirrors to which the website will be pushed through rsync
+MIRRORS = jenacon.net
+
+SCRIPTS = $(TARGETDIR)/scripts
+# "LC_ALL=C" garantees a sane localization setting
+MANAGE_NEWS = LC_ALL=C $(SCRIPTS)/manage_news.pl
+SVN2HTML = $(SCRIPTS)/svn2html.pl
+SVN2HTML2 = $(SCRIPTS)/svn2html2.pl
+SVNLOG = svn log --verbose --xml
+TEMPLATES = templates
+
+# TODO This can be automated
+# Projects which have news to be archived
+PROJECTS = . lfs alfs blfs hints
+# Years corresponding to the news-YYYY.txt files
+YEARS = 2003 2004
+# Current year
+YEAR = $(shell date +%Y)
+
+ifneq ($(PWD),$(TARGETDIR))
+all:
+	$(error You should run this script from $(TARGETDIR))
+endif
+
+update-website: backup svn-update news-archive website.html news-html news-rss \
+	mirrors-list update-patches update-hints error-pages set-perms #run-rsync
+
+news-archive: $(foreach y,$(YEARS),$(foreach i,$(PROJECTS),news/$(i)/$(y)))
+
+news-html: alfs/news.html blfs/news.html hints/news.html lfs/news.html patches/news.html
+
+news-rss: alfs/feed.rss blfs/feed.rss lfs/feed.rss
+
+backup: $(TARGETDIR)
+#	tar -cPf /var/tmp/website-backup.tar $(TARGETDIR)
+
+# Useful for the initial repository setup
+svn-checkout:
+	mkdir -m 2755 -p $(TARGETDIR)
+	svn -q checkout $(SVN)/www/trunk $(TARGETDIR)
+	mkdir -p $(TARGETDIR)/patches/downloads
+	svn -q checkout $(SVN)/patches/trunk $(TARGETDIR)/patches/downloads
+	mkdir -p $(TARGETDIR)/hints/downloads/files
+	svn -q checkout $(SVN)/hints/trunk $(TARGETDIR)/hints/downloads/files
+	ln -sf files/ATTACHMENTS $(TARGETDIR)/hints/downloads/attachments
+# Add some compatibility symlinks
+	ln -sf lfs/view $(TARGETDIR)
+	ln -sf images/favicon.ico $(TARGETDIR)
+	ln -sf 2columns.css style/screen.css $(TARGETDIR)
+
+svn-update:
+	svn -q update $(TARGETDIR) -r $(REV)
+
+# Generate news archives
+define gen_news_targets
+news/$(1)/$(2): $(1)/news-$(2).txt $(TEMPLATES)/$(1)/archive-*.html
+	rm -rf $$@
+	$(MANAGE_NEWS) -a news/ -i $(1)/news-$(2).txt \
+	-t $(TEMPLATES)/$(1)/archive-top.html -b $(TEMPLATES)/$(1)/archive-bottom.html
+endef
+$(foreach y,$(YEARS),$(foreach i,$(PROJECTS),$(eval $(call gen_news_targets,$(i),$(y)))))
+
+# Assemble news pages
+
+svnlog-%:
+	mkdir -p logs
+	$(SVNLOG) $(SVN)/$* 2>/dev/null | $(SVN2HTML) --with-branchname > logs/$*.html.tmp
+
+logs/%.html: svnlog-%
+	cmp -s $@.tmp $@ || cp $@.tmp $@
+	rm $@.tmp
+
+website.html: $(TEMPLATES)/website-*.html logs/www.html
+	cat $(TEMPLATES)/website-top.html \
+	logs/www.html \
+	$(TEMPLATES)/website-bottom.html > website.html
+
+patches/news.html: $(TEMPLATES)/patches/news-*.html logs/patches.html
+	cat $(TEMPLATES)/patches/news-top.html \
+	logs/patches.html \
+	$(TEMPLATES)/patches/news-bottom.html > patches/news.html
+
+lfs/news.html: $(TEMPLATES)/lfs/news-*.html news-$(YEAR).txt lfs/news-$(YEAR).txt logs/LFS.html
+	cp $(TEMPLATES)/lfs/news-top.html lfs/news.html; \
+	$(MANAGE_NEWS) -i lfs/news-$(YEAR).txt >> lfs/news.html; \
+	$(MANAGE_NEWS) -i news-$(YEAR).txt >> lfs/news.html; \
+	cat logs/LFS.html \
+	$(TEMPLATES)/lfs/news-bottom.html >> lfs/news.html
+
+blfs/news.html: $(TEMPLATES)/blfs/news-*.html news-$(YEAR).txt blfs/news-$(YEAR).txt logs/BLFS.html
+	cp $(TEMPLATES)/blfs/news-top.html blfs/news.html; \
+	$(MANAGE_NEWS) -i blfs/news-$(YEAR).txt >> blfs/news.html; \
+	$(MANAGE_NEWS) -i news-$(YEAR).txt >> blfs/news.html; \
+	cat logs/BLFS.html \
+	$(TEMPLATES)/blfs/news-bottom.html >> blfs/news.html
+
+hints/news.html: $(TEMPLATES)/hints/news-*.html logs/hints.html
+	cat $(TEMPLATES)/hints/news-top.html \
+	logs/hints.html \
+	$(TEMPLATES)/hints/news-bottom.html > hints/news.html
+
+alfs/news.html: $(TEMPLATES)/alfs/news-*.html news-$(YEAR).txt alfs/news-$(YEAR).txt
+	cp $(TEMPLATES)/alfs/news-top.html alfs/news.html; \
+	$(MANAGE_NEWS) -i alfs/news-$(YEAR).txt >> alfs/news.html; \
+	$(MANAGE_NEWS) -i news-$(YEAR).txt >> alfs/news.html; \
+	$(SVN2HTML2) --project ALFS --with-branchname >> alfs/news.html; \
+	cat $(TEMPLATES)/alfs/news-bottom.html >> alfs/news.html
+
+# Generate RSS feeds
+%/feed.rss: %/news.html
+	$(SCRIPTS)/lfs2rss.pl -n $< -r $@
+
+# Create mirrors list for each section
+PROJS = alfs hlfs blfs hints lfs patches
+INDEXES = $(foreach i,$(PROJS),$(i)/index.html)
+
+mirrors-list: index.html $(INDEXES)
+
+index.html $(INDEXES): mirrorlist.html
+	cat $(TEMPLATES)/index-top.html \
+	mirrorlist.html \
+	$(TEMPLATES)/index-bottom.html > index.html
+	for i in $(PROJS); do \
+    cat $(TEMPLATES)/$$i/index-top.html > $$i/index.html; \
+    sed "s@/lfs/news.html@/$$i/news.html at g" mirrorlist.html >> $$i/index.html; \
+    cat $(TEMPLATES)/$$i/index-bottom.html >> $$i/index.html; done
+
+# Add all other content
+
+# Fetch latest versions from patches
+# TODO This should be moved to the patches repo post-commit hook
+update-patches:
+	svn -q update patches/downloads
+
+# Fetch current hints and create the hints tarball
+# TODO This should be moved to the hints repo post-commit hook
+update-hints: fetch-hints hints-tarball hints-symlinks hints/list.html
+
+fetch-hints:
+	find hints/downloads -type l -exec rm '{}' \;
+	svn -q update hints/downloads/files
+
+hints-tarball:
+	ln -s files hints/downloads/hints
+	cd hints/downloads && tar --exclude=.svn -chjf hints.tar.bz2 hints/
+	rm hints/downloads/hints
+
+hints-symlinks:
+	cd hints/downloads/files && \
+	if [ -d HOLD ]; then for i in $$(ls HOLD/*.txt); do ln -s $$i; done; fi
+	cd hints/downloads/files && \
+	for i in $$(ls PREVIOUS_FORMAT/*.txt); do ln -s $$i; done
+
+hints/list.html: hints/downloads/files/*.txt
+	cd hints && $(SCRIPTS)/genlist.sh
+
+# Validate XHTML files
+# FIXME better on a pre-commit script?
+validate:
+	for file in $$(find -name \*.html -maxdepth 3 -print); do \
+	if xmllint --valid --noout $$file then exit 1; fi; done
+
+# Add the timestamp for mirrors
+timestamp/timestamp:
+	mkdir -p timestamp
+	date +%s > timestamp/timestamp
+
+# Copy these to the httpd error dirs
+error-pages: 403.html 404.html
+#	cp {403,404}.html /home/httpd/error
+
+# Set proper permissions
+set-perms:
+	chmod -Rf g+w .
+	chgrp -Rf lfswww .
+
+run-rsync:
+	for m in $(MIRRORS); do \
+	rsync -aq --exclude-from=scripts/rsync-ignore $(TARGETDIR) $$m::lfs; \
+	done


Property changes on: trunk/scripts/update-website.mk
___________________________________________________________________
Name: svn:executable
   + *




More information about the website mailing list