#1389 Issue closed: How to make rpm on old distros?

Labels: fixed / solved / done, Dedicated Priority Support

schlomo opened issue at 2017-06-21 06:54:

Trying to make rpm on SLES 10 SP3 ☹. Managed to install git 1.9.3 from some OBS repo (thanks @jsmeix !) but make rpm fails like this:

rearsles10sp3:~/rear # make rpm
rm -fv rear-2.1*.tar.gz rear-2.1*.rpm
removed `rear-2.1-git201706191551.tar.gz'
removed `rear-2.1-1.git201706191551.x86_64.rpm'
rm -f build-stamp
make -C doc clean
make[1]: Entering directory `/root/rear/doc'
rm -f unconv.8 *.html *.xml
make -C user-guide clean
make[2]: Entering directory `/root/rear/doc/user-guide'
rm -f *.html *.svg *.xml
make[2]: Leaving directory `/root/rear/doc/user-guide'
make[1]: Leaving directory `/root/rear/doc'
== Validating scripts and configuration ==
find etc/ usr/share/rear/conf/ -name '*.conf' | xargs -n 1 bash -n
bash -n usr/sbin/rear
find . -name '*.sh' | xargs -n 1 bash -n
find usr/share/rear -name '*.sh' | grep -v -E '(lib|skel|conf)' | while read FILE ; do \
    num=$(echo ${FILE##*/} | cut -c1-3); \
    if [[ "$num" = "000" || "$num" = "999" ]] ; then \
        echo "ERROR: script $FILE may not start with $num"; \
        exit 1; \
    else \
        if $( grep '[_[:alpha:]]' <<< $num >/dev/null 2>&1 ) ; then \
            echo "ERROR: script $FILE must start with 3 digits"; \
            exit 1; \
        fi; \
    fi; \
done
== Prepare manual ==
make -C doc man
make[1]: Entering directory `/root/rear/doc'
make[1]: Nothing to be done for `man'.
make[1]: Leaving directory `/root/rear/doc'
== Rewriting packaging/rpm/rear.spec, packaging/debian/rear.dsc and usr/sbin/rear ==
sed -i.orig \
    -e 's#^Source:.*#Source: https://sourceforge.net/projects/rear/files/rear/2.1/rear-2.1-git201706200937.tar.gz#' \
    -e 's#^Version:.*#Version: 2.1#' \
    -e 's#^%define rpmrelease.*#%define rpmrelease .git201706200937#' \
    -e 's#^%setup.*#%setup -q -n rear-2.1-git201706200937#' \
    packaging/rpm/rear.spec
sed -i.orig \
    -e 's#^Version:.*#Version: 2.1-0git201706200937#' \
    packaging/debian/rear.dsc
sed -i.orig \
    -e 's#^readonly VERSION=.*#readonly VERSION=2.1-git201706200937#' \
    -e 's#^readonly RELEASE_DATE=.*#readonly RELEASE_DATE="2017-06-20"#' \
    usr/sbin/rear
== Building archive rear-2.1-git201706200937 ==
git checkout 
M   packaging/debian/rear.dsc
M   packaging/rpm/rear.spec
M   usr/sbin/rear
Your branch is up-to-date with 'origin/schlomo-2017-06'.
git ls-tree -r --name-only --full-tree  | \
    tar -czf rear-2.1-git201706200937.tar.gz --transform='s,^,rear-2.1-git201706200937/,S' --files-from=-
usage: git ls-tree [<options>] <tree-ish> [<path>...]

    -d                    only show trees
    -r                    recurse into subtrees
    -t                    show trees when recursing
    -z                    terminate entries with NUL byte
    -l, --long            include object size
    --name-only           list only filenames
    --name-status         list only filenames
    --full-name           use full path names
    --full-tree           list entire tree; not just current directory (implies --full-name)
    --abbrev[=<n>]        use <n> digits to display SHA-1s

tar: unrecognized option `--transform=s,^,rear-2.1-git201706200937/,S'
Try `tar --help' or `tar --usage' for more information.
make: *** [rear-2.1-git201706200937.tar.gz] Error 64

Any ideas?

jsmeix commented at 2017-06-21 08:23:

In a git checkout I get:

$ find . | xargs grep 'transform'

./Makefile:             tar -czf $(name)-$(distversion).tar.gz --transform='s,^,$(name)-$(distversion)/,S' --files-from=-

It seems tar in SLE10 is too old for the the '--transform' option
that is used in the Makefile because on my SLES10-SP4 system
"man tar" does not mention the '--transform' option while
it is mentioned in "man tar" on my SLES11 system.

According to the output of

git log -p --follow Makefile

the '--transform' option was introduced in Jun 2012 via
https://github.com/rear/rear/commit/e16dcd2d250036299eb0ac8918355a2ab0780624

gdha commented at 2017-06-21 08:53:

@schlomo @jsmeix Albeit that within OBS the rpms are properly build for SLES10. Reverting the change? Remember SLES 10 is not on our support list anymore, but nobody prevents you to adapt the Makefile for your needs locally.

schlomo commented at 2017-06-21 08:58:

I think that I really would like to see a make srpm option which I can use on my laptop and then build the rpm on the target distro.

Source → Source Package → Binary Package

jsmeix commented at 2017-06-21 09:29:

@gdha
I think building RPMs within the openSUSE Build Service
happens via rear.spec which does not call 'make rpm'
but only 'make install' as far as I see on first glance in rear.spec
https://build.opensuse.org/package/view_file/Archiving:Backup:Rear/rear-2.1/rear.spec?expand=1
and in the build log for SLE10
https://build.opensuse.org/package/live_build_log/Archiving:Backup:Rear/rear-2.1/SLE_10_SDK/i586

schlomo commented at 2017-06-21 09:31:

OBS works because it just does rpmbuild -ba on SLES10. You feed it a ready-made source tar.gz so that the problematic part is already done.

gdha commented at 2017-06-21 09:31:

@jsmeix thanks for pointing this out - I was not aware (anymore) of how it was build.

gdha commented at 2017-06-22 11:30:

@schlomo @jsmeix Would reverting back to using pax bring new issues? Or, would make srpm be a better solution in the end?

schlomo commented at 2017-06-22 11:43:

I'd like to see a make srpm step, that can use all the modern stuff. The make rpm should be based on make srpm.

gdha commented at 2017-06-22 14:33:

@schlomo Whenever you have time please verify the update of the Makefile

schlomo commented at 2017-06-22 19:07:

It works - thanks a lot. Unfortunately with sles10 I had to do rpmbuild from the tar.gz. Sorry for bothering you (although I do think it is cleaner now). Let's work on the development build naming in #1362


[Export of Github issue for rear/rear.]