[pacman-dev] [PATCH] makepkg: Log commands to logfile

Alain Kalker a.c.kalker at gmail.com
Tue Jul 2 20:15:32 EDT 2013


On 07/03/2013 01:45 AM, Alain Kalker wrote:
> On 07/02/2013 11:07 PM, Dave Reisner wrote:
>> You make zero mention of makepkg or any external build tool in that 
>> environment. I'm not sure how you expect anyone to pick up your veil 
>> and dispute your method of compilation. Quite frankly, this is rude 
>> of you, regardless of whether or not makepkg is at fault. 
> Please take this kind of musdlinging somewhere else, IRC, 4chan, a 
> muddy beach, or whatever.
>
> My final try at proving my point is the following script: it takes a 
> logfile from makepkg -L (with my patch applied), and an optional 
> makepkg.conf file (defaulting to /etc/makepkg), then generates a 
> script containing selected environment variables from the configfile, 
> followed by a replay of all commands executed during the build or 
> package phase (determined by the name of the logfile.
> Script is self-documenting, but here is the gist of how to use it for 
> TL;DR:
Here is an example script generated for the example logfile (for RRTL;DR:)
---[file: clean-build.sh]---
#!/bin/bash

# replay-build.sh - Replay commands from a makepkg logfile

# This script was created using the following configuration:
# Log file: libxcb-1.9.1-1-x86_64-build.log
# Build settings: /etc/makepkg.conf
# Debug build: no

# Example usage:

# $ cd <directory containing PKGBUILD>
# $ rm -rf pkg src
# $ mkdir pkg src
# $ makepkg -o
#
# Do a clean build or install
# $ cd src/<top of source tree>
# $ ../../replay-build.sh 2>&1 | tee 
../../libxcb-1.9.1-1-x86_64-build.log.clean
#
# Then compare the logs
# $ cd ../..
# $ diff -u libxcb-1.9.1-1-x86_64-build.log{,.clean}

# Set up environment
export CPPFLAGS="-D_FORTIFY_SOURCE=2"
export CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector 
--param=ssp-buffer-size=4"
export CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe 
-fstack-protector --param=ssp-buffer-size=4"
export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"

# Set up command logging
restoreps4=$PS4
PS4='$ '
set -x

# Replay commands from logfile
cd /home/miki/pkg/abs/extra/libxcb/src/libxcb-1.9.1
patch -Np1 -i 
/home/miki/pkg/abs/extra/libxcb/src/libxcb-1.1-no-pthread-stubs.patch
patch -Np1 -i 
/home/miki/pkg/abs/extra/libxcb/src/libxcb-1.9.1-configure-ac-reorder.patch
./autogen.sh --prefix=/usr --enable-xinput --enable-xkb --disable-static
make

# Restore command logging
set +x
PS4=
---[end: clean-build.sh]---

Clean, concise, easily adaptable for submission upstream, methinks.

Kind regards, Alain


More information about the pacman-dev mailing list