I have a spec file, which compiles fine without the patch:
build#SLES11SP4-185:~/rpmbuild/SPECS> cat testSoftware.spec
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# norootforbuild
Name: testSoftware
Version: 1.0
Release: 2
Summary: Demo - patch
Group: Deployment
License: GPLv2
Url: www.dell.com
#PreReq:
#Provides:
#BuildRequires:
Source: testSoftware.tar.gz
patch0: test1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: on
%description
Authors:
--------
Raj Kumar
%prep
%setup -q
%build
%install
mkdir -p $RPM_BUILD_ROOT/opt/testSoftware
install test1.sh $RPM_BUILD_ROOT/opt/testSoftware
install test2.sh $RPM_BUILD_ROOT/opt/testSoftware
%patch -P 0
%clean
rm -rf $RPM_BUILD_ROOT
%post
%postun
%files
/opt/testSoftware/test1.sh
/opt/testSoftware/test2.sh
%defattr(-,root,root,0755)
My SOURCES directory has the test1.patch and the *.tar.gz
build#SLES11SP4-185:~/rpmbuild/SOURCES> ls
testSoftware.tar.gz
test1.patch testSoftware-1.0
Here is the test1.patch
build#SLES11SP4-185:~/rpmbuild/SOURCES> cat test1.patch
--- testSoftware-1.0/test1.sh 2016-08-20 04:49:19.000000000 -0400
+++ test1.sh 2016-08-20 05:33:45.000000000 -0400
## -1 +1 ##
-Hello - Test1
+Test1 - Test1 - patch
When i run the spec file, it fails:
build#SLES11SP4-185:~/rpmbuild/SPECS> rpmbuild -bb testSoftware.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.10960
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ cd /home/build/rpmbuild/BUILD
+ rm -rf testSoftware-1.0
+ /usr/bin/gzip -dc /home/build/rpmbuild/SOURCES/testSoftware.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd testSoftware-1.0
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.10960
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ /bin/rm -rf /var/tmp/testSoftware-1.0-build
++ dirname /var/tmp/testSoftware-1.0-build
+ /bin/mkdir -p /var/tmp
+ /bin/mkdir /var/tmp/testSoftware-1.0-build
+ cd testSoftware-1.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.10960
+ umask 022
+ cd /home/build/rpmbuild/BUILD
+ cd testSoftware-1.0
+ mkdir -p /var/tmp/testSoftware-1.0-build/opt/testSoftware
+ install test1.sh /var/tmp/testSoftware-1.0-build/opt/testSoftware
+ install test2.sh /var/tmp/testSoftware-1.0-build/opt/testSoftware
+ %patch -P 0
/var/tmp/rpm-tmp.10960: line 28: fg: no job control
error: Bad exit status from /var/tmp/rpm-tmp.10960 (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.10960 (%install)
Can someone tell me what is the issue?
You can see it is not recognizing the %patch macro and sending that text exactly to the shell, which interprets the % as trying to refer to a background job-control process. That is because %patch is a %build step and is in the wrong section of the specfile (you have it in %install).
Move it to %build and you should be fine.
It works if we apply it after %setup -q.
Below is the modified spec file which works:
Name: testSoftware
Version: 1.0
Release: 2
Summary: Demo - patch
Group: Deployment
License: GPLv2
Url: www.dell.com
#PreReq:
#Provides:
#BuildRequires:
Source: testSoftware.tar.gz
Patch0: test1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: on
%description
Authors:
--------
Raj Kumar
%prep
%setup -q
%patch -p0
%build
%install
mkdir -p $RPM_BUILD_ROOT/opt/testSoftware
install test1.sh $RPM_BUILD_ROOT/opt/testSoftware
install test2.sh $RPM_BUILD_ROOT/opt/testSoftware
%clean
rm -rf $RPM_BUILD_ROOT
Related
I am getting an error when running mpirun:
will#will-MS-7D91:~/WRFHYDRO/Tests/Compatibility$ mpirun ./a.out |& tee comp_test2.txt
C function called by Fortran
Values are xx = 2.00 and ii = 1
Abort(2139535) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Other MPI error, error stack:
MPIR_Init_thread(176)........:
MPID_Init(1538)..............:
MPIDI_OFI_mpi_init_hook(1511):
open_fabric(2565)............:
find_provider(2683)..........: OFI fi_getinfo() failed (ofi_init.c:2683:find_provider:No data available)
I have tested the commands on another computer and it works fine. The commands are this:
echo "Test 2"
mpifort -c 02_fortran+c+netcdf+mpi_f.f
mpicc -c 02_fortran+c+netcdf+mpi_c.c
mpifort 02_fortran+c+netcdf+mpi_f.o \
02_fortran+c+netcdf+mpi_c.o \
-L${NETCDF}/lib -lnetcdff -lnetcdf
mpirun ./a.out |& tee comp_test2.txt
I recently built a new pc, with an MSI Z790 Tomahawk board, Intel-13900K cpu, and 64GB of DDR5 5600mhz RAM. Could this be this issue were one of those things are not compatibile with mpich? Mpich version is 4.0.3.
sudo apt -y update
sudo apt -y upgrade
sudo apt -y install gcc gfortran g++ libtool automake autoconf make m4 default-jre default-jdk csh ksh git python3 python3-dev python2 python2-dev mlocate curl cmake libcurl4-openssl-dev
echo " "
##############################Directory Listing############################
export HOME=`cd;pwd`
mkdir $HOME/WRF
export WRF_FOLDER=$HOME/WRF
cd $WRF_FOLDER/
mkdir Downloads
mkdir WRFPLUS
mkdir WRFDA
mkdir Libs
export DIR=$WRF_FOLDER/Libs
mkdir Libs/grib2
mkdir Libs/NETCDF
mkdir Libs/MPICH
mkdir -p Tests/Environment
mkdir -p Tests/Compatibility
echo " "
#############################Core Management####################################
export CPU_CORE=$(nproc) # number of available threads on system
export CPU_6CORE="6"
export CPU_HALF=$(($CPU_CORE / 2)) #half of availble cores on system
export CPU_HALF_EVEN=$(( $CPU_HALF - ($CPU_HALF % 2) )) #Forces CPU cores to even number to avoid partial core export. ie 7 cores would be 3.5 cores.
if [ $CPU_CORE -le $CPU_6CORE ] #If statement for low core systems. Forces computers to only use 1 core if there are 4 cores or less on the system.
then
export CPU_HALF_EVEN="2"
else
export CPU_HALF_EVEN=$(( $CPU_HALF - ($CPU_HALF % 2) ))
fi
echo "##########################################"
echo "Number of Threads being used $CPU_HALF_EVEN"
echo "##########################################"
echo " "
##############################Downloading Libraries############################
#Force use of ipv4 with -4
cd Downloads
wget -c -4 https://github.com/madler/zlib/archive/refs/tags/v1.2.13.tar.gz
wget -c -4 https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_13_2.tar.gz
wget -c -4 https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.0.tar.gz
wget -c -4 https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.0.tar.gz
wget -c -4 https://github.com/pmodels/mpich/releases/download/v4.0.3/mpich-4.0.3.tar.gz
wget -c -4 https://download.sourceforge.net/libpng/libpng-1.6.39.tar.gz
wget -c -4 https://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.1.zip
wget -c -4 https://sourceforge.net/projects/opengrads/files/grads2/2.2.1.oga.1/Linux%20%2864%20Bits%29/opengrads-2.2.1.oga.1-bundle-x86_64-pc-linux-gnu-glibc_2.17.tar.gz
echo " "
####################################Compilers#####################################
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
export CFLAGS="-fPIC -fPIE -O3"
#IF statement for GNU compiler issue
export GCC_VERSION=$(/usr/bin/gcc -dumpfullversion | awk '{print$1}')
export GFORTRAN_VERSION=$(/usr/bin/gfortran -dumpfullversion | awk '{print$1}')
export GPLUSPLUS_VERSION=$(/usr/bin/g++ -dumpfullversion | awk '{print$1}')
export GCC_VERSION_MAJOR_VERSION=$(echo $GCC_VERSION | awk -F. '{print $1}')
export GFORTRAN_VERSION_MAJOR_VERSION=$(echo $GFORTRAN_VERSION | awk -F. '{print $1}')
export GPLUSPLUS_VERSION_MAJOR_VERSION=$(echo $GPLUSPLUS_VERSION | awk -F. '{print $1}')
export version_10="10"
if [ $GCC_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GFORTRAN_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GPLUSPLUS_VERSION_MAJOR_VERSION -ge $version_10 ]
then
export fallow_argument=-fallow-argument-mismatch
export boz_argument=-fallow-invalid-boz
else
export fallow_argument=
export boz_argument=
fi
export FFLAGS=$fallow_argument
export FCFLAGS=$fallow_argument
echo "##########################################"
echo "FFLAGS = $FFLAGS"
echo "FCFLAGS = $FCFLAGS"
echo "##########################################"
echo " "
#############################zlib############################
#Uncalling compilers due to comfigure issue with zlib1.2.13
#With CC & CXX definied ./configure uses different compiler Flags
cd $WRF_FOLDER/Downloads
tar -xvzf v1.2.13.tar.gz
cd zlib-1.2.13/
./configure --prefix=$DIR/grib2
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install |& tee make.install.log
#make check
echo " "
##############################MPICH############################
#F90= due to compiler issues with mpich install
cd $WRF_FOLDER/Downloads
tar -xvzf mpich-4.0.3.tar.gz
cd mpich-4.0.3/
F90= ./configure --prefix=$DIR/MPICH --with-device=ch3 FFLAGS=$fallow_argument FCFLAGS=$fallow_argument
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install |& tee make.install.log
# make check
export PATH=$DIR/MPICH/bin:$PATH
export MPIFC=$DIR/MPICH/bin/mpifort
export MPIF77=$DIR/MPICH/bin/mpifort
export MPIF90=$DIR/MPICH/bin/mpifort
export MPICC=$DIR/MPICH/bin/mpicc
export MPICXX=$DIR/MPICH/bin/mpicxx
echo " "
#############################libpng############################
cd $WRF_FOLDER/Downloads
export LDFLAGS=-L$DIR/grib2/lib
export CPPFLAGS=-I$DIR/grib2/include
tar -xvzf libpng-1.6.39.tar.gz
cd libpng-1.6.39/
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX ./configure --prefix=$DIR/grib2
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install |& tee make.install.log
#make check
echo " "
#############################JasPer############################
cd $WRF_FOLDER/Downloads
unzip jasper-1.900.1.zip
cd jasper-1.900.1/
./configure --prefix=$DIR/grib2
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX ./configure --prefix=$DIR/grib2
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install |& tee make.install.log
#make check
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include
echo " "
#############################hdf5 library for netcdf4 functionality############################
cd $WRF_FOLDER/Downloads
tar -xvzf hdf5-1_13_2.tar.gz
cd hdf5-hdf5-1_13_2
CC=$MPICC FC=$MPIFC F77=$MPIF77 F90=$MPIF90 CXX=$MPICXX ./configure --prefix=$DIR/grib2 --with-zlib=$DIR/grib2 --enable-hl --enable-fortran
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install |& tee make.install.log
#make check
export HDF5=$DIR/grib2
export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH
echo " "
##############################Install NETCDF C Library############################
cd $WRF_FOLDER/Downloads
tar -xzvf v4.9.0.tar.gz
cd netcdf-c-4.9.0/
export CPPFLAGS=-I$DIR/grib2/include
export LDFLAGS=-L$DIR/grib2/lib
export LIBS="-lhdf5_hl -lhdf5 -lz -lcurl -lgfortran -lgcc -lm -ldl"
CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 ./configure --prefix=$DIR/NETCDF --disable-dap --enable-netcdf-4 --enable-netcdf4 --enable-shared
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install |& tee make.install.log
#make check
export PATH=$DIR/NETCDF/bin:$PATH
export NETCDF=$DIR/NETCDF
echo " "
##############################NetCDF fortran library############################
cd $WRF_FOLDER/Downloads
tar -xvzf v4.6.0.tar.gz
cd netcdf-fortran-4.6.0/
export LD_LIBRARY_PATH=$DIR/NETCDF/lib:$LD_LIBRARY_PATH
export CPPFLAGS="-I$DIR/NETCDF/include -I$DIR/grib2/include"
export LDFLAGS="-L$DIR/NETCDF/lib -L$DIR/grib2/lib"
export LIBS="-lnetcdf -lhdf5_hl -lhdf5 -lz -ldl"
CC=$MPICC FC=$MPIFC CXX=$MPICXX F90=$MPIF90 F77=$MPIF77 ./configure --prefix=$DIR/NETCDF --enable-netcdf-4 --enable-netcdf4 --enable-shared
make -j $CPU_HALF_EVEN
make -j $CPU_HALF_EVEN install |& tee make.install.log
#make check
echo " "
#################################### System Environment Tests ##############
cd $WRF_FOLDER/Downloads
wget -c -4 https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_NETCDF_MPI_tests.tar
wget -c -4 https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_tests.tar
tar -xvf Fortran_C_tests.tar -C $WRF_FOLDER/Tests/Environment
tar -xvf Fortran_C_NETCDF_MPI_tests.tar -C $WRF_FOLDER/Tests/Compatibility
export one="1"
echo " "
############## Testing Environment #####
cd $WRF_FOLDER/Tests/Environment
echo " "
echo " "
echo "Environment Testing "
echo "Test 1"
gfortran TEST_1_fortran_only_fixed.f
./a.out |& tee env_test1.txt
export TEST_PASS=$(grep -w -o -c "SUCCESS" env_test1.txt | awk '{print$1}')
if [ $TEST_PASS -ge 1 ]
then
echo "Enviroment Test 1 Passed"
else
echo "Environment Compiler Test 1 Failed"
exit
fi
read -t 3 -p "I am going to wait for 3 seconds only ..."
echo " "
echo "Test 2"
gfortran TEST_2_fortran_only_free.f90
./a.out |& tee env_test2.txt
export TEST_PASS=$(grep -w -o -c "SUCCESS" env_test2.txt | awk '{print$1}')
if [ $TEST_PASS -ge 1 ]
then
echo "Enviroment Test 2 Passed"
else
echo "Environment Compiler Test 2 Failed"
exit
fi
echo " "
read -t 3 -p "I am going to wait for 3 seconds only ..."
echo " "
echo "Test 3"
gcc TEST_3_c_only.c
./a.out |& tee env_test3.txt
export TEST_PASS=$(grep -w -o -c "SUCCESS" env_test3.txt | awk '{print$1}')
if [ $TEST_PASS -ge 1 ]
then
echo "Enviroment Test 3 Passed"
else
echo "Environment Compiler Test 3 Failed"
exit
fi
echo " "
read -t 3 -p "I am going to wait for 3 seconds only ..."
echo " "
echo "Test 4"
gcc -c -m64 TEST_4_fortran+c_c.c
gfortran -c -m64 TEST_4_fortran+c_f.f90
gfortran -m64 TEST_4_fortran+c_f.o TEST_4_fortran+c_c.o
./a.out |& tee env_test4.txt
export TEST_PASS=$(grep -w -o -c "SUCCESS" env_test4.txt | awk '{print$1}')
if [ $TEST_PASS -ge 1 ]
then
echo "Enviroment Test 4 Passed"
else
echo "Environment Compiler Test 4 Failed"
exit
fi
echo " "
read -t 3 -p "I am going to wait for 3 seconds only ..."
echo " "
############## Testing Environment #####
cd $WRF_FOLDER/Tests/Compatibility
cp ${NETCDF}/include/netcdf.inc .
echo " "
echo " "
echo "Library Compatibility Tests "
echo "Test 1"
gfortran -c 01_fortran+c+netcdf_f.f
gcc -c 01_fortran+c+netcdf_c.c
gfortran 01_fortran+c+netcdf_f.o 01_fortran+c+netcdf_c.o \
-L${NETCDF}/lib -lnetcdff -lnetcdf
./a.out |& tee comp_test1.txt
export TEST_PASS=$(grep -w -o -c "SUCCESS" comp_test1.txt | awk '{print$1}')
if [ $TEST_PASS -ge 1 ]
then
echo "Compatibility Test 1 Passed"
else
echo "Compatibility Compiler Test 1 Failed"
exit
fi
echo " "
read -t 3 -p "I am going to wait for 3 seconds only ..."
echo " "
echo "Test 2"
mpifort -c 02_fortran+c+netcdf+mpi_f.f
mpicc -c 02_fortran+c+netcdf+mpi_c.c
mpifort 02_fortran+c+netcdf+mpi_f.o \
02_fortran+c+netcdf+mpi_c.o \
-L${NETCDF}/lib -lnetcdff -lnetcdf
mpirun ./a.out |& tee comp_test2.txt
So this issue was having the intel mpi program in the $PATH and $LD_LIBRARY_PATH
Once I removed the intel mpi program from the both of those places in .bashrc it fixed the issue.
I am trying to create a RISC-V Linux root filesystem image. I ran the following code:
#!/bin/bash
set -e
. conf/riscv64.config
#
# locate compiler
#
GCC_DIR=$(dirname $(which ${CROSS_COMPILE}gcc))/..
if [ ! -d ${GCC_DIR} ]; then
echo "Cannot locate ${CROSS_COMPILE}gcc"
exit 1
fi
#
# create root filesystem
#
rm -f ${IMAGE_FILE}
dd if=/dev/zero of=${IMAGE_FILE} bs=1M count=${IMAGE_SIZE}
chown ${UID}:${GID} ${IMAGE_FILE}
echo '
o
n
p
1
+200M
n
p
2
t
2
c
p
w
' | fdisk ${IMAGE_FILE} && sudo losetup -P /dev/loop30 ${IMAGE_FILE} && sudo fdisk -l /dev/loop30
sudo mkfs.ext4 -j -F /dev/loop30p1
# /sbin/mkfs.ext4 -j -F ${IMAGE_FILE}
sudo mkfs.vfat -F 32 /dev/loop30p2
test -d mnt || mkdir mnt
# mount -o loop ${IMAGE_FILE} mnt
sudo mount /dev/loop30p1 mnt
set +e
#
# copy libraries, flattening symlink directory structure
#
copy_libs() {
for lib in $1/*.so*; do
if [[ ${lib} =~ (^libgomp.*|^libgfortran.*|.*\.py$) ]]; then
: # continue
elif [[ -e "$2/$(basename $lib)" ]]; then
: # continue
elif [[ -h "$lib" ]]; then
ln -s $(basename $(readlink $lib)) $2/$(basename $lib)
else
cp -a $lib $2/$(basename $lib)
fi
done
}
#
# configure root filesystem
#
(
set -e
# create directories
for dir in root bin dev etc lib lib/modules proc sbin sys mnt tmp \
usr usr/bin usr/sbin var var/run var/log var/tmp \
etc/dropbear \
etc/network/if-pre-up.d \
etc/network/if-up.d \
etc/network/if-down.d \
etc/network/if-post-down.d
do
mkdir -p mnt/${dir}
done
touch mnt/mnt/please_mount_vda2
# copy busybox and dropbear
cp build/busybox-${BUSYBOX_VERSION}/busybox mnt/bin/
cp build/dropbear-${DROPBEAR_VERSION}/scp mnt/bin/
cp build/dropbear-${DROPBEAR_VERSION}/dbclient mnt/usr/bin/
cp build/dropbear-${DROPBEAR_VERSION}/dropbear mnt/sbin/
# copy libraries
if [ -d ${GCC_DIR}/sysroot/usr/lib${ARCH/riscv/}/${ABI}/ ]; then
ABI_DIR=lib${ARCH/riscv/}/${ABI}
else
ABI_DIR=lib
fi
LDSO_NAME=ld-linux-${ARCH}-${ABI}.so.1
LDSO_TARGET=$(readlink ${GCC_DIR}/sysroot/lib/${LDSO_NAME})
mkdir -p mnt/${ABI_DIR}/
copy_libs $(dirname ${GCC_DIR}/sysroot/lib/${LDSO_TARGET})/ mnt/${ABI_DIR}/
copy_libs ${GCC_DIR}/sysroot/usr/${ABI_DIR}/ mnt/${ABI_DIR}/
if [ ! -e mnt/lib/${LDSO_NAME} ]; then
ln -s /${ABI_DIR}/$(basename ${LDSO_TARGET}) mnt/lib/${LDSO_NAME}
fi
# final configuration
rsync -a etc/ mnt/etc/
hash=$(openssl passwd -1 -salt xyzzy ${ROOT_PASSWORD})
sed -i'' "s:\*:${hash}:" mnt/etc/shadow
chmod 600 mnt/etc/shadow
touch mnt/var/log/lastlog
touch mnt/var/log/wtmp
ln -s ../bin/busybox mnt/sbin/init
ln -s busybox mnt/bin/sh
cp bin/ldd mnt/bin/ldd
mknod mnt/dev/console c 5 1
mknod mnt/dev/ttyS0 c 4 64
mknod mnt/dev/null c 1 3
)
#
# remove if configure failed
#
if [[ $? -ne 0 ]]; then
echo "*** failed to create ${IMAGE_FILE}"
rm -f ${IMAGE_FILE}
else
echo "+++ successfully created ${IMAGE_FILE}"
ls -l ${IMAGE_FILE}
fi
#
# finish
#
sudo sync
sudo umount mnt
sudo losetup -d /dev/loop30
rmdir mnt
The code stuck at
LDSO_TARGET=$(readlink ${GCC_DIR}/sysroot/lib/${LDSO_NAME}).
There is nothing print out when I ran this command in my terminal.
The LDSO_NAME is ld-linux-riscv64-lp64d.so.1 .
Is there anyone know how to fix it? How to make the following code run and successfully create a IMAGE_FILE = riscv64-rootfs.bin
And what is LDSO_NAME and LDSO_TARGET, what are they used for?
When I do
rpmbuild -bi ~/rpmbuild/SPECS/microemacs.spec
The result is
>g++ -g -I. -I../src basic.o bind.o buffer.o char.o crypt.o display.o eval.o exec.o file.o
> fileio.o input.o isearch.o line.o main.o malloc.o mouse.o msdir.o random.o region.o search.o
> sinc.o tag.o window.o word.o map.o unix.o terminal.o lock.o -o microemacs
>
>+ exit 0
> Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.dzYbvW
> + umask 022
> + cd /home/<redacted>/rpmbuild/BUILD
> + '[' /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64 '!=' / ']'
> + rm -rf /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64
> ++ dirname /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64
> + mkdir -p /home/<redacted>/rpmbuild/BUILDROOT
> + mkdir /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64
> + cd microemacs-2.9
> + echo /home/<redacted>/rpmbuild/BUILD/unix
> /home/<redacted>/rpmbuild/BUILD/unix
> + cd /home/<redacted>/rpmbuild/BUILD/microemacs-2.9
> + cd unix
> + cp microemacs /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/
> + cp ../macros/.emacsrc /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/
> + cp ../src/microemacs.md /home/<redacted>/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/
> + /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /home/smit_pet/rpmbuild/BUILD/microemacs-2.9
> extracting debug info from /home/smit_pet/rpmbuild/BUILDROOT/microemacs-2.9-0.x86_64/microemacs
> dwz: Too few files for multifile optimization
> /usr/lib/rpm/sepdebugcrcfix: Updated 1 CRC32s, 0 CRC32s did match.
> 1019 blocks
> + /usr/lib/rpm/check-buildroot
> + /usr/lib/rpm/redhat/brp-compress
> + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
> + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
> + /usr/lib/rpm/redhat/brp-python-hardlink
> + /usr/lib/rpm/redhat/brp-java-repack-jars
> Processing files: microemacs-2.9-0.x86_64
> error: File must begin with "/": microemacs
> error: File must begin with "/": .emacsrc
> error: File must begin with "/": microemacs.md
>
> RPM build errors:
> File must begin with "/": microemacs
> File must begin with "/": .emacsrc
> File must begin with "/": microemacs.md
I do not understand how the distinction between BUILD BUILDROOT or how the results get to the target and how %file features in this.
Also why the /usr/lib action and why and how is this happening?
I want the results to end up in ~/bin/ and I can do this with a manual copy in %install but I think this is not the correct way.
Also nothing prints Hello.
The .spec file is
> SPECS/microemacs.spec
> Name: microemacs
> %define version 2.9
> Version: %{version}
> Release: 0
> Summary: Microemacs program code editor
> Group: Applications/Development
> License: GPL 3.0 License
> URL: .
> Vendor: .
> Source: microemacs-%{version}.tar.gz
> Prefix: %{_prefix}
> Packager: .
> BuildRoot: %{_tmppath}/%{name}-root
>
> %description
> A text editor suporting
> + Piping input into it.
> + Editting Directories and their contents.
> + Taking text from the buffer into the command line
>
> %prep
>
> %setup -q
>
> %build
> echo Hello
> pwd
> cd ./unix
> make
>
> %install
> echo %{_builddir}/unix
> cd %{_builddir}/microemacs-%{version}
> cd unix
> cp microemacs %{buildroot}/
> cp ../macros/.emacsrc %{buildroot}/
> cp ../src/microemacs.md %{buildroot}/
>
> %clean
> cd ${_builddir}/microemacs-%{version}/unix
> make clean
>
> %files
> %defattr(-,root,root)
> microemacs
> .emacsrc
> microemacs.md
The %buildroot during the %install phase is directory where you create the layout of target. I.e., how it will be stored in final rpm.
When you have:
%install
cp microemacs %{buildroot}/
then you have to have
%files
/microemacs
But you likely want to have:
%install
cp -a microemacs %{buildroot}%{_bindir}/microemacs
%files
%{_bindir}/microemacs
%doc microemacs.md
This will place the microemacs to /usr/bin and microemacs.md to /usr/share/doc - no need to cp microemacs.md there during %install as the %doc macro will take care of it.
Running automation tests on our CI. Currently, we are retrieving the latest versions of Chrome and Firefox as part of our setup, however, the versions of chromedriver and geckodriver we use are hardcoded because there seems to be no link to the latest version.
Ex. here is the line that downloads the latest firefox version
wget -nv -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64"
While here is the line that downloads a specific version of geckodriver
wget -nv -O ~/geckodriver.tar.gz "https://github.com/mozilla/geckodriver/releases/download/v0.29.1/geckodriver-v0.29.1-linux64.tar.gz"
Is there anyway to always get the latest chromedriver and geckodriver?
Check if this gist helps, at least for chromedriver:
version=$(curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
download_location= " http://chromedriver.storage.googleapis.com/ $version /chromedriver_linux64.zip "
rm /tmp/chromedriver_linux64.zip
wget -P /tmp $download_location
unzip /tmp/chromedriver_linux64.zip -d .
mv ./chromedriver ./chromedriver.linux
chmod u+x ./chromedriver.linux
Same idea for geckodriver:
install_dir= " /usr/local/bin "
json= $( curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest )
if [[ $( uname ) == " Darwin " ]] ; then
url= $( echo " $json " | jq -r ' .assets[].browser_download_url | select(contains("maces")) ' )
elif [[ $( uname ) == " Linux " ]] ; then
url= $( echo " $json " | jq -r ' .assets[].browser_download_url | select(contains("linux64")) ' )
else
echo " can't determine OS "
exit 1
fi
curl -s -L " $url " | tar -xz
chmod +x geckodriver
sudo mv geckodriver " $install_dir "
I've hit a wall trying to understand why the ${name}_chdir variable is not working for me. Finally, after letting my script run with -xv, I see that the cd command is not even being run in my case. Here is my script:
#!/bin/sh
set -xv
exec 1>/tmp/awning.rclog 2>&1
# REQUIRE: NETWORKING LOGIN DAEMON
# KEYWORD: shutdown
. /etc/rc.subr
name="awning"
rcvar="awning_enable"
awning_chdir="/usr/sbin/awning"
pidfile="/var/run/awningd.pid"
procname="daemon"
# -f flag is to redirect stdin/stdout/stderr to /dev/null to prevent node from crashing
# on system-startup
start_cmd="/usr/sbin/daemon -r -P ${pidfile} -f -u pierre /usr/sbin/awning/intro.js"
command="/usr/sbin/daemon -r -P ${pidfile} -f -u pierre /usr/sbin/awning/intro.js"
load_rc_config $name
run_rc_command "$1"
At first I was only using start_cmd, but then I read in rc.subr the following:
${name}_chdir
Directory to cd to before running _command_, if
${name}_chroot is not provided.
so I thought maybe things were getting mixed up, so i added the command=.... bit, and removed the start_cmd=.... line, and still no success. Here's the relevant "doit" portion of the output which was saved from running the script with -xv:
+ _chdir=/usr/sbin/awning _chroot='' _nice='' _user='' _group='' _groups='' _fib='' _env='' _prepend='' _login_class=daemon _oomprotect=''
+ [ -n '' ]
+ [ -z yes ]
+ [ start '!=' start ]
+ [ -n awning_enable -a start '!=' rcvar -a start '!=' stop -a start '!=' describe ]
+ checkyesno awning_enable
+ eval '_value=$awning_enable'
+ _value=YES
+ debug 'checkyesno: awning_enable is set to YES.'
+ return 0
+ [ start '=' start -a -z yes -a -n '' ]
+ eval '_cmd=$start_cmd' '_precmd=$start_precmd' '_postcmd=$start_postcmd'
+ _cmd='/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js' _precmd='' _postcmd=''
+ [ -n '/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js' ]
+ _run_rc_precmd
+ check_required_before start
+ local _f
+ return 0
+ [ -n '' ]
+ check_required_after start
+ local _f _args
+ return 0
+ return 0
+ _run_rc_doit '/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js '
+ debug 'run_rc_command: doit: /usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js '
+ eval '/usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js '
+ /usr/sbin/daemon -r -P /var/run/awningd.pid -f -u pierre /usr/sbin/awning/intro.js
+ _return=0
+ [ 0 -ne 0 ]
+ return 0
+ _run_rc_postcmd
+ [ -n '' ]
+ return 0
+ return 0
_chdir is being set properly, but it's never used for anything. Honestly it looks like those variables (_chdir, _chroot, etc) should actually be awning_chdir, awning_chroot, etc...
What could be going on?
I'm running version 11.0-RELEASE-p2
After stepping through /etc/rc.subr, I learned (the hard way) that command= needs to literally be a single command. There's a test done on it ([ ! -x $command ]) which fails even for a command with options and no arguments. I had to split apart the options I was passing daemon, and its single argument /usr/sbin/awning/intro.js into a separate variable: command_args=, which solved the issue.