Changes between Version 1 and Version 2 of BufferExample


Ignore:
Timestamp:
May 30, 2008, 2:36:46 AM (12 years ago)
Author:
Bruno Cornec
Comment:

example with patch needed

Legend:

Unmodified
Added
Removed
Modified
  • BufferExample

    v1 v2  
    1111Once done, ask pb to generate its structure, jst giving the name of the project (-p) and the release you're packaging (-r):
    1212{{{
    13 pb -p buffer -r 1.19 newproj
     13pb -p buffer -r 1.19 newproj buffer
    1414Adding /users/bruno/pb/projects/buffer to SVN... A         /users/bruno/pb/projects/buffer
    1515OK
     
    1919A         /users/bruno/pb/projects/buffer/pbconf/1.19
    2020A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer.pb
    21 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1
    22 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/rpm
    23 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/rpm/pkg1.spec
    24 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb
    25 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb/changelog
    26 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb/control
    27 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb/pkg1.dirs
    28 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb/pkg1.docs
    29 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb/compat
    30 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb/rules
    31 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/deb/copyright
    32 A         /users/bruno/pb/projects/buffer/pbconf/1.19/pkg1/pbfilter
     21A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer
     22A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/rpm
     23A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/rpm/buffer.spec
     24A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb
     25A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb/changelog
     26A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb/control
     27A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb/buffer.dirs
     28A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb/buffer.docs
     29A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb/compat
     30A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb/rules
     31A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/deb/copyright
     32A         /users/bruno/pb/projects/buffer/pbconf/1.19/buffer/pbfilter
    3333A         /users/bruno/pb/projects/buffer/pbconf/1.19/pbfilter
    3434A         /users/bruno/pb/projects/buffer/pbconf/1.19/pbfilter/novell.pbf
     
    5050Ajout          buffer/pbconf/1.19/pbfilter/novell.pbf
    5151Ajout          buffer/pbconf/1.19/pbfilter/rpm.pbf
    52 Ajout          buffer/pbconf/1.19/pkg1
    53 Ajout          buffer/pbconf/1.19/pkg1/deb
    54 Ajout          buffer/pbconf/1.19/pkg1/deb/changelog
    55 Ajout          buffer/pbconf/1.19/pkg1/deb/compat
    56 Ajout          buffer/pbconf/1.19/pkg1/deb/control
    57 Ajout          buffer/pbconf/1.19/pkg1/deb/copyright
    58 Ajout          buffer/pbconf/1.19/pkg1/deb/pkg1.dirs
    59 Ajout          buffer/pbconf/1.19/pkg1/deb/pkg1.docs
    60 Ajout          buffer/pbconf/1.19/pkg1/deb/rules
    61 Ajout          buffer/pbconf/1.19/pkg1/pbfilter
    62 Ajout          buffer/pbconf/1.19/pkg1/rpm
    63 Ajout          buffer/pbconf/1.19/pkg1/rpm/pkg1.spec
     52Ajout          buffer/pbconf/1.19/buffer
     53Ajout          buffer/pbconf/1.19/buffer/deb
     54Ajout          buffer/pbconf/1.19/buffer/deb/changelog
     55Ajout          buffer/pbconf/1.19/buffer/deb/compat
     56Ajout          buffer/pbconf/1.19/buffer/deb/control
     57Ajout          buffer/pbconf/1.19/buffer/deb/copyright
     58Ajout          buffer/pbconf/1.19/buffer/deb/buffer.dirs
     59Ajout          buffer/pbconf/1.19/buffer/deb/buffer.docs
     60Ajout          buffer/pbconf/1.19/buffer/deb/rules
     61Ajout          buffer/pbconf/1.19/buffer/pbfilter
     62Ajout          buffer/pbconf/1.19/buffer/rpm
     63Ajout          buffer/pbconf/1.19/buffer/rpm/pkg1.spec
    6464Transmission des données ..............
    6565Révision 457 propagée.
     
    7171}}}
    7272
    73 Now you "just" need to edit those configuration files to review them and prepare your build of packages.
     73Now you "just" need to edit those configuration files to review them and prepare your build of packages. Begining with the first one, the project's conf file:
    7474{{{
    7575grep -Ev '^#|^$' buffer/pbconf/1.19/buffer.pb
     
    9090pbrepo indicates where the resulting packages will be available for download. pbwf indicates whether the tar file is well-formed (it should contain a directory with name-verion). The ssh* variables indicates where will packages be uploaded at the end of the build. And the name of the directory for defpkgdir is not important as we do not dal with a local CMS.
    9191
     92We also need to adapt the filter a bit:
     93{{{
     94grep -Ev '^#|^$' buffer/pbconf/1.19/pbfilter/*
     95buffer/pbconf/1.19/pbfilter/all.pbf:filter PBREPO = $pbrepo
     96buffer/pbconf/1.19/pbfilter/all.pbf:filter PBSRC = src/%{name}-%{version}.tar.gz
     97buffer/pbconf/1.19/pbfilter/all.pbf:filter PBVER = $pbver
     98buffer/pbconf/1.19/pbfilter/all.pbf:filter PBDATE = $pbdate
     99buffer/pbconf/1.19/pbfilter/all.pbf:filter PBLOG = yes
     100buffer/pbconf/1.19/pbfilter/all.pbf:filter PBTAG = $pbtag
     101buffer/pbconf/1.19/pbfilter/all.pbf:filter PBREV = $pbrev
     102buffer/pbconf/1.19/pbfilter/all.pbf:filter PBPKG = $pbpkg
     103buffer/pbconf/1.19/pbfilter/all.pbf:filter PBPACKAGER = $pbpackager
     104buffer/pbconf/1.19/pbfilter/all.pbf:filter PBDESC = This is a program designed to speed up writing tapes on remote tape drives.  When this program is put "in the pipe", two processes are started.  One process reads from standard-in and the other writes to standard-out.  Both processes communicate via shared memory.
     105buffer/pbconf/1.19/pbfilter/all.pbf:filter PBURL = http://hello-penguin.com/software/buffer
     106buffer/pbconf/1.19/pbfilter/deb.pbf:filter PBGRP = utils
     107buffer/pbconf/1.19/pbfilter/md.pbf:filter PBGRP = Archiving/Backup
     108buffer/pbconf/1.19/pbfilter/novell.pbf:filter PBGRP = Productivity/Archiving/Backup
     109buffer/pbconf/1.19/pbfilter/rpm.pbf:filter PBGRP = Applications/Archiving
     110buffer/pbconf/1.19/pbfilter/rpm.pbf:filter PBSUF = $pbsuf
     111}}}
     112
     113This defines all the macro that are needed to do a build.
     114Then adapt the spec file if you're on a rpm based distro, or the control file if under a deb one.
     115I'm using Mandriva so go for the spec:
     116{{{
     117grep -Ev '^#|^$' buffer/pbconf/1.19/buffer/rpm/buffer.spec
     118Summary:        buffer speeds up writing tapes on remote tape drives
     119Summary(fr):    buffer accélère l'écriture des bande sur des périphériques distants
     120Name:           PBPKG
     121Version:        PBVER
     122Release:        PBTAGPBSUF
     123License:        PBLIC
     124Group:          PBGRP
     125Url:            PBURL
     126Source:         PBREPO/PBSRC
     127BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
     128%description
     129PBDESC
     130%description -l fr
     131buffer accélère l'écriture des bande sur des périphériques distants
     132%prep
     133%setup -q
     134%build
     135make %{?_smp_mflags}
     136%install
     137%{__rm} -rf $RPM_BUILD_ROOT
     138install -m 755 -D buffer $RPM_BUILD_ROOT%{_bindir}/buffer
     139install -m 644 -D buffer.man $RPM_BUILD_ROOT%{_mandir}/man1/buffer.1
     140%clean
     141%{__rm} -rf $RPM_BUILD_ROOT
     142%files
     143%defattr(-,root,root)
     144%doc ChangeLog
     145%doc COPYING README AUTHORS NEWS
     146%{_bindir}/buffer
     147%{_mandir}/man1/buffer.1*
     148%changelog
     149PBLOG
     150}}}
     151
     152As you can see globally only few changes :-)
     153Now it's time to test the result of our configuration:
     154{{{
     155pb -p buffer cms2build
     156Project: buffer
     157Action: cms2build
     158Packages: buffer
     159
     160Management of buffer 1.19-1 (rev flat)
     161 ... 2008-05-30 02:18:28 URL:http://hello-penguin.com/software/buffer/buffer-1.19.tar.gz [17920/17920] -> "/users/bruno/tmp/pb.jh8U7Q7VdP/buffer-1.19.tar.gz" [1]
     162OK
     163Extracting /users/bruno/tmp/pb.jh8U7Q7VdP/buffer-1.19.tar.gz in /users/bruno/pb/projects/buffer/delivery... OK
     164Generating fake ChangeLog for test version
     165Build files generated for debian-3.1,debian-4.0,fedora-4,fedora-5,fedora-6,fedora-7,fedora-8,fedora-9,mandrake-10.1,mandrake-10.2,mandriva-2006.0,mandriva-2007.0,mandriva-2007.1,mandriva-2008.0,mandriva-2008.1,redhat-7.3,redhat-9,rhel-3,rhel-4,rhel-5,sles-10,sles-9,suse-10.0,suse-10.1,suse-10.2,suse-10.3,ubuntu-6.06,ubuntu-7.04,ubuntu-7.10,ubuntu-8.04
     166No Build files found for gentoo-nover
     167Creating buffer tar files compressed... OK
     168Under /users/bruno/pb/projects/buffer/delivery/buffer-1.19.tar.gz
     169}}}
     170So far so good. We now have a new tar file which contains all the build files expanded for the various distribution supported (even if some of them are not ready yet e.g. .deb in our case).
     171
     172Go one step further:
     173{{{
     174pb -p buffer build2pkg
     175Project: buffer
     176Action: build2pkg
     177Packages: buffer
     178Extracting build files... OK
     179Building package with /users/bruno/pb/projects/buffer/build/SPECS/buffer.spec under /users/bruno/pb/projects/buffer/build... Executing(%prep): /bin/sh -e /users/bruno/pb/projects/buffer/build/tmp/rpm-tmp.85498
     180+ umask 022
     181+ cd /users/bruno/pb/projects/buffer/build/BUILD
     182+ '[' 1 -eq 1 ']'
     183+ '[' 1 -eq 1 ']'
     184+ '[' 1 -eq 1 ']'
     185+ cd /users/bruno/pb/projects/buffer/build/BUILD
     186+ rm -rf buffer-1.19
     187+ /usr/bin/gzip -dc /users/bruno/pb/projects/buffer/build/SOURCES/buffer-1.19.tar.gz
     188+ tar -xf -
     189+ STATUS=0
     190+ '[' 0 -ne 0 ']'
     191+ cd buffer-1.19
     192+ exit 0
     193Executing(%build): /bin/sh -e /users/bruno/pb/projects/buffer/build/tmp/rpm-tmp.85498
     194+ umask 022
     195+ cd /users/bruno/pb/projects/buffer/build/BUILD
     196+ cd buffer-1.19
     197+ '[' 1 -eq 1 ']'
     198+ '[' 1 -eq 1 ']'
     199+ make -j4
     200gcc -Wall -O6 -fomit-frame-pointer   -c -o buffer.o buffer.c
     201gcc -Wall -O6 -fomit-frame-pointer   -c -o sem.o sem.c
     202sem.c:108: attention : return type defaults to ‘int’
     203sem.c: In function ‘do_sem’:
     204sem.c:120: attention : implicit declaration of function ‘getpid’
     205sem.c:124: attention : ‘return’ with no value, in function returning non-void
     206buffer.c:133: erreur: conflicting types for ‘shmat’
     207/usr/include/sys/shm.h:58: erreur: previous declaration of ‘shmat’ was here
     208buffer.c: In function ‘main’:
     209buffer.c:274: attention : implicit declaration of function ‘exit’
     210buffer.c:274: attention : incompatible implicit declaration of built-in function ‘exit’
     211buffer.c: In function ‘parse_args’:
     212buffer.c:297: attention : implicit declaration of function ‘atoi’
     213buffer.c: In function ‘buffer_allocate’:
     214buffer.c:515: attention : format ‘%08x’ expects type ‘unsigned int’, but argument 4 has type ‘char *’
     215buffer.c:520: attention : implicit declaration of function ‘bzero’
     216buffer.c:520: attention : incompatible implicit declaration of built-in function ‘bzero’
     217buffer.c: In function ‘fill_block’:
     218buffer.c:695: attention : incompatible implicit declaration of built-in function ‘bzero’
     219buffer.c: In function ‘byee’:
     220buffer.c:874: attention : incompatible implicit declaration of built-in function ‘exit’
     221buffer.c:878: attention : incompatible implicit declaration of built-in function ‘exit’
     222make: *** [buffer.o] Erreur 1
     223make: *** Attente des tâches non terminées....
     224error: Bad exit status from /users/bruno/pb/projects/buffer/build/tmp/rpm-tmp.85498 (%build)
     225
     226
     227RPM build errors:
     228    Bad exit status from /users/bruno/pb/projects/buffer/build/tmp/rpm-tmp.85498 (%build)
     229child (rpmbuild --define 'packager Bruno Cornec <bruno@project-builder.org>' --define "_topdir /users/bruno/pb/projects/buffer/build" -ba /users/bruno/pb/projects/buffer/build/SPECS/buffer.spec) exited with value 1
     230Checking validity of rpms with rpmlint... Error: no installed packages by name RPMS/*/buffer-1.19-1.mdv2008.1.*.rpm
     231Error: no installed packages by name SRPMS/buffer-1.19-1.mdv2008.1.src.rpm
     232OK
     233}}}
     234Ok, some patches seem to be required to be able to compile and link cleanly that application on my new shiny Mandriva 2008.1.