File reproducible-faketools-0.5.4+0.obscpio of Package reproducible-faketools

07070100000000000081A40000000000000000000000016692C10E0000048B000000000000000000000000000000000000002A00000000reproducible-faketools-0.5.4+0/LICENSE.mdFiles in this project are licensed under
MIT License
Copyright (c) 2016-2017 SUSE LLC and others
Copyright (c) 2024 Bernhard M. Wiedemann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

07070100000001000081A40000000000000000000000016692C10E0000021E000000000000000000000000000000000000002800000000reproducible-faketools-0.5.4+0/MakefilePREFIX:=/usr/local
all: build
build:
	echo "nothing to build here"
install:
	install -d $(DESTDIR)$(PREFIX)/bin/ $(DESTDIR)$(PREFIX)/lib/ $(DESTDIR)/etc/profile.d/ $(DESTDIR)/usr/lib/rpm/brp-suse.d/
	install -p -m 755 bin/* $(DESTDIR)$(PREFIX)/bin/
	cp -a lib/reproducible-faketools $(DESTDIR)$(PREFIX)/lib/
	install -p -m 644 extra/disorderfs.sh $(DESTDIR)/etc/profile.d/
	install -p -m 755 extra/brp-95-strip-nondeterminism $(DESTDIR)/usr/lib/rpm/brp-suse.d/

roundup:
	git clone https://github.com/SUSE-Cloud/roundup

test:
	make -C tests
07070100000002000081A40000000000000000000000016692C10E0000042D000000000000000000000000000000000000002900000000reproducible-faketools-0.5.4+0/README.md# reproducible-faketools
These tools are meant to help with [reproducible builds](https://reproducible-builds.org/).
This works by masking standard UNIX tools in build environments
with versions that give more predictable output when [$SOURCE_DATE_EPOCH](https://reproducible-builds.org/specs/source-date-epoch/) is set
but just redirect to the normal version otherwise.

This is similar to [reproducible-utils](https://anonscm.debian.org/git/reproducible/reproducible-utils.git/tree/) and might be merged later.

## Usage

in [OBS](https://build.opensuse.org/), pull in extra packages by adding to [prjconf](https://build.opensuse.org/projects/home:bmwiedemann:reproducible:rebuild/prjconf):

    VMinstall: reproducible-faketools-j1

in osc:

    osc build --vm-type=kvm -x reproducible-faketools-j1

in [rbk](https://github.com/bmwiedemann/reproducibleopensuse/blob/devel/rbk):

    oscbuildparams="-x reproducible-faketools-j1" rbk

## How to Contribute

Send bugreports and pull-requests via [GitHub](https://github.com/bmwiedemann/reproducible-faketools/issues).
07070100000003000081A40000000000000000000000016692C10E00000236000000000000000000000000000000000000002800000000reproducible-faketools-0.5.4+0/_service<services>
  <service mode="manual" name="obs_scm">
    <param name="url">https://github.com/bmwiedemann/reproducible-faketools.git</param>
    <param name="scm">git</param>
    <param name="revision">devel</param>
    <param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@</param>
    <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param>
    <param name="extract">reproducible-faketools.spec</param>
    <param name="extract">_service</param>
  </service>
  <service mode="manual" name="set_version" />
  <service mode="buildtime" name="tar" />
</services>
07070100000004000041ED0000000000000000000000026692C10E00000000000000000000000000000000000000000000002300000000reproducible-faketools-0.5.4+0/bin07070100000005000081ED0000000000000000000000016692C10E000000F4000000000000000000000000000000000000002700000000reproducible-faketools-0.5.4+0/bin/ant#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
ANT_ARGS+=" -Dant.tstamp.now=$SOURCE_DATE_EPOCH"
export ANT_ARGS
$orig "$@"
if [ -e /usr/bin/strip-nondeterminism ] ; then
    faketoolnotice "$@"
    strip-all-nondeterminism || :
fi
07070100000006000081ED0000000000000000000000016692C10E00000087000000000000000000000000000000000000002600000000reproducible-faketools-0.5.4+0/bin/ar#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
[ "$1" != "-r" ] && exec $orig "$@"
faketoolnotice "$@"
exec $orig -D "$@"
07070100000007000081ED0000000000000000000000016692C10E00000197000000000000000000000000000000000000002800000000reproducible-faketools-0.5.4+0/bin/date#!/bin/bash
. $(dirname $0)/../lib/reproducible-faketools/lib
for arg in "$@" ; do
    if  [[ $arg =~ ^-d ]] ||\
	[[ $arg =~ ^--date ]] ||\
	[[ $arg =~ ^-f ]] ||\
	[[ $arg =~ ^-uf ]] ||\
	[[ $arg =~ ^--file ]] ||\
	[[ $arg =~ ^-r ]] ||\
	[[ $arg =~ ^-ur ]] ||\
	[[ $arg =~ ^--reference ]]
        then
        exec $orig "$@"
    fi
done
faketoolnotice "$@"
exec $orig --utc -d "@${SOURCE_DATE_EPOCH}" "$@"
07070100000008000081ED0000000000000000000000016692C10E000000C7000000000000000000000000000000000000002800000000reproducible-faketools-0.5.4+0/bin/find#!/bin/bash
. $(dirname $0)/../lib/reproducible-faketools/lib
sortparm=
for arg in "$@" ; do
    [[ "$arg" = "-print0" ]] && sortparm=-z
done
faketoolnotice "$@"
exec $orig "$@" |
    sort $sortparm
07070100000009000081ED0000000000000000000000016692C10E00000036000000000000000000000000000000000000002800000000reproducible-faketools-0.5.4+0/bin/gzip#!/bin/sh
export PATH=/bin:/usr/bin
exec gzip -n "$@"
0707010000000A000081ED0000000000000000000000016692C10E00000098000000000000000000000000000000000000002C00000000reproducible-faketools-0.5.4+0/bin/hostname#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
[ "$*" != "" ] && [ "$*" != "-f" ] && exec $orig "$@"
faketoolnotice "$@"
echo reproducible
0707010000000B000081ED0000000000000000000000016692C10E000001CA000000000000000000000000000000000000002700000000reproducible-faketools-0.5.4+0/bin/jar#!/bin/bash
. $(dirname $0)/../lib/reproducible-faketools/lib
if [[ $SOURCE_DATE_EPOCH -lt 315532802 ]] ; then
    SOURCE_DATE_EPOCH=315532802
fi
d=$(date -u -Iseconds -d "@${SOURCE_DATE_EPOCH}")
for arg in "$@" ; do
    if  [[ $arg =~ ^-c ]] ||\
        [[ $arg =~ ^--create ]] ||\
        [[ $arg =~ ^-u ]] ||\
        [[ $arg =~ ^--update ]]
        then
            faketoolnotice "$@"
            exec $orig --date="$d" "$@"
    fi
done
exec $orig "$@"
0707010000000C000081ED0000000000000000000000016692C10E0000042B000000000000000000000000000000000000003700000000reproducible-faketools-0.5.4+0/bin/reproducible-zip.pl#!/usr/bin/perl -w
use strict;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
my @mappedargv=qw(7z -tzip -mtc=off);
my @lateargv=();
my %options=qw();
my @options=qw"recurse-paths|r filesync delete|d update|u test|T move|m exclude|x=s no-extra|X no-dir-entries|D junk-paths|j quiet|q names-stdin|@ 0 1 2 3 4 5 6 7 8 9";
GetOptions(\%options, @options);
#print (%options);

for(0..9) {
    if($options{$_}) {push(@mappedargv, "-mx=$_")}
}
push(@mappedargv, "-bd") if $options{quiet};
push(@mappedargv, "-x".$options{exclude}) if $options{exclude};
if($options{"junk-paths"}) { die "junk-paths option is not supported in $0" }
if($options{"names-stdin"}) {push(@lateargv, '@/dev/stdin')}

my $action='a';
my %actionmap=qw(
    add a
    update u
    delete d
);
if($actionmap{$ARGV[0]}) {
    $action=$actionmap{shift(@ARGV)};
}
if($options{move}) {$action="a"}
if($options{update}) {$action="u"}
if($options{delete}) {$action="d"}
if($options{test}) {$action="t"}
push(@mappedargv, $action, @ARGV, @lateargv);
print STDERR "@mappedargv\n";
exec(@mappedargv);
0707010000000D000081ED0000000000000000000000016692C10E0000013F000000000000000000000000000000000000002C00000000reproducible-faketools-0.5.4+0/bin/rpmbuild#!/bin/bash
: ${SOURCE_DATE_EPOCH:=1720079000}
: ${wrapperdir:=/usr/local/lib/reproducible-faketools/rpmbuild.d}
. $(dirname $0)/../lib/reproducible-faketools/lib
declare -a wrapper=()
shopt -s nullglob
for w in $wrapperdir/* ; do
    faketoolnotice "using $w"
    . $w
done
exec "${wrapper[@]}" /usr/bin/rpmbuild "$@"
0707010000000E000081ED0000000000000000000000016692C10E00000063000000000000000000000000000000000000002900000000reproducible-faketools-0.5.4+0/bin/strip#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
faketoolnotice "$@"
exec $orig -D "$@"
0707010000000F000081ED0000000000000000000000016692C10E000000C3000000000000000000000000000000000000002600000000reproducible-faketools-0.5.4+0/bin/su#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
if [ "$2" = "/.build.command" ] ; then
    faketoolnotice "fixed pid"
    echo 10000 > /proc/sys/kernel/ns_last_pid
fi
exec $orig "$@"
07070100000010000081ED0000000000000000000000016692C10E000000EC000000000000000000000000000000000000002700000000reproducible-faketools-0.5.4+0/bin/tar#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
faketoolnotice "$@"
rbopts="--sort=name --clamp-mtime --mtime @$SOURCE_DATE_EPOCH"
echo "$@" | grep -q -- --pax-option || rbopts="$rbopts --format=gnu"
exec $orig "$@" $rbopts
07070100000011000081ED0000000000000000000000016692C10E000002C6000000000000000000000000000000000000002900000000reproducible-faketools-0.5.4+0/bin/uname#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
[ "$*" = "" ] && exec $orig "$@"
[ "$*" = "-a" ] && exec "$0" -s -n -r -v -m -p -i -o

add()
{
    [ -z "$o" ] || o="$o "
    o="$o$1"
}

o=""
for arg in "$@" ; do
    case "$arg" in
        -n)
            faketoolnotice $arg nodename
            add "reproducible"
            ;;
        -v)
            faketoolnotice $arg kernel version
            add "reproducible"
            ;;
        -r)
            faketoolnotice $arg kernel release
            t=`$orig $arg|sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1-reproducible/'`
            add "$t"
            ;;
        *)
            add "`$orig $arg`"
            ;;
    esac
done
echo "$o"
07070100000012000081ED0000000000000000000000016692C10E0000006E000000000000000000000000000000000000002700000000reproducible-faketools-0.5.4+0/bin/zip#!/bin/sh
. $(dirname $0)/../lib/reproducible-faketools/lib
faketoolnotice "$@"
exec reproducible-zip.pl "$@"
07070100000013000041ED0000000000000000000000026692C10E00000000000000000000000000000000000000000000002500000000reproducible-faketools-0.5.4+0/extra07070100000014000081ED0000000000000000000000016692C10E000000CE000000000000000000000000000000000000004100000000reproducible-faketools-0.5.4+0/extra/brp-95-strip-nondeterminism#!/bin/sh -x
[ -e /usr/bin/strip-nondeterminism ] && find $RPM_BUILD_ROOT -type f -print0 | xargs -r -0 --no-run-if-empty strip-nondeterminism --timestamp=${SOURCE_DATE_EPOCH:-1720800000} --clamp-timestamp
07070100000015000081A40000000000000000000000016692C10E000001AE000000000000000000000000000000000000003300000000reproducible-faketools-0.5.4+0/extra/disorderfs.sh#!/bin/sh
(
exec >/dev/null
exec 2>&1
if [ -e /home/abuild/rpmbuild/BUILD ] && ! [ -e /home/abuild/rpmbuild/BUILD.unsorted ] ; then
	mv /home/abuild/rpmbuild/BUILD /home/abuild/rpmbuild/BUILD.unsorted
	mkdir /home/abuild/rpmbuild/BUILD
	# needs chmod 4755 /usr/bin/fusermount
	# and mknod /dev/fuse c 10 229
	disorderfs --sort-dirents=yes --reverse-dirents=no /home/abuild/rpmbuild/BUILD.unsorted /home/abuild/rpmbuild/BUILD
fi
)
07070100000016000041ED0000000000000000000000026692C10E00000000000000000000000000000000000000000000002300000000reproducible-faketools-0.5.4+0/lib07070100000017000041ED0000000000000000000000026692C10E00000000000000000000000000000000000000000000003A00000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools07070100000018000081A40000000000000000000000016692C10E0000013E000000000000000000000000000000000000003E00000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/lib# to be sourced by the scipts in this package
orig=/usr/bin/$(basename $0)
[ -x "$orig" ] || orig=/bin/$(basename $0)
[ -n "$SOURCE_DATE_EPOCH" ] || exec $orig "$@"
export LC_ALL=C
unset TZ

faketoolnotice()
{
    [ -n "$RBFTVERBOSE" ] || return 0
    echo "notice: used reproducible-faketool $(basename $0) $@" >&2
}
07070100000019000041ED0000000000000000000000026692C10E00000000000000000000000000000000000000000000004500000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d0707010000001A000081A40000000000000000000000016692C10E00000040000000000000000000000000000000000000005300000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/03-verbose.shexport RBFTVERBOSE=1
faketoolnotice "verbose mode activated $@"
0707010000001B000081A40000000000000000000000016692C10E00000016000000000000000000000000000000000000005000000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/40-aslr.shwrapper+=(setarch -R)
0707010000001C000081A40000000000000000000000016692C10E00000014000000000000000000000000000000000000005400000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/50-dettrace.shwrapper+=(dettrace)
0707010000001D000081A40000000000000000000000016692C10E000000A7000000000000000000000000000000000000005200000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/55-strace.shwrapper+=(strace -q -s 400 -f \
    -e file,open,openat,rename,renameat,renameat2,link,linkat,symlink,symlinkat\
,chdir,fchdir,execve\
,clone,clone3,fork,vfork,uname)
0707010000001E000081A40000000000000000000000016692C10E000000D3000000000000000000000000000000000000005400000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/60-faketime.sh. $(dirname $0)/../lib/reproducible-faketools/lib
step=1
faketoolnotice step=$step date=$SOURCE_DATE_EPOCH
export FAKETIME_DONT_RESET=1
wrapper+=(faketime -f "@$(date -u -d@$SOURCE_DATE_EPOCH "+%F %T") i$step")
0707010000001F000081A40000000000000000000000016692C10E00000015000000000000000000000000000000000000004E00000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/60-j1.shwrapper+=(taskset 1)
07070100000020000081A40000000000000000000000016692C10E00000008000000000000000000000000000000000000005400000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/80-future1y.shyears=1
07070100000021000081A40000000000000000000000016692C10E00000111000000000000000000000000000000000000005200000000reproducible-faketools-0.5.4+0/lib/reproducible-faketools/rpmbuild.d/81-future.sh: ${years:=16}
now=$(date +%s)
: ${datediff:=$(((((365*$years+36)*24+13)*60+17)*60))}
: ${date:=$((now+datediff))}
# needs root permissions:
if [[ $UID = 0 ]] ; then
    date --set @$date
else
    faketoolnotice "faketools not running as root - cannot set system clock"
fi
07070100000022000081A40000000000000000000000016692C10E0000233D000000000000000000000000000000000000003B00000000reproducible-faketools-0.5.4+0/reproducible-faketools.spec#
# spec file for package reproducible-faketools
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           reproducible-faketools
Version:        set-by-service-from-git-tag
Release:        0
Summary:        Fake system tools for reproducible builds
License:        MIT
Group:          Development/Tools/Other
URL:            https://github.com/bmwiedemann/reproducible-faketools
Source0:        %{name}-%{version}.tar
Requires:       bash
Requires:       coreutils
Requires:       this-is-only-for-build-envs
BuildArch:      noarch

%description
These tools are meant to help with reproducible builds.
This works by masking standard UNIX tools in build environments
with versions that give more predictable output when $SOURCE_DATE_EPOCH
is set but just redirect to the normal version otherwise.

%prep
%setup

%build
echo dummy file because an rpm cannot be empty > README.random

%install
%make_install

%check
make test

%package hostname
Summary:        replacement hostname
Requires:       hostname
Requires:       reproducible-faketools
%description hostname
a script to enhance the reproducibility of the output of hostname
%files hostname
%defattr(-, root, root, 0755)
/usr/local/bin/hostname
/usr/local/bin/uname

%package date
Summary:        replacement date
Requires:       reproducible-faketools
%description date
a script to enhance the reproducibility of the output of date
%files date
%defattr(-, root, root, 0755)
/usr/local/bin/date

%package find
Summary:        replacement find
Requires:       reproducible-faketools
%description find
a script to enhance the reproducibility of the output of find
%files find
%defattr(-, root, root, 0755)
/usr/local/bin/find

%package ar
Summary:        replacement ar
Requires:       reproducible-faketools
%description ar
a script to enhance the reproducibility of the output of ar
%files ar
%defattr(-, root, root, 0755)
/usr/local/bin/ar
/usr/local/bin/strip

%package tar
Summary:        replacement tar
Requires:       reproducible-faketools
Requires:       tar >= 1.28
%description tar
a script to enhance the reproducibility of the output of tar
by adding --sort and --mtime options
%files tar
%defattr(-, root, root, 0755)
/usr/local/bin/gzip
/usr/local/bin/tar

%package ant
Summary:        replacement ant
Requires:       reproducible-faketools
Requires:       strip-nondeterminism
%description ant
a script to enhance the reproducibility of the output of ant
%files ant
%defattr(-, root, root, 0755)
/usr/local/bin/ant

%package strip-nondeterminism
Summary:        Run strip-nondeterminism after build
Requires:       reproducible-faketools
Requires:       strip-nondeterminism
%description strip-nondeterminism
enhance the reproducibility of various file formats
with strip-nondeterminism
%files strip-nondeterminism
%defattr(-, root, root, 0644)
/usr/lib/rpm/brp-suse.d/brp-95-strip-nondeterminism

%package filesys
Summary:        sorted filesystem
Requires:       disorderfs
Requires:       reproducible-faketools
%description filesys
a script to make sure readdir on filesystems is always sorted during build
WARNING: do not use outside OBS or osc build --vm-type=kvm
%files filesys
%defattr(-, root, root, 0755)
/etc/profile.d/disorderfs.sh
%post filesys
chmod 4755 /usr/bin/fusermount || :
mknod /dev/fuse c 10 229 || :

%package pid
Summary:        use fixed pid
Requires:       reproducible-faketools
%description pid
a script to wrap su to start a build with a fixed process id
to enhance the reproducibility of some packages
%files pid
%defattr(-, root, root, 0755)
/usr/local/bin/su

%package random
Summary:        reduce sources of explicit randomness
Requires:       reproducible-faketools
%description random
reduce sources of explicit randomness
by replacing /dev/random and urandom
%files random
%doc README.random
%post random
rm -f /dev/{,u}random
mknod /dev/random c 1 5
mknod /dev/urandom c 1 5
%postun random
rm -f /dev/{,u}random
mknod /dev/random c 1 8
mknod /dev/urandom c 1 9

%package zip
Summary:        replacement zip
Requires:       p7zip
Requires:       perl
Requires:       reproducible-faketools
%description zip
a script to enhance the reproducibility of the output of zip
by replacing it with a wrapper to 7z
%files zip
%defattr(-, root, root, 0755)
/usr/local/bin/zip
/usr/local/bin/reproducible-zip.pl

%package jar
Summary:        replacement jar
Requires:       java-devel
Requires:       reproducible-faketools
%description jar
a script to enhance the reproducibility of the output of jar
by normalizing mtimes via the --date= option
%files jar
%defattr(-, root, root, 0755)
/usr/local/bin/jar

%package rpmbuild
Summary:        wrapper to include various other faketools
Requires:       reproducible-faketools
%description rpmbuild
This is a wrapper script that runs scripts from
/usr/local/lib/reproducible-faketools/rpmbuild.d/
%files rpmbuild
%defattr(-, root, root, 0755)
/usr/local/bin/rpmbuild
%dir /usr/local/lib/reproducible-faketools/rpmbuild.d

%package faketime
Summary:        fake time via LD_PRELOAD
Requires:       libfaketime
Requires:       reproducible-faketools-rpmbuild
%description faketime
a script to enhance the reproducibility of the output
by replacing time(2) and fstat(2) library calls to return our notion of time
%files faketime
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/60-faketime.sh

%package dettrace
Summary:        use dettrace to normalize env
%if 0%{?withdettrace}
Requires:       dettrace
%else
Recommends:     dettrace
%endif
Requires:       reproducible-faketools-rpmbuild
%description dettrace
a script to enhance the reproducibility of the output
by ptraceing in a container
%files dettrace
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/50-dettrace.sh

%package strace
Summary:        run build with strace
Requires:       reproducible-faketools-rpmbuild
Requires:       strace
%description strace
a script to facilitate the debugging of reproducibility issues
by running rpmbuild with strace to find how files are created
%files strace
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/55-strace.sh

%package j1
Summary:        run build with single-thread
Requires:       reproducible-faketools-rpmbuild
Requires:       util-linux
%description j1
a script to facilitate the debugging of reproducibility issues
by running rpmbuild with taskset 1 to reduce parallelism
%files j1
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/60-j1.sh

%package aslr
Summary:        run build without aslr
Requires:       reproducible-faketools-rpmbuild
%description aslr
Run the build without aslr. Does not require root permissions.
%files aslr
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/40-aslr.sh

%package verbose
Summary:        run faketools in verbose mode
Requires:       reproducible-faketools-rpmbuild
%description verbose
prints various notice messages from faketools - useful for debugging
warning: can confuse some test frameworks
%files verbose
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/03-verbose.sh

%package future1y
Summary:        Run build with the timestamp set to 1y in the future
Requires:       reproducible-faketools-future
%description future1y
Run the build with the timestamp set to 1y in the future
%files future1y
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/80-future1y.sh

%package future
Summary:        Run build with the timestamp set to 16y in the future
Requires:       reproducible-faketools-rpmbuild
%description future
Run the build with the timestamp set to 16y in the future
(overridable default)
%files future
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/81-future.sh

%package futurepost
Summary:        Run build in the future
Requires:       reproducible-faketools
%description futurepost
Uses post script to modify the build system date,
so that it works when rpmbuild runs as non-root (default).
Needs osc build --clean
Warning: Only install in scratch-VMs as it will change the system clock.
%post futurepost
now=$(date +%%s)
date --set @$((now + 34694220))
%files futurepost
%ghost /var/log/futurepost

%files
%defattr(-, root, root, 0755)
%license LICENSE.md
%doc README.md
%dir /usr/local/lib/%{name}
/usr/local/lib/%{name}/lib

%changelog
07070100000023000041ED0000000000000000000000026692C10E00000000000000000000000000000000000000000000002500000000reproducible-faketools-0.5.4+0/tests07070100000024000081A40000000000000000000000016692C10E00000014000000000000000000000000000000000000002E00000000reproducible-faketools-0.5.4+0/tests/Makefiletest:
	./roundup.sh
07070100000025000081A40000000000000000000000016692C10E000001FD000000000000000000000000000000000000003200000000reproducible-faketools-0.5.4+0/tests/date-test.sh#!/usr/bin/env roundup

describe "roundup(1) testing of date"

it_normalizes_date() {
   result=$(SOURCE_DATE_EPOCH=1234567 ../bin/date -u -Iseconds)
   [[ "$result" = "1970-01-15T06:56:07+00:00" ]]
}

it_ignores_normalized_date() {
   result=$(SOURCE_DATE_EPOCH=1234567 ../bin/date -u -d @1 -Iseconds)
   [[ "$result" = "1970-01-01T00:00:01+00:00" ]]
   touch -d @1 .tmp
   result=$(SOURCE_DATE_EPOCH=1234567 ../bin/date -u -r .tmp -Iseconds)
   [[ "$result" = "1970-01-01T00:00:01+00:00" ]]
   rm -f .tmp
}
07070100000026000081A40000000000000000000000016692C10E00000198000000000000000000000000000000000000003100000000reproducible-faketools-0.5.4+0/tests/jar-test.sh#!/usr/bin/env roundup

describe "roundup(1) testing of jar"

it_normalizes_mtime_on_create() {
   test -e /usr/bin/jar || return 0
   mkdir -p tmp
   echo foo > tmp/foo
   SOURCE_DATE_EPOCH=1 ../bin/jar --create --file tmp/test.jar tmp/foo
   hash=$(md5sum tmp/test.jar | cut -d" " -f1)
   rm -rf tmp
   [[ "$hash" = 5c9de655dea174b60f195771ce3094fa ]] || [[ "$hash" = 7eebf70ccec32147cd291da1b3acb041 ]]
}
07070100000027000081ED0000000000000000000000016692C10E000026D1000000000000000000000000000000000000003000000000reproducible-faketools-0.5.4+0/tests/roundup.sh#!/bin/sh
# [r5]: roundup.5.html
# [r1t]: roundup-1-test.sh.html
# [r5t]: roundup-5-test.sh.html
#
# _(c) 2010 Blake Mizerany - MIT License_
#
# Spray **roundup** on your shells to eliminate weeds and bugs.  If your shells
# survive **roundup**'s deathly toxic properties, they are considered
# roundup-ready.
#
# **roundup** reads shell scripts to form test plans.  Each
# test plan is sourced into a sandbox where each test is executed.
#
# See [roundup-1-test.sh.html][r1t] or [roundup-5-test.sh.html][r5t] for example
# test plans.
#
# __Install__
#
#     git clone http://github.com/bmizerany/roundup.git
#     cd roundup
#     make
#     sudo make install
#     # Alternatively, copy `roundup` wherever you like.
#
# __NOTE__:  Because test plans are sourced into roundup, roundup prefixes its
# variable and function names with `roundup_` to avoid name collisions.  See
# "Sandbox Test Runs" below for more insight.

# Usage and Prerequisites
# -----------------------

# Exit if any following command exits with a non-zero status.
set -e

# The current version is set during `make version`.  Do not modify this line in
# anyway unless you know what you're doing.
ROUNDUP_VERSION="0.0.5"
export ROUNDUP_VERSION

# Usage is defined in a specific comment syntax. It is `grep`ed out of this file
# when needed (i.e. The Tomayko Method).  See
# [shocco](http://rtomayko.heroku.com/shocco) for more detail.
#/ usage: roundup [--help|-h] [--version|-v] [plan ...]

roundup_usage() {
    grep '^#/' <"$0" | cut -c4-
}

while test "$#" -gt 0
do
    case "$1" in
        --help|-h)
            roundup_usage
            exit 0
            ;;
        --version|-v)
            echo "roundup version $ROUNDUP_VERSION"
            exit 0
            ;;
        --color)
            color=always
            shift
            ;;
        -)
            echo >&2 "roundup: unknown switch $1"
            exit 1
            ;;
        *)
            break
            ;;
    esac
done

# Consider all scripts with names matching `*-test.sh` the plans to run unless
# otherwise specified as arguments.
if [ "$#" -gt "0" ]
then
    roundup_plans="$@"
else
    roundup_plans="$(ls *-test.sh)"
fi

: ${color:="auto"}

# Create a temporary storage place for test output to be retrieved for display
# after failing tests.
roundup_tmp="$PWD/.roundup.$$"
mkdir -p "$roundup_tmp"

trap "rm -rf \"$roundup_tmp\"" EXIT INT

# __Tracing failures__
roundup_trace() {
    # Delete the first two lines that represent roundups execution of the
    # test function.  They are useless to the user.
    sed '1d'                                   |
    # Delete the last line which is the "set +x" of the error trap
    sed '$d'                                   |
    # Replace the rc=$? of the error trap with an verbose string appended
    # to the failing command trace line.
    sed '$s/.*rc=/exit code /'                 |
    # Trim the two left most `+` signs.  They represent the depth at which
    # roundup executed the function.  They also, are useless and confusing.
    sed 's/^++//'                              |
    # Indent the output by 4 spaces to align under the test name in the
    # summary.
    sed 's/^/    /'                            |
    # Highlight the last line in front of the exit code to bring notice to
    # where the error occurred.
    #
    # The sed magic puts every line into the hold buffer first, then
    # substitutes in the previous hold buffer content, prints that and starts
    # with the next cycle. At the end the last line (in the hold buffer)
    # is printed without substitution.
    sed -n "x;1!{ \$s/\(.*\)/$mag\1$clr/; };1!p;\$x;\$p"
}

# __Other helpers__

# Track the test stats while outputting a real-time report.  This takes input on
# **stdin**.  Each input line must come in the format of:
#
#     # The plan description to be displayed
#     d <plan description>
#
#     # A passing test
#     p <test name>
#
#     # A failed test
#     f <test name>
roundup_summarize() {
    set -e

    # __Colors for output__

    # Use colors if we are writing to a tty device.
    if (test -t 1) || (test $color = always)
    then
        red=$(printf "\033[31m")
        grn=$(printf "\033[32m")
        mag=$(printf "\033[35m")
        clr=$(printf "\033[m")
        cols=$(tput cols)
    fi

    # Make these available to `roundup_trace`.
    export red grn mag clr

    ntests=0
    passed=0
    failed=0

    : ${cols:=10}

    while read status name
    do
        case $status in
        p)
            ntests=$(expr $ntests + 1)
            passed=$(expr $passed + 1)
            printf "  %-48s " "$name:"
            printf "$grn[PASS]$clr\n"
            ;;
        f)
            ntests=$(expr $ntests + 1)
            failed=$(expr $failed + 1)
            printf "  %-48s " "$name:"
            printf "$red[FAIL]$clr\n"
            roundup_trace < "$roundup_tmp/$name"
            ;;
        d)
            printf "%s\n" "$name"
            ;;
        esac
    done
    # __Test Summary__
    #
    # Display the summary now that all tests are finished.
    yes = | head -n 57 | tr -d '\n'
    printf "\n"
    printf "Tests:  %3d | " $ntests
    printf "Passed: %3d | " $passed
    printf "Failed: %3d"    $failed
    printf "\n"

    # Exit with an error if any tests failed
    test $failed -eq 0 || exit 2
}

# Sandbox Test Runs
# -----------------

# The above checks guarantee we have at least one test.  We can now move through
# each specified test plan, determine its test plan, and administer each test
# listed in a isolated sandbox.
for roundup_p in $roundup_plans
do
    # Create a sandbox, source the test plan, run the tests, then leave
    # without a trace.
    (
        # Consider the description to be the `basename` of the plan minus the
        # tailing -test.sh.
        roundup_desc=$(basename "$roundup_p" -test.sh)

        # Define functions for
        # [roundup(5)][r5]

        # A custom description is recommended, but optional.  Use `describe` to
        # set the description to something more meaningful.
        # TODO: reimplement this.
        describe() {
            roundup_desc="$*"
        }

        # Provide default `before` and `after` functions that run only `:`, a
        # no-op. They may or may not be redefined by the test plan.
        before() { :; }
        after() { :; }

        # Seek test methods and aggregate their names, forming a test plan.
        # This is done before populating the sandbox with tests to avoid odd
        # conflicts.

        # TODO:  I want to do this with sed only.  Please send a patch if you
        # know a cleaner way.
        roundup_plan=$(
            grep "^it_.*()" $roundup_p           |
            sed "s/\(it_[a-zA-Z0-9_]*\).*$/\1/g"
        )

        # We have the test plan and are in our sandbox with [roundup(5)][r5]
        # defined.  Now we source the plan to bring its tests into scope.
        . ./$roundup_p

        # Output the description signal
        printf "d %s" "$roundup_desc" | tr "\n" " "
        printf "\n"

        for roundup_test_name in $roundup_plan
        do
            # Any number of things are possible in `before`, `after`, and the
            # test.  Drop into an subshell to contain operations that may throw
            # off roundup; such as `cd`.
            (
                # Output `before` trace to temporary file. If `before` runs cleanly,
                # the trace will be overwritten by the actual test case below.
                {
                    # redirect tracing output of `before` into file.
                    {
                        set -x
                        # If `before` wasn't redefined, then this is `:`.
                        before
                    } &>"$roundup_tmp/$roundup_test_name"
                    # disable tracing again. Its trace output goes to /dev/null.
                    set +x
                } &>/dev/null

                # exit subshell with return code of last failing command. This
                # is needed to see the return code 253 on failed assumptions.
                # But, only do this if the error handling is activated.
                set -E
                trap 'rc=$?; set +x; set -o | grep "errexit.*on" >/dev/null && exit $rc' ERR

                # If `before` wasn't redefined, then this is `:`.
                before

                # Momentarily turn off auto-fail to give us access to the tests
                # exit status in `$?` for capturing.
                set +e
                (
                    # Set `-xe` before the test in the subshell.  We want the
                    # test to fail fast to allow for more accurate output of
                    # where things went wrong but not in _our_ process because a
                    # failed test should not immediately fail roundup.  Each
                    # tests trace output is saved in temporary storage.
                    set -xe
                    $roundup_test_name
                ) >"$roundup_tmp/$roundup_test_name" 2>&1

                # We need to capture the exit status before returning the `set
                # -e` mode.  Returning with `set -e` before we capture the exit
                # status will result in `$?` being set with `set`'s status
                # instead.
                roundup_result=$?

                # It's safe to return to normal operation.
                set -e

                # If `after` wasn't redefined, then this runs `:`.
                after

                # This is the final step of a test.  Print its pass/fail signal
                # and name.
                if [ "$roundup_result" -ne 0 ]
                then printf "f"
                else printf "p"
                fi

                printf " $roundup_test_name\n"
            )
        done
    )
done |

# All signals are piped to this for summary.
roundup_summarize
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!71 blocks
openSUSE Build Service is sponsored by