Code Monkey home page Code Monkey logo

Comments (12)

Natolumin avatar Natolumin commented on May 31, 2024 1

I have also made a specfile for EL7 and fedora (basically redhat systems with systemd): https://gist.github.com/Natolumin/9f18aee5c911f763b9ac

The patch file that comes with it is commit 855bd46 (with a workaround for #44) which was not included in the 1.3 release. It should be dropped, as well as lines 9 and 22 of the specfile when building from master or the next tagged release

I unfortunately do not have a redhat system without systemd to make a specfile for previous systems, but since this issue is now two years old, maybe it is not so necessary ?

from postsrsd.

timeos avatar timeos commented on May 31, 2024

And here is the corresponding files and directory locations in builded RPM package:
$ rpm -qpl /root/rpmbuild/RPMS/x86_64/postsrsd-0.1-3.el6.x86_64.rpm
/etc/default/postsrsd
/etc/rc.d/init.d/postsrsd
/usr/sbin/postsrsd
/usr/share/doc/postsrsd-0.1
/usr/share/doc/postsrsd-0.1/README.md
/usr/share/doc/postsrsd-0.1/main.cf.ex
/var/lib/postsrsd

from postsrsd.

timeos avatar timeos commented on May 31, 2024

Also I am thinking about moving postsrsd.default directly into /etc/sysconfig directory which have same purpose on RH as the /etc/default directory on debian-like distros. --> http://pastebin.com/pe0AhtQ9

from postsrsd.

roehling avatar roehling commented on May 31, 2024

Nice work, thanks! Just two things:

  1. The current version is of the Ubuntu package is 1.1 (see branch ppa). I added tags to the master branch for that now.
  2. It would be nice if the RPM script used make install, because this makes it less likely to break if I should change stuff in the future. Look in the debian/rules file in the ppa branch to see how you can configure the installation prefix and other stuff. I added the -DCONFIG_DIR flag to support /etc/sysconfig for the config file (e33d892)

from postsrsd.

timeos avatar timeos commented on May 31, 2024

It would be nice if the RPM script used make install,

I would do that too, but because of cmake error in postinstall script (described in first post) there is no chance to use it on redhat systems (current distribution cmake just does not support file permission option within file()). Yes, I can involve external patch for excluding "FILE_PERMISSIONS OWNER_READ OWNER_WRITE" string from postinstall script and do it using RPM postinstall section manually, but this is more dirty way than using custom installation.
The second reason for custom installation is documentation hierarchy. You are using: "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}", but on redhat's the directory should be: "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}-${VERSION}" like from my second post.

because this makes it less likely to break if I should change stuff in the future

yes, indeed. but I am not sure if we can overcome cmake limitation. Or do you have any other idea?

latest RPM spec file according your changes: http://pastebin.com/mm6rCKrw

from postsrsd.

roehling avatar roehling commented on May 31, 2024

I will add another config variable for the documentation dir (-DDOC_DIR=xxx), and I will look into a way to fix the CMake problem for the file permissions.

However, it occured to me that you should disable the secret generation at compile time anyway (use -DGENERATE_SRS_SECRET=OFF), because it will be generated in the %pre install section if needed and should not be packaged at all.

from postsrsd.

roehling avatar roehling commented on May 31, 2024

Does that work?

https://gist.github.com/roehling/8872807

from postsrsd.

timeos avatar timeos commented on May 31, 2024

not really, the "make install" pushes all installed files directly to system. This results that the files were not found by builder:

$ rpmbuild -bb postsrsd_2.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.95Kpb1

  • umask 022
  • cd /root/rpmbuild/BUILD
  • LANG=C
  • export LANG
  • unset DISPLAY
  • cd /root/rpmbuild/BUILD
  • rm -rf postsrsd-1.1
  • /usr/bin/gzip -dc /root/rpmbuild/SOURCES/postsrsd-1.1.tar.gz
  • /bin/tar -xf -
  • STATUS=0
  • '[' 0 -ne 0 ']'
  • cd postsrsd-1.1
  • /bin/chmod -Rf a+rX,u+w,g-w,o-w .
  • exit 0
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.sKiryP
  • umask 022
  • cd /root/rpmbuild/BUILD
  • cd postsrsd-1.1
  • LANG=C
  • export LANG
  • unset DISPLAY
  • /bin/rm makefile
  • cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DINIT_FLAVOR=sysv-redhat -DGENERATE_SRS_SECRET=OFF -DSYSCONF_DIR=/etc -DCONFIG_DIR=/etc/sysconfig -DCHROOT_DIR=/var/lib/postsrsd -DDOC_DIR=/usr/share/doc/postsrsd-1.1
    -- The C compiler identification is GNU
    -- Check for working C compiler: /usr/bin/gcc
    -- Check for working C compiler: /usr/bin/gcc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /root/rpmbuild/BUILD/postsrsd-1.1
  • make -j4
    Scanning dependencies of target postsrsd
    [ 33%] [100%] [100%] Building C object CMakeFiles/postsrsd.dir/postsrsd.o
    Building C object CMakeFiles/postsrsd.dir/sha1.o
    Building C object CMakeFiles/postsrsd.dir/srs2.o
    Linking C executable postsrsd
    [100%] Built target postsrsd
  • exit 0
    Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.KeBWZG
  • umask 022
  • cd /root/rpmbuild/BUILD
  • '[' /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64 '!=' / ']'
  • rm -rf /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64
    ++ dirname /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64
  • mkdir -p /root/rpmbuild/BUILDROOT
  • mkdir /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64
  • cd postsrsd-1.1
  • LANG=C
  • export LANG
  • unset DISPLAY
  • make install
    [100%] Built target postsrsd
    Install the project...
    -- Install configuration: "Release"
    -- Installing: /usr/sbin/postsrsd
    -- Up-to-date: /usr/share/doc/postsrsd/README.md
    -- Up-to-date: /usr/share/doc/postsrsd/main.cf.ex
    -- Chroot jail: /var/lib/postsrsd
    -- Installing: /etc/sysconfig/postsrsd
    -- Installing: /etc/init.d/postsrsd
  • /usr/lib/rpm/find-debuginfo.sh --strict-build-id /root/rpmbuild/BUILD/postsrsd-1.1
  • /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/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
  • /usr/lib/rpm/brp-python-bytecompile
  • /usr/lib/rpm/redhat/brp-python-hardlink
  • /usr/lib/rpm/redhat/brp-java-repack-jars
    Processing files: postsrsd-1.1-1.el6.x86_64
    error: File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/rc.d/init.d/postsrsd
    error: File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/sbin/postsrsd
    error: File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/sysconfig/postsrsd
    error: File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/var/lib/postsrsd
    error: File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/var/lib/postsrsd
    Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.7GdDdz
  • umask 022
  • cd /root/rpmbuild/BUILD
  • cd postsrsd-1.1
  • DOCDIR=/root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • export DOCDIR
  • rm -rf /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • /bin/mkdir -p /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • cp -pr README.md main.cf.ex /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • exit 0

RPM build errors:
File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/rc.d/init.d/postsrsd
File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/sbin/postsrsd
File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/sysconfig/postsrsd
File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/var/lib/postsrsd
File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/var/lib/postsrsd

if you really wanted to use "make install", the DESTIR parameter should be passed to "make install" within SPEC file like this:

%install
make install DESTDIR=%{buildroot}

and of course this parameter should be used by your installer in order to use DESTDIR instead of "/" directory while installing files.
the point of building packages on redhat is that there are two main directories used during build process:

  • first is the BUILD directory, where all source files are extracted and processed (like compiling and so on). In *.spec file this directory is as the working directory - i.e. no need to define any prefix type if you wanted to get any file from source
  • the second BUILDROOT directory, which represents resulted tree of directories and files which should be a part of created rpm package. to reach this directory the %{buildroot} variable can be used.

hope this helps.

from postsrsd.

roehling avatar roehling commented on May 31, 2024

Of course, I forgot to add DESTDIR to the %install stanza. It's fixed now. Anything else? Once you give your okay, I will commit it to the repository.

from postsrsd.

timeos avatar timeos commented on May 31, 2024

it is better now, just one failure while installing init script:

$ rpmbuild -bb postsrsd_2.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.W077Tc

  • umask 022
  • cd /root/rpmbuild/BUILD
  • LANG=C
  • export LANG
  • unset DISPLAY
  • cd /root/rpmbuild/BUILD
  • rm -rf postsrsd-1.1
  • /usr/bin/gzip -dc /root/rpmbuild/SOURCES/postsrsd-1.1.tar.gz
  • /bin/tar -xf -
  • STATUS=0
  • '[' 0 -ne 0 ']'
  • cd postsrsd-1.1
  • /bin/chmod -Rf a+rX,u+w,g-w,o-w .
  • exit 0
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.r6leAy
  • umask 022
  • cd /root/rpmbuild/BUILD
  • cd postsrsd-1.1
  • LANG=C
  • export LANG
  • unset DISPLAY
  • /bin/rm makefile
  • cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DINIT_FLAVOR=sysv-redhat -DGENERATE_SRS_SECRET=OFF -DSYSCONF_DIR=/etc -DCONFIG_DIR=/etc/sysconfig -DCHROOT_DIR=/var/lib/postsrsd -DDOC_DIR=/usr/share/doc/postsrsd-1.1
    -- The C compiler identification is GNU
    -- Check for working C compiler: /usr/bin/gcc
    -- Check for working C compiler: /usr/bin/gcc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /root/rpmbuild/BUILD/postsrsd-1.1
  • make -j4
    Scanning dependencies of target postsrsd
    [ 33%] [ 66%] [100%] Building C object CMakeFiles/postsrsd.dir/postsrsd.o
    Building C object CMakeFiles/postsrsd.dir/sha1.o
    Building C object CMakeFiles/postsrsd.dir/srs2.o
    Linking C executable postsrsd
    [100%] Built target postsrsd
  • exit 0
    Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.fRwsiX
  • umask 022
  • cd /root/rpmbuild/BUILD
  • '[' /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64 '!=' / ']'
  • rm -rf /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64
    ++ dirname /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64
  • mkdir -p /root/rpmbuild/BUILDROOT
  • mkdir /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64
  • cd postsrsd-1.1
  • LANG=C
  • export LANG
  • unset DISPLAY
  • make install DESTDIR=/root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64
    [100%] Built target postsrsd
    Install the project...
    -- Install configuration: "Release"
    -- Installing: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/sbin/postsrsd
    -- Installing: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd/README.md
    -- Installing: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd/main.cf.ex
    -- Chroot jail: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/var/lib/postsrsd
    -- Installing: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/sysconfig/postsrsd
    -- Installing: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/init.d/postsrsd
    error reading information on service postsrsd: No such file or directory
  • /usr/lib/rpm/find-debuginfo.sh --strict-build-id /root/rpmbuild/BUILD/postsrsd-1.1
    extracting debug info from /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/sbin/postsrsd
  • /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/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
  • /usr/lib/rpm/brp-python-bytecompile
  • /usr/lib/rpm/redhat/brp-python-hardlink
  • /usr/lib/rpm/redhat/brp-java-repack-jars
    Processing files: postsrsd-1.1-1.el6.x86_64
    error: File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/rc.d/init.d/postsrsd
    Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.snV7So
  • umask 022
  • cd /root/rpmbuild/BUILD
  • cd postsrsd-1.1
  • DOCDIR=/root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • export DOCDIR
  • rm -rf /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • /bin/mkdir -p /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • cp -pr README.md main.cf.ex /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/usr/share/doc/postsrsd-1.1
  • exit 0

RPM build errors:
File not found: /root/rpmbuild/BUILDROOT/postsrsd-1.1-1.el6.x86_64/etc/rc.d/init.d/postsrsd

from postsrsd.

timeos avatar timeos commented on May 31, 2024

looks like initscript directory problem? "/etc/rc.d/init.d" vs. "/etc/init.d". or something else? I am unsure now

from postsrsd.

roehling avatar roehling commented on May 31, 2024

Closing this issue, since it seems to be stale. Feel free to reopen.

from postsrsd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.