Reproducible builds. Chroot environment, date and config.
by viel from LinuxQuestions.org on (#6K03W)
Hi all,
Omg, i post this on the worng forum. Virtualization, sorry. Hope that are the right.
Looking for reproducible builds in the Slackware Sub-Forum I only found 3 threads.
One in 2015 other in 2016 and on 2021. But nothing relevant for mi question.
Maybe I'm little daring. Maybe I have to much free time. Maybe I hope Slackware can do it.
I am now playing with chroot to try made an environment for reproducible builds. From my understand to do a reproducible build there are 2 requirements, same date "SOURCE_DATE_EPOCH" and same environment.
I am not an expert on C, compiler, environments, ... So sorry if I'm very wrong.
From now i am trying to change the date on chroot to fix the SOURCE_DATE_EPOCH. I looking deeper to change the system date.
Code:[root@arcadia sis]# unshare -T -- chroot /tmp/HugeSlackBuildchroot/ /bin/bash --norc
bash-5.1# echo "boottime $((9*24*60*60)) 0" > /proc/$$/timens_offsets
bash-5.1# echo "monotonic $((2*24*60*60)) 0" > /proc/$$/timens_offsets
bash-5.1# uptime --pretty
up 4 weeks, 22 hours, 18 minutes
bash-5.1#
bash-5.1#
bash-5.1#
[root@arcadia v]# uptime --pretty
up 2 weeks, 5 days, 22 hours, 19 minutes
[root@arcadia v]#Can i have different date for chroot and system?
I installed desired packages on the chroot to build a random package and checksum it. Actually I use the random ncdu to test. I need the same packages installed on the environment rigth? That are trivial to install desired packages on a chroot. Done.
I appreciate if someone can point me in the right way.
I think containers are not the way, too heavy.
I am on a rabbit hole?
Can chroot do same as a container from the point of view of making a reproducible build? Construct same environment, date, etc...
How many thinks are needed on the environment to make a reproducible build?
From env:
Code:[root@arcadia tmp]# env
SHELL=/bin/bash
WINDOWID=1258293
XDG_CONFIG_DIRS=/etc/xdg:/etc/kde/xdg
TERM_PROGRAM_VERSION=3.2a
TMUX=/tmp/tmux-0/default,4977,0
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/share/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig
GNOME_KEYRING_CONTROL=/home/xxx/.cache/keyring-3I7NI2
G_BROKEN_FILENAMES=1
HOSTNAME=arcadia.local
MINICOM=-c on
JAVA_HOME=/usr/lib64/zulu-openjdk8
SSH_AUTH_SOCK=/root/.ssh/ssh_auth_sock
ANT_HOME=/usr/share/ant
XDG_SEAT=seat0
PWD=/tmp
LOGNAME=root
XDG_SESSION_TYPE=tty
MANPATH=:/usr/lib64/zulu-openjdk11/man:/usr/lib64/zulu-openjdk8/man
UNO_PATH=/usr/lib64/libreoffice/program
XAUTHORITY=/root/.xauthasdG7U
LS_OPTIONS=-F -b -T 0 --color=auto
WINDOWPATH=1
HOME=/root
LANG=en_US.UTF-8
--squipped--I need all the environment variables are the same? Can this be configured, automated, changed?
I am looking deeper on internet but some help are welcome.
I do not believe that I lost time if I do not get to a good end, at least I always learn something.
I wrote some garbage scripts in Github from which I am doing the tests. https://github.com/VielLosero/HugeSlackBuilds
All welcome.
Thanks in advance.
Viel.
Omg, i post this on the worng forum. Virtualization, sorry. Hope that are the right.
Looking for reproducible builds in the Slackware Sub-Forum I only found 3 threads.
One in 2015 other in 2016 and on 2021. But nothing relevant for mi question.
Maybe I'm little daring. Maybe I have to much free time. Maybe I hope Slackware can do it.
I am now playing with chroot to try made an environment for reproducible builds. From my understand to do a reproducible build there are 2 requirements, same date "SOURCE_DATE_EPOCH" and same environment.
I am not an expert on C, compiler, environments, ... So sorry if I'm very wrong.
From now i am trying to change the date on chroot to fix the SOURCE_DATE_EPOCH. I looking deeper to change the system date.
Code:[root@arcadia sis]# unshare -T -- chroot /tmp/HugeSlackBuildchroot/ /bin/bash --norc
bash-5.1# echo "boottime $((9*24*60*60)) 0" > /proc/$$/timens_offsets
bash-5.1# echo "monotonic $((2*24*60*60)) 0" > /proc/$$/timens_offsets
bash-5.1# uptime --pretty
up 4 weeks, 22 hours, 18 minutes
bash-5.1#
bash-5.1#
bash-5.1#
[root@arcadia v]# uptime --pretty
up 2 weeks, 5 days, 22 hours, 19 minutes
[root@arcadia v]#Can i have different date for chroot and system?
I installed desired packages on the chroot to build a random package and checksum it. Actually I use the random ncdu to test. I need the same packages installed on the environment rigth? That are trivial to install desired packages on a chroot. Done.
I appreciate if someone can point me in the right way.
I think containers are not the way, too heavy.
I am on a rabbit hole?
Can chroot do same as a container from the point of view of making a reproducible build? Construct same environment, date, etc...
How many thinks are needed on the environment to make a reproducible build?
From env:
Code:[root@arcadia tmp]# env
SHELL=/bin/bash
WINDOWID=1258293
XDG_CONFIG_DIRS=/etc/xdg:/etc/kde/xdg
TERM_PROGRAM_VERSION=3.2a
TMUX=/tmp/tmux-0/default,4977,0
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/share/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig
GNOME_KEYRING_CONTROL=/home/xxx/.cache/keyring-3I7NI2
G_BROKEN_FILENAMES=1
HOSTNAME=arcadia.local
MINICOM=-c on
JAVA_HOME=/usr/lib64/zulu-openjdk8
SSH_AUTH_SOCK=/root/.ssh/ssh_auth_sock
ANT_HOME=/usr/share/ant
XDG_SEAT=seat0
PWD=/tmp
LOGNAME=root
XDG_SESSION_TYPE=tty
MANPATH=:/usr/lib64/zulu-openjdk11/man:/usr/lib64/zulu-openjdk8/man
UNO_PATH=/usr/lib64/libreoffice/program
XAUTHORITY=/root/.xauthasdG7U
LS_OPTIONS=-F -b -T 0 --color=auto
WINDOWPATH=1
HOME=/root
LANG=en_US.UTF-8
--squipped--I need all the environment variables are the same? Can this be configured, automated, changed?
I am looking deeper on internet but some help are welcome.
I do not believe that I lost time if I do not get to a good end, at least I always learn something.
I wrote some garbage scripts in Github from which I am doing the tests. https://github.com/VielLosero/HugeSlackBuilds
All welcome.
Thanks in advance.
Viel.