Changeset 840


Ignore:
Timestamp:
04/24/13 19:48:18 (8 years ago)
Author:
olahaye
Message:

[packaging] enhanced Makefile with install rule so it can be used for packaging.
rewrote the spec file for rpm side (removed old spec files).
tarball rules will generate the spec file and iclude it so a rpmbuild -tb can work
started to fix debian build. (still build the old way)

Location:
branches/1.0
Files:
16 added
3 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.0/Makefile

    r834 r840  
    22#
    33TMPDIR = /tmp
     4DESTDIR = /usr/local
    45
    56# Clear this if you don't want to use ${FAKEROOT}
     
    1718REQUIRED = ./jobarchived ./jobmond ./web
    1819
    19 deb:    deb-jobmond deb-jobarchived deb-webfrontend
    20 rpm:    rpm-jobmond rpm-jobarchived rpm-webfrontend
     20deb:    tarball-bzip
     21rpm:    tarball-bzip
    2122
    2223all:    tarball deb rpm
     
    2425tarball:        tarball-gzip tarball-bzip
    2526
    26 tarball-gzip:   ${REQUIRED}
     27tarball-gzip:   ${REQUIRED} rpmspec
    2728        mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
    2829        ( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
     
    3132        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.gz ..
    3233
    33 tarball-bzip:   ${REQUIRED}
     34tarball-bzip:   ${REQUIRED} rpmspec
    3435        mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
    3536        ( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
     
    3738        ( cd ${TMPDIR}/.monarch_buildroot; tar jcvf ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
    3839        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.bz2 ..
     40
     41rpmspec: pkg/rpm/jobmonarch.spec.in
     42        sed -e 's/__VERSION__/$(VERSION)/g' -e 's/__RELEASE__/$(RELEASE)/g' ./pkg/rpm/jobmonarch.spec.in > jobmonarch.spec
     43
     44debpkgdir: pkg/deb/debian
     45        rsync -a --exclude=.svn pkg/deb/debian debian
     46        sed -i -e 's/^Version:.*$//Version: $(VERSION)-$(RELEASE)/g' ./debian/control
     47
     48rpm: tarball-bzip
     49        rpmbuild -tb ../ganglia_jobmonarch-${VERSION}.tar.bz2
     50
     51deb: debpkgdir
     52        dpkg-buildpackage -b
     53
     54install:
     55        # Files in SBIN_DIR
     56        install -m 0755 -d $(DESTDIR)/usr/sbin
     57        install -m 0755 jobmond/jobmond.py $(DESTDIR)/usr/sbin/
     58        install -m 0755 jobarchived/jobarchived.py $(DESTDIR)/usr/sbin/
     59        (cd $(DESTDIR)/usr/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
     60        #
     61        # Files specific to distros if /etc/sysconfig => rpm else (/etc/default => debian)
     62        if test -d /etc/sysconfig; then \
     63                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
     64                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
     65                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
     66                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
     67                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
     68                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
     69        else \
     70                install -m 0755 -d $(DESTDIR)/etc/init.d; \
     71                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
     72                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
     73                install -m 0755 -d $(DESTDIR)/etc/default; \
     74                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
     75                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
     76        fi
     77        #
     78        # Files in /etc
     79        #
     80        install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc; \
     81        install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc; \
     82        #
     83        # Files in /usr/share
     84        #
     85        install -m 0755 -d $(DESTDIR)/usr/share/jobarchived/
     86        install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)/usr/share/jobarchived/
     87        #
     88        # Create the /var/lib/jobarchive directory where rrds are stored.
     89        #
     90        install -m 0755 -d $(DESTDIR)/var/lib/jobarchive/
     91        #
     92        # Files for ganglia (adapt to rpm or deb or unknown ganglia packaging)
     93        #
     94        if test -d /etc/sysconfig; then \
     95                install -m 0755 -d $(DESTDIR)/usr/share/ganglia; \
     96                (cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/usr/share/ganglia); \
     97        elif test -d /etc/default; then \
     98                install -m 0755 -d $(DESTDIR)/usr/share/ganglia-webfrontend; \
     99                (cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/usr/share/ganglia-webfrontend); \
     100        else \
     101                install -m 0755 -d $(DESTDIR)/$(WEBDIR); \
     102                (cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/$(WEBDIR)); \
     103        fi
     104
    39105
    40106deb-webfrontend:        ${REQUIRED}
     
    97163        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}.deb ..
    98164
    99 rpm-jobmond:    ${REQUIRED}
    100         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/init.d >/dev/null
    101         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/sysconfig >/dev/null
    102         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/usr/sbin >/dev/null
    103         install -m 755 jobmond/jobmond.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/usr/sbin
    104         ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/usr/sbin; \
    105         ln -s jobmond.py jobmond || true)
    106         install jobmond/jobmond.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc
    107         install pkg/rpm/init.d/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/init.d
    108         install pkg/rpm/sysconfig/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/etc/sysconfig
    109         cp pkg/rpm/jobmonarch-jobmond.spec \
    110         ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec
    111         ( cd ${TMPDIR}/.monarch_buildroot/; \
    112         cat jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec \
    113         | sed "s/^Buildroot:.*$//Buildroot: \${TMPDIR}\/\.monarch_buildroot\/jobmonarch-jobmond-${VERSION}-${RELEASE}/g" \
    114         | sed "s/^Version:.*$//Version: ${VERSION}/g" \
    115         | sed "s/^Release:.*$//Release: ${RELEASE}/g" \
    116         >jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec.new; \
    117         mv jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec.new \
    118         jobmonarch-jobmond-${VERSION}-${RELEASE}/jobmonarch-jobmond-${VERSION}-${RELEASE}.spec )
    119         ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}; \
    120         ${FAKEROOT} rpmbuild --buildroot=${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE} -bb jobmonarch-jobmond-${VERSION}-${RELEASE}.spec )
    121         mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond-${VERSION}-${RELEASE}.rpm ..
    122 
    123 rpm-jobarchived:        ${REQUIRED}
    124         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/init.d >/dev/null
    125         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/sysconfig >/dev/null
    126         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/sbin >/dev/null
    127         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/share/jobarchived >/dev/null
    128         install -m 755 jobarchived/jobarchived.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/sbin
    129         ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/sbin; \
    130         ln -s jobarchived.py jobarchived || true)
    131         install jobarchived/jobarchived.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc
    132         install pkg/rpm/init.d/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/init.d
    133         install pkg/rpm/sysconfig/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/etc/sysconfig
    134         install jobarchived/job_dbase.sql \
    135         ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/usr/share/jobarchived
    136         cp pkg/rpm/jobmonarch-jobarchived.spec \
    137         ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec
    138         ( cd ${TMPDIR}/.monarch_buildroot/; \
    139         cat jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec \
    140         | sed "s/^Buildroot:.*$//Buildroot: \${TMPDIR}\/\.monarch_buildroot\/jobmonarch-jobarchived-${VERSION}-${RELEASE}/g" \
    141         | sed "s/^Version:.*$//Version: ${VERSION}/g" \
    142         | sed "s/^Release:.*$//Release: ${RELEASE}/g" \
    143         >jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec.new; \
    144         mv jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec.new \
    145         jobmonarch-jobarchived-${VERSION}-${RELEASE}/jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec )
    146         ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}; \
    147         ${FAKEROOT} rpmbuild --buildroot=${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE} -bb jobmonarch-jobarchived-${VERSION}-${RELEASE}.spec )
    148         mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived-${VERSION}-${RELEASE}.rpm ..
    149 
    150 rpm-webfrontend:        ${REQUIRED}
    151         mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}/${WEBDIR} >/dev/null
    152         ( cd web; \
    153         rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
    154         . ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}/${WEBDIR} )
    155         cp pkg/rpm/jobmonarch-webfrontend.spec \
    156         ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec
    157         ( cd ${TMPDIR}/.monarch_buildroot/; \
    158         cat jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec \
    159         | sed "s/^Buildroot:.*$//Buildroot: \${TMPDIR}\/\.monarch_buildroot\/jobmonarch-webfrontend-${VERSION}-${RELEASE}/g" \
    160         | sed "s/^Version:.*$//Version: ${VERSION}/g" \
    161         | sed "s/^Release:.*$//Release: ${RELEASE}/g" \
    162         | sed "s+/var/www/ganglia+${WEBDIR}+g" \
    163         >jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec.new; \
    164         mv jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec.new \
    165         jobmonarch-webfrontend-${VERSION}-${RELEASE}/jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec )
    166         ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}; \
    167         ${FAKEROOT} rpmbuild --buildroot ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE} -bb jobmonarch-webfrontend-${VERSION}-${RELEASE}.spec )
    168         mv ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend-${VERSION}-${RELEASE}.rpm ..
    169 
    170 clean:  ${TMPDIR}/.monarch_buildroot
     165clean:
    171166        rm -rf ${TMPDIR}/.monarch_buildroot
     167        rm -rf ./jobmonarch.spec
     168        rm -rf ./debian
Note: See TracChangeset for help on using the changeset viewer.