Skip to content

Commit

Permalink
Merge pull request #24 from kushaldas/adding_just
Browse files Browse the repository at this point in the history
Adding just
  • Loading branch information
kushaldas authored Jan 3, 2021
2 parents 870b311 + 7e1b09f commit c3db27d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Creates the source tarball
sdist:
./scripts/create-sourcetarball
6 changes: 2 additions & 4 deletions packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
tumpa (0.1.0+buster+nmu1) UNRELEASED; urgency=medium
tumpa (0.1.0+buster+nmu1) UNSTABLE; urgency=medium

* Non-maintainer upload.
* check changelog.md
*

-- Kushal Das <[email protected]> Fri, 01 Jan 2021 19:13:51 +0530
-- Kushal Das <[email protected]> Sun, 03 Jan 2021 09:20:51 +0530
32 changes: 32 additions & 0 deletions scripts/create-sourcetarball
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/bash

set -e
set -u
set -o pipefail

# Amazing magic from Conor Schaefer
function build_source_tarball() {
PKG_NAME="tumpa"
build_dir="/tmp/${PKG_NAME}"
rm -rf "$build_dir"


# Copy the source from current directory into build dir
cp -r . $build_dir/
(cd "$build_dir" && LC_ALL="C.UTF-8" python setup.py sdist)

# Initial tarball will contain timestamps from NOW, let's repack
# with timestamps from the changelog, which is static.
raw_tarball="$(find "${build_dir}/dist/" | grep -P '\.tar.gz$' | head -n1)"
dch_time="$(date "+%Y-%m-%d %H:%M:%S %z" -d@$(dpkg-parsechangelog --file packaging/debian/changelog -STimestamp)) "
(cd "$build_dir" && tar -xzf "dist/$(basename $raw_tarball)")
tarball_basename="$(basename "$raw_tarball")"
# Repack with tar only, so env vars are respected
(cd "$build_dir" && tar -cf "${tarball_basename%.gz}" --mode=go=rX,u+rw,a-s --mtime="$dch_time" --sort=name --owner=root:0 --group=root:0 "${tarball_basename%.tar.gz}" 1>&2)
# Then gzip it separately, so we can pass args
(cd "$build_dir" && gzip --no-name "${tarball_basename%.gz}")
(cd "$build_dir" && mv "$tarball_basename" dist/)
echo "$raw_tarball"
}

build_source_tarball

0 comments on commit c3db27d

Please sign in to comment.