1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

Merge pull request #239 from olof/topic/reproducibility

Two reproducible build issues
This commit is contained in:
Johan Andersson 2015-06-14 20:25:39 +02:00
commit 86d17b5d20
2 changed files with 39 additions and 17 deletions

View File

@ -3,10 +3,15 @@ all: svtplay-dl
.PHONY: test cover doctest pylint svtplay-dl \ .PHONY: test cover doctest pylint svtplay-dl \
release clean_releasedir $(RELEASE_DIR) release clean_releasedir $(RELEASE_DIR)
# These variables describe the latest release:
VERSION = 0.10 VERSION = 0.10
RELEASE = $(VERSION).$(shell date +%Y.%m.%d) LATEST_RELEASE_DATE = 2015.05.24
RELEASE_DIR = svtplay-dl-$(RELEASE) LATEST_RELEASE = $(VERSION).$(LATEST_RELEASE_DATE)
LATEST_RELEASE = 0.10.2015.05.24
# If we build a new release, this is what it will be called:
NEW_RELEASE_DATE = $(shell date +%Y.%m.%d)
NEW_RELEASE = $(VERSION).$(NEW_RELEASE_DATE)
RELEASE_DIR = svtplay-dl-$(NEW_RELEASE)
PREFIX ?= /usr/local PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin BINDIR = $(PREFIX)/bin
@ -20,8 +25,10 @@ MANFILE = svtplay-dl.1$(MANFILE_EXT)
# As pod2man is a perl tool, we have to jump through some hoops # As pod2man is a perl tool, we have to jump through some hoops
# to remove references to perl.. :-) # to remove references to perl.. :-)
POD2MAN ?= pod2man --section 1 --utf8 -c "svtplay-dl manual" \ POD2MAN ?= pod2man --section 1 --utf8 \
-r "svtplay-dl $(VERSION)" --center "svtplay-dl manual" \
--release "svtplay-dl $(VERSION)" \
--date "$(LATEST_RELEASE_DATE)"
PYTHON ?= /usr/bin/env python PYTHON ?= /usr/bin/env python
export PYTHONPATH=lib export PYTHONPATH=lib
@ -61,24 +68,25 @@ doctest: svtplay-dl
sh scripts/diff_man_help.sh sh scripts/diff_man_help.sh
$(RELEASE_DIR): clean_releasedir $(RELEASE_DIR): clean_releasedir
mkdir svtplay-dl-$(RELEASE) mkdir $(RELEASE_DIR)
cd svtplay-dl-$(RELEASE) && git clone -b master ../ . && make svtplay-dl cd $(RELEASE_DIR) && git clone -b master ../ . && \
make svtplay-dl $(MANFILE)
clean_releasedir: clean_releasedir:
rm -rf $(RELEASE_DIR) rm -rf $(RELEASE_DIR)
release: $(RELEASE_DIR) release-test release: $(RELEASE_DIR) release-test
set -e; cd $(RELEASE_DIR) && \ set -e; cd $(RELEASE_DIR) && \
sed -i -r -e 's/^(LATEST_RELEASE = ).*/\1$(RELEASE)/' Makefile;\ sed -i -re 's/^(LATEST_RELEASE_DATE = ).*/\1$(NEW_RELEASE_DATE)/' Makefile;\
sed -i -r -e 's/^(__version__ = ).*/\1"$(RELEASE)"/' lib/svtplay_dl/__init__.py;\ sed -i -re 's/^(__version__ = ).*/\1"$(NEW_RELEASE)"/' lib/svtplay_dl/__init__.py;\
make svtplay-dl; \ make svtplay-dl; \
git add svtplay-dl Makefile lib/svtplay_dl/__init__.py; \ git add svtplay-dl Makefile lib/svtplay_dl/__init__.py; \
git commit -m "Prepare for release $(RELEASE)"; git commit -m "Prepare for release $(NEW_RELEASE)";
(cd $(RELEASE_DIR) && git format-patch --stdout HEAD^) | git am (cd $(RELEASE_DIR) && git format-patch --stdout HEAD^) | git am
git tag -m "New version $(RELEASE)" \ git tag -m "New version $(NEW_RELEASE)" \
-m "$$(git log --oneline $(LATEST_RELEASE)..HEAD^)" \ -m "$$(git log --oneline $(LATEST_RELEASE)..HEAD^)" \
$(RELEASE) $(NEW_RELEASE)
make clean_releasedir make clean_releasedir

View File

@ -14,14 +14,28 @@ export PACKAGES = svtplay_dl \
svtplay_dl.utils \ svtplay_dl.utils \
svtplay_dl.service \ svtplay_dl.service \
svtplay_dl.subtitle svtplay_dl.subtitle
export PYFILES = $(addsuffix /*.py,$(subst .,/,$(PACKAGES))) export PYFILES = $(sort $(addsuffix /*.py,$(subst .,/,$(PACKAGES))))
PYTHON ?= /usr/bin/env python PYTHON ?= /usr/bin/env python
svtplay-dl: $(PYFILES) svtplay-dl: $(PYFILES)
zip -X --quiet svtplay-dl $(PYFILES) @# Verify that there's no .build already \
zip -X --quiet --junk-paths svtplay-dl svtplay_dl/__main__.py ! [ -d .build ] || { \
echo "ERROR: build already in progress? (or remove $(PWD)/.build/)"; \
exit 1; \
}; \
mkdir -p .build
@# Stage the files in .build for postprocessing
for py in $(PYFILES); do install -D $$py .build/$$py; done
@# reset timestamps, to avoid non-determinism in zip file
find .build/ -exec touch -m -t 198001010000 {} \;
(cd .build && zip -X --quiet svtplay-dl $(PYFILES))
(cd .build && zip -X --quiet --junk-paths svtplay-dl svtplay_dl/__main__.py)
echo '#!$(PYTHON)' > svtplay-dl echo '#!$(PYTHON)' > svtplay-dl
cat svtplay-dl.zip >> svtplay-dl cat .build/svtplay-dl.zip >> svtplay-dl
rm svtplay-dl.zip rm -rf .build
chmod a+x svtplay-dl chmod a+x svtplay-dl