11# repro-sources-list.sh
22
3- [ ` repro-sources-list.sh ` ] ( ./repro-sources-list.sh ) configures ` /etc/apt/sources.list ` and similar files for installing packages from a snapshot.
3+ [ ` repro-sources-list.sh ` ] ( ./repro-sources-list.sh ) configures ` /etc/apt/sources.list ` and similar files
4+ for installing packages from a snapshot to help [ Reproducible Builds] ( https://reproducible-builds.org/ ) .
5+
6+ ``` dockerfile
7+ # SOURCE_DATE_EPOCH is set to 1691114774 (i.e., 20230804T020614Z, timestamp of /etc/apt/sources.list)
8+ FROM ubuntu:jammy-20230804
9+ ENV DEBIAN_FRONTEND=noninteractive
10+ RUN \
11+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
12+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
13+ --mount=type=bind,source=./repro-sources-list.sh,target=/usr/local/bin/repro-sources-list.sh \
14+ repro-sources-list.sh && \
15+ apt-get update && \
16+ apt-get install -y gcc
17+ ```
418
519Examples:
620- [ ` Dockerfile.debian-11 ` ] ( ./Dockerfile.debian-11 )
@@ -9,9 +23,27 @@ Examples:
923- [ ` Dockerfile.ubuntu-2304 ` ] ( ./Dockerfile.ubuntu-2304 )
1024- [ ` Dockerfile.archlinux ` ] ( ./Dockerfile.archlinux )
1125
12- ## Hint
26+ ## Hints
1327- To preserve the package cache on GHA, use < https://github.com/overmindtech/buildkit-cache-dance > .
1428 See [ ` .github/workflows/main.yaml ` ] ( ./.github/workflows/main.yaml ) for an example.
1529
1630- For Debian >= 13 and Ubuntu >= 23.10, see also [ ` ./alternative/ ` ] ( ./alternative/ )
1731 to lock packages without using [ ` repro-sources-list.sh ` ] ( ./repro-sources-list.sh ) .
32+
33+ ### Environment variables
34+
35+ | Variable | Description | Default value |
36+ | ---------------------------| -----------------------------------------------| --------------------------------------------------------------------|
37+ | ` SOURCE_DATE_EPOCH ` | Timestamp of the snapshot (int64) | Timestamp of ` /etc/apt/sources.list ` , etc. (See below) |
38+ | ` WRITE_SOURCE_DATE_EPOCH ` | Write the ` SOURCE_DATE_EPOCH ` value to a file | ` /dev/null ` |
39+ | ` SNAPSHOT_ARCHIVE_BASE ` | Base URL of the snapshot | ` http://snapshot-cloudflare.debian.org/archive/ ` , etc. (See below) |
40+ | ` BACKPORTS ` | Enable Debian backports | ` 0 ` |
41+
42+ Distribution-specific default values:
43+
44+ | Distribution | ` SOURCE_DATE_EPOCH ` | ` SNAPSHOT_ARCHIVE_BASE ` |
45+ | ----------------| ------------------------------------------------------| --------------------------------------------------|
46+ | Debian (<= 11) | Timestamp of ` /etc/apt/sources.list ` | ` http://snapshot-cloudflare.debian.org/archive/ ` |
47+ | Debian (>= 12) | Timestamp of ` /etc/apt/sources.list.d/debian.source ` | ` http://snapshot-cloudflare.debian.org/archive/ ` |
48+ | Ubuntu | Timestamp of ` /etc/apt/sources.list ` | ` http://snapshot.ubuntu.com/ ` |
49+ | ArchLinux | Timestamp of ` /var/log/pacman.log ` | ` http://archive.archlinux.org/ ` |
0 commit comments