forked from ungleich-public/cdist
		
	allow changelog-changes to print changes from any version
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								5bdc2e1ba9
							
						
					
				
			
			
				commit
				
					
						9b9f34eb00
					
				
			
		
					 1 changed files with 46 additions and 63 deletions
				
			
		
							
								
								
									
										109
									
								
								bin/build-helper
									
										
									
									
									
								
							
							
						
						
									
										109
									
								
								bin/build-helper
									
										
									
									
									
								
							| 
						 | 
					@ -27,46 +27,41 @@ cd "$basedir"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
version=$(git describe)
 | 
					version=$(git describe)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Manpage and HTML
 | 
					option=$1; shift
 | 
				
			||||||
A2XM="a2x -f manpage --no-xmllint -a encoding=UTF-8"
 | 
					 | 
				
			||||||
A2XH="a2x -f xhtml --no-xmllint -a encoding=UTF-8"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Developer webbase
 | 
					case "$option" in
 | 
				
			||||||
WEBDIR=$HOME/www.nico.schottelius.org
 | 
					 | 
				
			||||||
WEBBLOG=$WEBDIR/blog
 | 
					 | 
				
			||||||
WEBTOPDIR=$WEBDIR/software
 | 
					 | 
				
			||||||
WEBBASE=$WEBTOPDIR/cdist
 | 
					 | 
				
			||||||
WEBMAN=$WEBBASE/man/$version
 | 
					 | 
				
			||||||
WEBPAGE=${WEBBASE}.mdwn
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Documentation
 | 
					 | 
				
			||||||
MANDIR=docs/man
 | 
					 | 
				
			||||||
MAN1DSTDIR=${MANDIR}/man1
 | 
					 | 
				
			||||||
MAN7DSTDIR=${MANDIR}/man7
 | 
					 | 
				
			||||||
SPEECHESDIR=docs/speeches
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
case "$1" in
 | 
					 | 
				
			||||||
    changelog-changes)
 | 
					    changelog-changes)
 | 
				
			||||||
        awk -F: 'BEGIN { start=0 } { if ($0 ~ /^[[:digit:]]/) { if(start == 0) {start = 1 } else { exit } } else { if(start==1) {print $0 }}  }' "$basedir/docs/changelog"
 | 
					        if [ "$#" -eq 1 ]; then
 | 
				
			||||||
 | 
					            start=$1
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            start="[[:digit:]]"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        end="[[:digit:]]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        awk -F: "BEGIN { start=0 }
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if(start == 0) {
 | 
				
			||||||
 | 
					                    if (\$0 ~ /^$start/) {
 | 
				
			||||||
 | 
					                        start = 1
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    if (\$0 ~ /^$end/) {
 | 
				
			||||||
 | 
					                        exit
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        print \$0 
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }" "$basedir/docs/changelog"
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    changelog-version)
 | 
					    changelog-version)
 | 
				
			||||||
        # get version from changelog and ensure it's not already present
 | 
					        # get version from changelog
 | 
				
			||||||
        grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//'
 | 
					        grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//'
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    check-version)
 | 
					 | 
				
			||||||
        changelog_version=$($0 changelog-version)
 | 
					 | 
				
			||||||
        echo "Target version from changelog: $changelog_version"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if git show --quiet $changelog_version >/dev/null 2>&1; then
 | 
					 | 
				
			||||||
            echo "Version $changelog_version already exists, aborting."
 | 
					 | 
				
			||||||
            exit 1
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    check-date)
 | 
					    check-date)
 | 
				
			||||||
        # verify date in changelog
 | 
					        # verify date in changelog is today
 | 
				
			||||||
        date_today="$(date +%Y-%m-%d)"
 | 
					        date_today="$(date +%Y-%m-%d)"
 | 
				
			||||||
        date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //')
 | 
					        date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,9 +72,24 @@ case "$1" in
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    check-unittest)
 | 
				
			||||||
 | 
					        "$0" test
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    check-version)
 | 
				
			||||||
 | 
					        changelog_version=$($0 changelog-version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if git show --quiet $changelog_version >/dev/null 2>&1; then
 | 
				
			||||||
 | 
					            echo "Version $changelog_version already exists, aborting."
 | 
				
			||||||
 | 
					            exit 1
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    blog)
 | 
					    blog)
 | 
				
			||||||
        version=$($0 changelog-version)
 | 
					        version=$1; shift
 | 
				
			||||||
        blogfile=$WEBBLOG/cdist-${version}-released.mdwn
 | 
					        blogfile=$1; shift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cat << eof > "$blogfile"
 | 
					        cat << eof > "$blogfile"
 | 
				
			||||||
[[!meta title="Cdist $version released"]]
 | 
					[[!meta title="Cdist $version released"]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,17 +104,13 @@ For more information visit the [[cdist homepage|software/cdist]].
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[!tag cdist config unix]]
 | 
					[[!tag cdist config unix]]
 | 
				
			||||||
eof
 | 
					eof
 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    release-blog)
 | 
					 | 
				
			||||||
        version=$($0 changelog-version)
 | 
					 | 
				
			||||||
        file=cdist-${version}-released.mdwn
 | 
					 | 
				
			||||||
        cd "$WEBBLOG"
 | 
					        cd "$WEBBLOG"
 | 
				
			||||||
        git add "$file"
 | 
					        git add "$file"
 | 
				
			||||||
        git commit -m "New cdist version (blogentry): $version" "$file"
 | 
					        git commit -m "New cdist version (blogentry): $version" "$blogfile"
 | 
				
			||||||
        git push
 | 
					        git push
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    release-ml)
 | 
					    release-ml)
 | 
				
			||||||
        version=$($0 changelog-version)
 | 
					        version=$($0 changelog-version)
 | 
				
			||||||
        to_a=cdist
 | 
					        to_a=cdist
 | 
				
			||||||
| 
						 | 
					@ -198,31 +204,7 @@ eof
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    web-doc)
 | 
					 | 
				
			||||||
        rsync -av "${basedir}/docs/web/" "${WEBTOPDIR}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        cd "${WEBDIR}" && git add "${WEBBASE}"
 | 
					 | 
				
			||||||
        cd "${WEBDIR}" && git commit -m "cdist update" "${WEBBASE}" "${WEBPAGE}"
 | 
					 | 
				
			||||||
        cd "${WEBDIR}" && make pub
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    release-web)
 | 
					 | 
				
			||||||
        set -e
 | 
					 | 
				
			||||||
        # Fix ikiwiki, which does not like symlinks for pseudo security
 | 
					 | 
				
			||||||
        ssh tee.schottelius.org \
 | 
					 | 
				
			||||||
          "cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man &&
 | 
					 | 
				
			||||||
                rm -f latest && ln -sf "$version" latest"
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
     pub)
 | 
					 | 
				
			||||||
          for remote in "" github sf; do
 | 
					 | 
				
			||||||
                echo "Pushing to $remote"
 | 
					 | 
				
			||||||
                git push --mirror $remote
 | 
					 | 
				
			||||||
          done
 | 
					 | 
				
			||||||
    ;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    test)
 | 
					    test)
 | 
				
			||||||
        shift # skip t
 | 
					 | 
				
			||||||
        export PYTHONPATH="$(pwd -P)"
 | 
					        export PYTHONPATH="$(pwd -P)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if [ $# -lt 1 ]; then
 | 
					        if [ $# -lt 1 ]; then
 | 
				
			||||||
| 
						 | 
					@ -231,6 +213,7 @@ eof
 | 
				
			||||||
            python3 -m unittest "$@"
 | 
					            python3 -m unittest "$@"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    version)
 | 
					    version)
 | 
				
			||||||
        echo "VERSION = \"$(git describe)\"" > cdist/version.py
 | 
					        echo "VERSION = \"$(git describe)\"" > cdist/version.py
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue