Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn duplicate files into relative symlinks #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ You can replicate the commands executed by CI locally, from the rosdistro reposi
```
create_recipes --recipes config/recipes.yaml --recipes-dir ~/workspace/recipes --release-label hotdog --release-track hotdog --debian-version 0.0.0
pull_distro_repositories --src-dir ~/workspace/src --github-key $GITHUB_KEY --rosdistro-index rosdistro/index.yaml --recipes config/recipes.yaml --clean
generate_bundle_templates --src-dir ~/workspace/src --template-dir ~/workspace/templates --recipe ~/workspace/recipes/dev-bionic-hotdog.yaml
generate_bundle_templates --src-dir ~/workspace/src --template-dir ~/workspace/debian --recipe ~/workspace/recipes/dev-bionic-hotdog.yaml
```


Expand Down
2 changes: 1 addition & 1 deletion tailor_distro/debian_templates/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONUNBUFFERED 1

RUN apt-get update && apt-get install --no-install-recommends -y \
locales curl gnupg sudo ccache software-properties-common expect
locales curl gnupg sudo software-properties-common expect rdfind
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8

Expand Down
19 changes: 16 additions & 3 deletions tailor_distro/debian_templates/rules.j2
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,21 @@ override_dh_strip:
# We don't really care about calculating shlibdeps
override_dh_shlibdeps:

# Fixup absolute and relative paths for installation target into /opt, don't touch .so libs
# Remove all python bytecode
# Find duplicate files, turn into relative symlinks
override_dh_installdeb:
# Fixup absolute and relative paths for installation target into /opt, don't touch .so libs
find . -type f -exec grep -I -q . {} \; -print0 | xargs -0 sed -ri "s|($(CURDIR)/)?debian/tmp/opt|/opt|g" && \
find . -name '*.pyc' -delete && \
find $(INSTALL_DIR) -type f -exec grep -I -q . {} \; -print0 | xargs -0 sed -ri "s|($(CURDIR)/)?debian/tmp/opt|/opt|g" && \
find $(INSTALL_DIR) -name '*.pyc' -delete && \
rdfind -makesymlinks true $(INSTALL_DIR) && \
find $(INSTALL_DIR) -type l -exec sh -c ' \
for link do \
target=$$(readlink "$$link"); \
case "$$target" in \
/*) \
dir=$$(dirname "$$link"); \
reltarget=$$(realpath --relative-to="$$dir" "$$target"); \
ln -sfn "$$reltarget" "$$link";; \
esac; \
done' sh {} + && \
dh_installdeb