[Reproducible-commits] [blog] 01/04: publish.sh: include guess_tags.sh functionality
Holger Levsen
holger at layer-acht.org
Wed May 18 12:56:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository blog.
commit a4dd6a448eb5a81e0c331fdbf2c4f173d5f1f71e
Author: Holger Levsen <holger at layer-acht.org>
Date: Wed May 18 14:37:12 2016 +0200
publish.sh: include guess_tags.sh functionality
---
TODO | 3 +--
bin/guess_tags.sh | 64 -----------------------------------------------------
bin/publish.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++----
3 files changed, 63 insertions(+), 70 deletions(-)
diff --git a/TODO b/TODO
index 7d74ab6..a8bee98 100644
--- a/TODO
+++ b/TODO
@@ -3,14 +3,13 @@
afterwards h01ger needs to run ikiwiki-calendar as documented below…
to be documented:
- bin/guess_tags.sh
bin/publish.sh
TODO for bin/publish.sh:
- include guess_tags.sh?
run "ikiwiki-calendar -f /home/groups/reproducible/blog/blog.setup 'posts/*'" as holger on alioth to update the archive
should detect if committers are not listed in "This weeks edition was written by"…
(by looking at git log drafts/$week.mdwn)
+ should guess the week to act on if none give (current week -1)
ikiwiki polishing:
use nicer css than current one
diff --git a/bin/guess_tags.sh b/bin/guess_tags.sh
deleted file mode 100755
index dd0d3ab..0000000
--- a/bin/guess_tags.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-
-DRYRUN=false
-if [ "$1" = "-d" ] || [ "$1" = "--dry-run" ] ; then
- DRYRUN=true
- shift
-fi
-
-if [ "$1" = "" ] ; then
- echo "need a post number to act on, eg 53"
- exit 1
-fi
-WEEK=$1
-DRAFT=./drafts/$WEEK.mdwn
-
-if [ ! -f $DRAFT ] ; then
- echo "$DRAFT does not exist, exiting."
- exit 1
-elif [ -f ./drafts/$WEEK.tags ] ; then
- echo "./drafts/$WEEK.tags exists, not doing anything, please edit manually."
- exit 1
-fi
-
-# these are grep'ed for case sensitive
-KNOWN_TAGS="ArchLinux build_kernel_architecture build_locale clang coreboot diffoscope documentation dpkg Fedora FreeBSD GCC gcc GSoC installation live_media MacPorts maven NetBSD OpenWrt ordering Outreachy project_infrastructure source_date_epoch SOURCE_DATE_EPOCH disorderfs strip-determinism DebConf16 libxslt cdbs Ubuntu"
-# these "special" words needs to be seperated by spaces (and are also case sensitive…)
-KNOWN_SPECIAL_TAGS="Tar tar sphinx TAILS texlive-bin pdftex luatex tex dak"
-# all posts are tagged:
-MY_TAGS="reproducible_builds Debian"
-
-for TAG in $KNOWN_TAGS ; do
- if [ -n "$(grep $TAG $DRAFT 2>/dev/null)" ] ; then
- MY_TAGS="$MY_TAGS $TAG"
- fi
-done
-for TAG in $KNOWN_SPECIAL_TAGS ; do
- if [ -n "$(grep " $TAG " $DRAFT 2>/dev/null)" ] ; then
- MY_TAGS="$MY_TAGS $TAG"
- fi
-done
-
-# force capitalisation as we want it
-MY_FINAL_TAGS=""
-for TAG in $MY_TAGS ; do
- if [ "$TAG" = "Tar" ] ; then
- MY_FINAL_TAGS="$MY_FINAL_TAGS tar"
- elif [ "$TAG" = "gcc" ] ; then
- MY_FINAL_TAGS="$MY_FINAL_TAGS GCC"
- else
- MY_FINAL_TAGS="$MY_FINAL_TAGS $TAG"
- fi
-done
-# echo is used to remove the prefixing whitespace
-MY_TAGS=$(echo $MY_FINAL_TAGS)
-
-if [ ! -f ./drafts/$WEEK.tags ] ; then
- if ! $DRYRUN ; then
- echo "Creating $WEEK.tags, please review detected tags:"
- echo " $MY_TAGS"
- echo $MY_TAGS > ./drafts/$WEEK.tags
- else
- echo "Tags guessed: $MY_TAGS"
- fi
-fi
diff --git a/bin/publish.sh b/bin/publish.sh
index 3be1d98..4c1338f 100755
--- a/bin/publish.sh
+++ b/bin/publish.sh
@@ -1,5 +1,14 @@
#!/bin/bash
+# Copyright 2016 Holger Levsen <holger at layer-acht.org>
+# released under the GPLv=2
+
+DRYRUN=false
+if [ "$1" = "-d" ] || [ "$1" = "--dry-run" ] ; then
+ DRYRUN=true
+ shift
+fi
+
if [ "$1" = "" ] ; then
echo "need a post number to act on, eg 53"
exit 1
@@ -8,18 +17,67 @@ WEEK=$1
DRAFT=./drafts/$WEEK.mdwn
POST=./posts/$WEEK.mdwn
+
+if [ ! -f $DRAFT ] ; then
+ echo "$DRAFT does not exist, exiting."
+ exit 1
+fi
+
+if [ ! -f ./drafts/$WEEK.tags ] ; then
+ # these are grep'ed for case sensitive
+ KNOWN_TAGS="ArchLinux build_kernel_architecture build_locale clang coreboot diffoscope documentation dpkg Fedora FreeBSD GCC gcc GSoC installation live_media MacPorts maven NetBSD OpenWrt ordering Outreachy project_infrastructure source_date_epoch SOURCE_DATE_EPOCH disorderfs strip-determinism DebConf16 libxslt cdbs Ubuntu"
+ # these "special" words needs to be seperated by spaces (and are also case sensitive…)
+ KNOWN_SPECIAL_TAGS="Tar tar sphinx TAILS texlive-bin pdftex luatex tex dak"
+ # all posts are tagged:
+ MY_TAGS="reproducible_builds Debian"
+
+ for TAG in $KNOWN_TAGS ; do
+ if [ -n "$(grep $TAG $DRAFT 2>/dev/null)" ] ; then
+ MY_TAGS="$MY_TAGS $TAG"
+ fi
+ done
+ for TAG in $KNOWN_SPECIAL_TAGS ; do
+ if [ -n "$(grep " $TAG " $DRAFT 2>/dev/null)" ] ; then
+ MY_TAGS="$MY_TAGS $TAG"
+ fi
+ done
+
+ # force capitalisation as we want it
+ MY_FINAL_TAGS=""
+ for TAG in $MY_TAGS ; do
+ if [ "$TAG" = "Tar" ] ; then
+ MY_FINAL_TAGS="$MY_FINAL_TAGS tar"
+ elif [ "$TAG" = "gcc" ] ; then
+ MY_FINAL_TAGS="$MY_FINAL_TAGS GCC"
+ else
+ MY_FINAL_TAGS="$MY_FINAL_TAGS $TAG"
+ fi
+ done
+ # echo is used to remove the prefixing whitespace
+ MY_TAGS=$(echo $MY_FINAL_TAGS)
+
+ if ! $DRYRUN ; then
+ echo "Creating $WEEK.tags, please review detected tags:"
+ echo " $MY_TAGS"
+ echo $MY_TAGS > ./drafts/$WEEK.tags
+ else
+ echo "Tags guessed: $MY_TAGS"
+ fi
+fi
+
if [ -f $POST ] ; then
echo "$POST already exists, doing nothing."
exit 0
elif [ ! -f $DRAFT ] ; then
echo "$DRAFT does not exist, exiting."
exit 1
-elif [ ! -f ./drafts/$WEEK.tags ] ; then
- echo "./drafts/$WEEK.tags does not exist, please run ./bin/guess_tags.sh $WEEK."
- exit 1
elif [ -z "$(grep 'meta title=' $DRAFT 2>/dev/null)" ] ; then
echo "$DRAFT has no title, exiting."
exit 1
+elif $DRYRUN ; then
+ echo
+ echo "Please review the guessed tags."
+ exit 0
fi
META_TAGS='[[!tag '$(cat ./drafts/$WEEK.tags)']]'
@@ -33,7 +91,7 @@ grep -v "meta title=" $DRAFT >> $TMPFILE
cp $TMPFILE $DRAFT
rm $TMPFILE
-git rm ./drafts/$WEEK.tags 2>/dev/null|| rm ./drafts/$WEEK.tags
+git rm ./drafts/$WEEK.tags 2>/dev/null || rm ./drafts/$WEEK.tags
git mv $DRAFT $POST
git add $POST
git commit -m "published as https://reproducible.alioth.debian.org/blog/posts/$WEEK/"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/blog.git
More information about the Reproducible-commits
mailing list