An introductionto mGAR (Dublin 2011)
-
Upload
dmichelsen -
Category
Technology
-
view
785 -
download
1
description
Transcript of An introductionto mGAR (Dublin 2011)
![Page 1: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/1.jpg)
mGARProducing complex packages for Solaris the easy way
OpenCSW Technical WintercampDublin 2011
Dagobert [email protected]
1Samstag, 19. Februar 2011
![Page 2: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/2.jpg)
find /usr/local/pkg -print > /tmp/filescat /tmp/files | pkgproto > /tmp/Prototypevim /tmp/Prototype
PKG=FOOtreeNAME=tree - A recursive directory listing programARCH=sparcVERSION=1.5.3,REV=2010.02.02CATEGORY=applicationVENDOR=http://mama.indstate.edu/users/ice/tree/[email protected]=joe@darkstar-20100202140539CLASSES=noneHOTLINE=http://www.example.com/
pkgmk -o -r / -d /tmp -f Prototypepkgtrans . tree.pkg FOOtreegzip tree.pkg
Once upon a time
2Samstag, 19. Februar 2011
![Page 3: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/3.jpg)
What is missing? What‘s wrong?
CompilationPackaging standardsChecking for errorsHardcoded prototypesHardcoded pkginfo
3Samstag, 19. Februar 2011
![Page 4: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/4.jpg)
Enter mGAR
gmake package4Samstag, 19. Februar 2011
![Page 5: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/5.jpg)
5
What is mGAR?
A system to build packages for SolarisOrigins are „GAR“LNX-BBC and GARNOMEm = modulated➜ multiple similar buildsFiles written in GNU Make
5Samstag, 19. Februar 2011
![Page 6: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/6.jpg)
The minimal information to build a package:1. What should the package be named2. Where to get the sources3. What the dependencies are
The simplest case
6Samstag, 19. Februar 2011
![Page 7: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/7.jpg)
NAME = gperfVERSION = 3.0.3CATEGORIES = devel
DESCRIPTION = A perfect hash function generator
MASTER_SITES = $(GNU_MIRROR)DISTFILES = $(NAME)-$(VERSION).tar.gz
CONFIGURE_ARGS = $(DIRPATHS)
TEST_TARGET = check
include gar/category.mk
Example: gperf
7Samstag, 19. Februar 2011
![Page 8: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/8.jpg)
include gar/category.mk
Should be really named 'profiles'
Contains settings common to a class of builds
Generic
Perl Modules
Ruby Gems
Python Eggs
Categories
8Samstag, 19. Februar 2011
![Page 9: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/9.jpg)
Typical customization needsCode needs to be patched to compile or run on SolarisCode doesn‘t honor information passed via ./configureFiles need to placed at specific locations in the package
9Samstag, 19. Februar 2011
![Page 10: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/10.jpg)
Phases
prerequisites fetch checksum exract patch configure build test install merge package checkpkg
...and custom targets:pre-fetchpost-fetch
pre-extract(...)
10Samstag, 19. Februar 2011
![Page 11: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/11.jpg)
„A Modulation is the process of varying one waveform in relation to another
waveform“For software builds that means:
„A Modulation is the process of varying a build in relation to certain parameters“
Modulations
11Samstag, 19. Februar 2011
![Page 12: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/12.jpg)
PrerequisitesFetchChecksumExtractPatchConfigureBuildTestInstallMergePackage
Executedglobally
Executed insidemodulation
Executed globally
Phases and modulations
One modulation
12Samstag, 19. Februar 2011
![Page 13: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/13.jpg)
What can be usedas modulator?
ISA for build architectureFor 32/64 bit versions and optimized binaries.See lame
Package versionUseful when multiple versions of a library should be includedSee automake
...anything that controls the buildStatic vs. dynamic linked versionsSee wget
Parameter sizeSee nrpe
Wide vs. narrow charactersSee ncurses
13Samstag, 19. Februar 2011
![Page 14: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/14.jpg)
Modulationover ISA
Allows easy building of multiple ISAsBuilt-in special case of modulation
No merge needed also
Simplest case BUILD64 = 1
Advance dEXTRA_BUILD_ISAS = sparcv8plus+vis pentium_pro
14Samstag, 19. Februar 2011
![Page 15: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/15.jpg)
Modulationover ISA requirements
Certain ISAs require specific platformsx64 requires Solaris 10, but integrated package for Solaris 8-10
Parallelizing modulation buildsMay require builds on multiple hosts
Build platform for each modulation can be specified in the package manifestHow does ISAEXEC relate to multi-ISA?
15Samstag, 19. Februar 2011
![Page 16: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/16.jpg)
Cool trick:Use dynamically expanded variables
to set per-modulation
GARNAME = wget...EXTRA_MODULATORS = STATICMODULATIONS_STATIC = disable enable
EXTRA_CONFIGURE_STATIC-disable = --with-sslEXTRA_CONFIGURE_STATIC-enable = --disable-sharedEXTRA_CONFIGURE_STATIC-enable += --enable-staticEXTRA_CONFIGURE_STATIC-enable += --without-ssl...CONFIGURE_ARGS += $(EXTRA_CONFIGURE_STATIC-$(STATIC))
MERGE_SCRIPTS_isa-sparcv8-static-disable = copy-all MERGE_SCRIPTS_isa-sparcv8-static-enable = rename-wget copy-only MERGE_DIRS_isa-sparcv8-static-enable = $(bindir)
MERGE_SCRIPTS_isa-i386-static-disable = copy-all MERGE_SCRIPTS_isa-i386-static-enable = rename-wget copy-only MERGE_DIRS_isa-i386-static-enable = $(bindir)
merge-rename-wget: @mv $(DESTDIR)$(bindir)/wget $(DESTDIR)$(bindir)/wget.static...include gar/category.mk
Modulationover static/dynamic linking
Adds modulator withthis name
16Samstag, 19. Februar 2011
![Page 17: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/17.jpg)
Modulationover parameter size
GARNAME = nrpe...EXTRA_MODULATORS = SIZEMODULATIONS_SIZE = 1k 8k...PATCHFILES_isa-sparcv8-size-8k = common.h.diffPATCHFILES_isa-i386-size-8k = common.h.diff...MERGE_SCRIPTS_isa-sparcv8-size-1k = copy-allMERGE_SCRIPTS_isa-sparcv8-size-8k = copy-nrpe-only
MERGE_SCRIPTS_isa-i386-size-1k = copy-allMERGE_SCRIPTS_isa-i386-size-8k = copy-nrpe-only
include gar/category.mk...merge-copy-nrpe-only: cp $(INSTALLISADIR)$(bindir)/nrpe_1k $(PKGROOT)$(bindir)/nrpe_8k cp $(INSTALLISADIR)$(LIBEXECDIR)/check_nrpe $(PKGROOT)$(LIBEXECDIR)/check_nrpe_8k @$(MAKECOOKIE)
Ok, I guess you understood how this works
Use patchfiles on aper-modulation basis
17Samstag, 19. Februar 2011
![Page 18: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/18.jpg)
Modulationsand their names
The name of a modulation is <modulator1>-<value1>-<modulator2>-<value2>-...
Call each phase from a modulation manually with <phase>-<modulation>
Example: gmake build-isa-sparcv8
This results in a sub-make-invocation <phase>-modulated MODULATION=<MODULATION> <MODULATOR1>=<value1> ...
Example: gmake build-modulated MODULATION=isa-sparcv8 ISA=sparcv8
18Samstag, 19. Februar 2011
![Page 19: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/19.jpg)
MergingWhy is this needed?
Optimized binaries with isaexec
Libraries may be located elsewhere in the package than they were configured
…/lib/32 -> .…/lib/64 -> sparcv9 | amd64
Pathes stored in pkgconfig-files
19Samstag, 19. Februar 2011
![Page 20: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/20.jpg)
MergingWhy is this needed?
32 and 64 bit need different install locations to have sane pkgconfig-files
build-isa-sparcv8/opt/csw/bin/myappbuild-isa-sparcv9/opt/csw/bin/64/myapp
pkgroot/opt/csw/bin/myapppkgroot/opt/csw/bin/sparcv9/myapp
/opt/csw/bin/myapp -> isaexec/opt/csw/bin/sparcv8/myapp/opt/csw/bin/sparcv9/myapp
Merge
Package
Install
20Samstag, 19. Februar 2011
![Page 21: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/21.jpg)
MergingBuiltin rules
Copy all Copy only someMERGE_DIRS_<mod>
Do not relocate
Do relocate
copy-all copy-only
copy-relocate copy-relocated-only
21Samstag, 19. Februar 2011
![Page 22: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/22.jpg)
Mergingwith custom rules
Only merge specific filesGARNAME = nrpe...MERGE_SCRIPTS_isa-sparcv8-size-1k = copy-allMERGE_SCRIPTS_isa-sparcv8-size-8k = copy-nrpe-only
MERGE_SCRIPTS_isa-i386-size-1k = copy-allMERGE_SCRIPTS_isa-i386-size-8k = copy-nrpe-only
include gar/category.mk...merge-copy-nrpe-only: cp $(INSTALLISADIR)$(bindir)/nrpe_1k $(PKGROOT)$(bindir)/nrpe_8k cp $(INSTALLISADIR)$(LIBEXECDIR)/check_nrpe $(PKGROOT)$(LIBEXECDIR)/check_nrpe_8k @$(MAKECOOKIE)
This is the default buildJust copy everything over
We want to control exactly what is used from the additional modulation
Merging copies from the install location to PKGROOT
22Samstag, 19. Februar 2011
![Page 23: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/23.jpg)
They mean more or less 'hooks'f cswinitsmf /opt/csw/etc/init.d/cswpuppetdi.<class> scripts handle the files
i.cswinitsmfr.cswinitsmf
GAR integration:INITSMF = $(prefix)/init\.d/cswpuppetd
Fully automated:Texinfo registrationConfiguration file preservationPlacement of README.CSW in package docs...
Class Action Scripts
23Samstag, 19. Februar 2011
![Page 24: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/24.jpg)
checkpkg and overridesExamines a set of .pkg filesLooks for common issuesWritten mostly in Python, with lintian in mind
allows to override checks
24Samstag, 19. Februar 2011
![Page 25: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/25.jpg)
Your package is ready!
25Samstag, 19. Februar 2011
![Page 26: An introductionto mGAR (Dublin 2011)](https://reader033.fdocuments.us/reader033/viewer/2022051611/54b6f0114a7959435b8b4569/html5/thumbnails/26.jpg)
Questions?
Bueller? Anybody?26Samstag, 19. Februar 2011