Skip to content
Snippets Groups Projects
create_source_package.sh 722 B
Newer Older
  • Learn to ignore specific revisions
  • hluk's avatar
    hluk committed
    #!/bin/bash
    version=$1
    out=${2:-"copyq-${version}.tar.gz"}
    
    version_header="src/common/version.h"
    
    hluk's avatar
    hluk committed
    
    set -e
    
    die () {
        echo "ERROR: $*"
        exit 1
    }
    
    
    grep -q '^# v'"$version"'$' "CHANGES.md" ||
    
        die "CHANGES file doesn't contain changes for given version!"
    
    
    grep -q '"v'"$version"'"' "$version_header" ||
        die "String for given version is missing in \"$version_header\" file!"
    
    
    hluk's avatar
    hluk committed
    git archive --format=tar.gz --prefix="copyq-$version/" --output="$out" "v$version" ||
        die "First arguments must be existing version (tag v<VERSION> must exist in repository)!"
    
    hluk's avatar
    hluk committed
    echo "Created source package for version $version: $out"
    
    
    hluk's avatar
    hluk committed
    size=$(stat --format="%s" "$out")
    hash=$(md5sum "$out" | cut -d' ' -f 1)
    echo " $hash $size $out"