apache / apache/couchdb

Support deterministic builds

Open
#4,580 1 comment 0 reactions 0 assignees View on GitHub
bug enhancement
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

[NOTE]: # ( ^^ Provide a general summary of the request in the title above. ^^ )

## Summary

Prepare couchdb to support deterministic builds.

## Desired Behaviour

For same use cases [deterministic build](https://reproducible-builds.org/docs/deterministic-build-systems/) is necessary. Erlang 25 supports that via [compile flags](https://github.com/erlang/otp/pull/5965) like:

```
export ERL_COMPILER_OPTIONS="deterministic"
```

In fact, when setting ERL_COMPILER_OPTIONS to `deterministic` the couchdb build as expected. However a few things should be fixed:

```
WARNING: couchdb-3.3.2-r0 do_package_qa: QA Issue: File /opt/couchdb/lib/couch-3.3.2/priv/couch_js/86/util.d in package couchdb contains reference to TMPDIR
File /opt/couchdb/lib/couch-3.3.2/priv/couch_js/86/main.d in package couchdb contains reference to TMPDIR
File /opt/couchdb/lib/couch-3.3.2/priv/couch_ejson_compare/couch_ejson_compare.d in package couchdb contains reference to TMPDIR
File /opt/couchdb/releases/RELEASES in package couchdb contains reference to TMPDIR [buildpaths]
```

I'm building couchdb using Yocto Project and there is a quality assurance step which verifies if all installed files do not have references to the build host paths. It looks like the file: _/opt/couchdb/releases/RELEASES_ has some build paths inside the file.

The Makefile says to install the output from rel/couchdb into the destination folder:

```
# target: install- install CouchDB :)
install: release
@echo
@echo "Notice: There is no 'make install' command for CouchDB 2.x+."
@echo
@echo " To install CouchDB into your system, copy the rel/couchdb"
@echo " to your desired installation location. For example:"
@echo " cp -r rel/couchdb /usr/local/lib"
```

But installing everything from rel/couchdb also brings some compilation files (.d, .o), I think these files is not necessary to be installed:

```
File /opt/couchdb/lib/couch-3.3.2/priv/couch_js/86/main.d in package couchdb contains reference to TMPDIR
File /opt/couchdb/lib/couch-3.3.2/priv/couch_ejson_compare/couch_ejson_compare.d in package couchdb contains reference to TMPDIR
```

Contributor guide

Open the contributing guide

Research direction

Start with the Makefile's install target and the rel/couchdb output described in the issue. Inspect releases/RELEASES and the couch_js/86 and couch_ejson_compare files for TMPDIR references; done means deterministic builds complete without those references and unnecessary .d or .o files are not installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.