Table of Contents
This document is a user's guide to the YaST2 devtools (short for "development tools"), a utility collection to make developing YaST2 code easier - C++ as well as YCP.
Install the yast2-devtools
RPM or check out the devtools
module from
the YaST2 CVS and build and install it:
cd yast2 # your YaST2 CVS working directory cvs co devtools cd devtools make -f Makefile.cvs make sudo make install
See the Migration how to change your C++ or YCP module.
Build and use your package as before.
If make package
complains, fix the complaints. For a tempoarary package to
check whether or not build
works with your changes, use "make
package-local
" - but never check in a package to /work/src/done
that you created this way!
The YaST2 devtools are an add-on to the classic automake / autoconf environment YaST2 used to use.
Since the toplevel Makefile.am
is pretty much the same throughout all
YaST2 C++ or YCP modules yet contains more and more specialized make
targets, this toplevel Makefile.am
is now automatically generated.
The only thing that is (or, rather, "should be") different in all those
toplevel Makefile.am
files is the "SUBDIRS =
" line. This line is
moved to a SUBDIRS
in the
package's toplevel directory, much like RPMNAME
, VERSION
,
MAINTAINER
etc. - the rest of Makefile.am
is copied from a common
path /usr/share/YaST2/data/devtools/admin
. Thus, changes that should affect
all of YaST2's toplevel Makefile.am
files are much easier to do and all
YaST2 modules can benefit from them without the need to change (i.e. cvs
up
, edit, cvs ci
) all of over 85 individual files.
This implies, of course, that the toplevel Makefile.am
is no longer stored
in the CVS repository since it is now automatically generated.
On the downside, this of course implies that the files and scripts required for this new automagic are available at build time - i.e. on each YaST2 developer's development machine as well as in the build environment. Thus, you will need to either install the appropriate RPM or build the devtools manually - see the Quick Start section for details.
If you haven't done that yet, install the devtools - see the Quick Start section for details.
If you are not sure, check /usr/share/YaST2/data/devtools
- if you don't
have that directory, the devtools are not installed.
You can simply use the devtools-migration
script that comes with the
devtools package:
cd yast2/modules/mypackage y2tool devtools-migration cvs ci
This script performs the following steps:
Go to your package's toplevel directory:
cd yast2/modules/mypackage
Create a SUBDIRS
file from your existing
Makefile.am
.
![]() | Note |
---|---|
You can do without that grep 'SUBDIRS' Makefile.am | sed -e 's/SUBDIRS *= *//' >SUBDIRS
Getting rid of the " |
Add that new SUBDIRS
file to the CVS repository:
cvs add SUBDIRS
Get rid of the old Makefile.am
both locally and in the CVS repository -
this file will be automatically generated from now on:
cvs rm -f Makefile.am
Get rid of the old copyright notices (COPYING
,
COPYRIGHT.{english,german,french}
) both locally and in the CVS repository:
cvs rm -f COPYING COPYRIGHT.{english,french,german}
Those files will automatically be added to the tarball upon make package
,
make dist
and related commands.
Add Makefile.am
to the .cvsignore
file since it will be automatically
generated from now on (otherwise "cvs up" will keep complaining about it):
echo "Makefile.am" >>.cvsignore
Edit your .spec.in
file. Locate the neededforbuild
line and add
yast2-devtools
to it:
vi *.spec.in ... (locate "neededforbuild") (add "yast2-devtools") (save + quit)
OK, that was the wimp version. Here is the freak version:
perl -p -i -e 's/neededforbuild/neededforbuild yast2-devtools/' *.spec.in
Add the line that creates the toplevel Makefile.am
to your Makefile.cvs
:
vi Makefile.cvs (locate "aclocal") (add a new line above this:) [tab] y2tool y2automake (save + quit)
Again, a freak version for this:
perl -p -i -e 'print "\ty2tool y2automake\n" if /aclocal/' Makefile.cvs
The new Makefile.cvs
should look like this:
all: y2tool y2automake autoreconf --force --install
Double-check what you just did and check it into the CVS when everything looks OK.
"cvs up
" should print something like this:
M .cvsignore R COPYING R COPYRIGHT.english R COPYRIGHT.french R COPYRIGHT.german R Makefile.am M Makefile.cvs A SUBDIRS M myproject.spec.in
"cvs diff
"should print something like this:
Index: .cvsignore ... config.log aclocal.m4 +Makefile.am ... cvs server: Makefile.am was removed, no comparison available ... Index: Makefile.cvs ... all: + y2tool y2automake autoreconf --force --install ... cvs server: SUBDIRS is a new entry, no comparison available ... Index: myproject.spec.in ... -# neededforbuild autoconf automake ... +# neededforbuild yast2-devtools autoconf automake ... ...
Important: Don't build yet, otherwise Makefile.am
will be
regenerated and "cvs ci" will complain when trying to check all this in.
Check your changes in:
cvs ci
Test-build your package locally:
make -f Makefile.cvs && make && sudo make install
You should now have a new Makefile.am
.
For YaST2 translation modules (yast2-trans-...
), the Makefile.am
in the po
subdirectory is automatically generated as well. The strategy
for that is slightly different, though: The resulting Makefile.am
is
combined from Makefile.am.top
, Makefile.am.center
, and
Makefile.am.bottom
. The top and bottom files are used from the current
project, if there is such a file; otherwise, all files are taken from
/usr/share/YaST2/data/devtools/admin/po
. The center part is always
taken from there.
Add custom make
targets or variable definitions to the top or bottom part
as required. This may only be necessary for the yast2-trans-...
data
modules (e.g., keyboard, mouse, printers).
The migration script takes care of that: It migrates the po/
subdirectory, too, if there is one - and if there is a Y2TEXTDOMAIN
file in the the project toplevel directory. For data modules, the migration
script backs up the existing Makefile.am
to Makefile.am.bottom
(or to
Makefile.am.old
, if there already is a file named
Makefile.am.bottom
). Make sure to edit this file and get rid of
duplicate parts before checking in.
make package-local handles the file
*.spec.in. The file package/*.spec
created in the time of "make -f Makefile.cvs"
is overwitten in the time of "make package(-local)" with the
package/*.spec created by y2tool create-spec. But it should have the
same content.
With create-spec you can use more 'macros' in the *.spec.in:
writes the SuSE .spec comment
writes the usual header except BuildArch:, Requires:, Summary:
writes %prep with %setup
writes %build with usual make
writes %install with usual YCP make install
writes %clean with removing RPM_BUILD_ROOT
So the new *.spec.in could look like:
@HEADER-COMMENT@ # neededforbuild autoconf automake ycpdoc yast2-testsuite ... @HEADER@ Requires: yast2 yast2-trans-XXpkgXX yast2-lib-wizard yast2-lib-sequencer BuildArchitectures: noarch Summary: Configuration of XXpkgXX %description This package is a part of YaST2. It contains the necessary scripts to configure XXpkgXX. @PREP@ @BUILD-YCP@ @INSTALL-YCP@ @CLEAN@ %files %dir @yncludedir@/XXpkgXX /...
These paths are defined in your configure.in
generated by y2autoconf
and substituted by create-spec
. That means they are accessible in all
your Makefiles and can be uses in spec.in
files.
not for direct use
for documentation
for all yast2 programs not be started by the user.
for loadable plugins
for c header files
for translations files
for ycp clients
for ycp modules
for schema files (autoyast, control file)
for ycp includes
for scr files
for .desktop files (former *.y2cc)
for external programs that are yast2 components. here you have to append servers, servers_non_y2, clients or clients_non_y2.
for general data
for non theme-able images
for theme-able images (every theme must provide the same list of images)
In Makefile.am you can simply say
ybin_PROGRAMS = y2base
when you what the program y2base to be installed in ybindir. No need to change bindir or even prefix.
In the files section of your spec.in file use something like this:
@scrconfdir@/*.scr
Remember that the asterisk is only save when using a BuildRoot (and please use a BuildRoot).
If you need a define in a C++ file you have to pass it to the compiler. Simply use
AM_CXXFLAGS = -DPLUGINDIR=\"${plugindir}\"
in your Makefile.am.
Create a tarball from your module
and put it into the package/
directory. This also creates a spec file
from the .spec.in file.
This checks for cvs consistency (see make check-tagversion
) and whether or not you correctly
tagged that version (don't forget to increase the version number in
VERSION
!), then does everything make package-local
did.
This is performed by make package
prior to actually creating a tarball:
It checks whether or not you correctly tagged the current version. Use
"y2tool tagversion
" to do that once you increased the version number in
VERSION
.
![]() | Note |
---|---|
You will very likely never call this manually. |
This is performed by make package
prior to actually creating a tarball:
It checks whether or not everyting in this directory tree is checked into
CVS or Subversion. Any modified, added or removed files make this check fail.
![]() | Note |
---|---|
You will very likely never call this manually. |
This makes a package (i.e. it does everything "make package
" does and
checks it into the correct SuSE Linux distribution.
![]() | Note |
---|---|
This requires |