New package: icmpdn

Fredrik Tolf fredrik at dolda2000.com
Tue Jun 28 18:55:45 UTC 2005


I'll answer the remaining points from Oliver Falk further down.

On Tue, 2005-06-28 at 17:47 +0200, Michael Schwendt wrote:
> On Tue, 28 Jun 2005 16:22:11 +0200, Fredrik Tolf wrote:
> 
> > > * Remove Vendor Tag
> > 
> > I'm sure you're right, but what is there supposed to be instead? Surely,
> > the author is supposed to mentioned so that people know who to
> > blame? ;-)
> 
> That's what documentation files are for. Upstream projects can put contact
> information, bugzilla databases, e-mail addresses there. The vendor of
> the package is the person/organisation who builds the binary packages.
> At Fedora Extras, both Vendor and Packager tag are left empty in the
> spec file. Vendor information could be filled in by the build system.

That makes perfect sense. However, it would be kind of good to have them
filled in when I build the packages that I put on the homepage as well.
I did notice in the Wiki link that Ville Skyttä sent that I could do
something a filed called ~/.rpmmacros for that. I googled around a bit
for it, but could find nothing about that particular bit. Does anyone
have a link with info on this?

Am I, by any chance, just supposed to put "%packager MyName" in there
and be done with it?

> > > * Source is better written as Source0 and is missing the full URI to the 
> > > tarball
> > 
> > Again, I'm sure you're right, but what's the difference between Source
> > and Source0?
> 
> They are the same. Just like "Patch0" and "Patch" is the same. Don't worry
> about such recommendations. You are free to ignore them. It's unimportant
> spec file beautiness. Lobbying for using Source0 and Patch0 even if there
> is only one source file and one patch has been a recent move by some
> packagers.

Well, as long as it doesn't break anything to call it Source0 instead, I
guess I can just as well make everyone happy. :)

> > fonts anyway), but is there anything wrong with using UTF-8 in
> > specfiles?
> 
> Spec files ought to be UTF-8 for consistency with system defaults.

Well, of course I wasn't intending to make it Shift-JIS or KOI-8 or
anything. ;-)
I was just thinking whether it's OK to use non-ASCII characters. If it's
OK, I certainly wasn't planning to do it with anything other than UTF-8.

> > > * In %build section, you should use %configure - it should set 
> > > everything correctly
> > 
> > As I mentioned, I don't know much about building RPMs, so you may well
> > be right, but does this "%configure" set the libdir correctly to /lib?
> > AFAIK, that's pretty important for NSS modules.
> 
> You can override %configure's defaults like this:
> 
>   %configure --libdir=%{_lib}
>[...]
> Typo. Make it:
> 
>     %configure --libdir=/%{_lib}
> 
> Note that on 64-bit multilib systems, the NSS modules are located
> in /lib64, not /lib.

Does that mean that %{_lib} expands to only lib or lib64, and
not /usr/lib or anything of the kind?

> > > * make is better written as: make %{?_smp_mflags}
> > 
> > OK, will fix.
> 
> And be aware of SMP make flags breaking sometimes. ;)
> 
> Adding smp_mflags would be something a packager would documented in the
> spec %changelog, so when a new tarball fails in "make" in weird ways, the
> changelog entry would help when looking for the possible culprit.

Well, now that I know what the %changelog section is, I'll do that. Is
there any particular formatting that you prefer the %changelog section
to comply to? Right now, I wrote in the kind of formatting that Emacs'
VC mode generates with C-x v a.

> > > * In %install section do only use rm -rf "$RPM_BUILD_ROOT" (same for the 
> > > %clean section)
> > 
> > Again, I'm sure you're right, but it seems weird to me not to check so
> > that the root dir doesn't get removed. Will fix, though. You are
> > referring to just removing the checks, right?
> 
> See yesterday's/today's thread about the "fish" package. Please don't
> decrease readability of your spec file with insane checks which are
> advertised as adding security. They don't add any real security. And btw,
> I doubt you have ever before seen somebody building rpms as root with an
> explicit build-root set to /. Let's get rid of such checks, please.

I didn't even know that it was possible to build RPMs not being root.
That was very good to know. If you don't mind me asking, though: Why is
that rm -rf command there at all? Isn't that the kind of thing that
rpmbuild ought to take care of itself?

> > > * %post and %postun should run ldconfig
> > >    And therefor PreReq: /sbin/ldconfig
> > 
> > Would fix, but I have no idea what "PreReq" refers to. Also, are you
> > sure that running ldconfig really is necessary?
> 
> Well, it's the command that refreshes the run-time dynamic linking
> loader's cache. The libs in %_lib and %_libdir are found without running
> it. But you want to update the cache.
> [...]
> dlopen accesses the same mechanisms.

Well, I knew what ldconfig was for, but I didn't think that dlopen uses
it. Would fix it, but I still don't know what this "PreReq" thingie is.
Is it a tag in the same sense as Source0?

> > > * In %files section icmpdnd is missing %attr to be sure the files are 
> > > executable
> > > * In %files section, init.d/ipcmpdnd is missing %config
> > 
> > Will fix.
> 
> Explicit %attr is redundant if the file was installed into build
> root with proper permissions, which don't interfere with the %defattr
> default attributes.

So does that mean that I should remove the %attr:s again? Well, at least
for now, I did. For reference, the guy who originally wrote the specfile
set %defattr to this:

%defattr(-,root,root)

On Tue, 2005-06-28 at 16:59 +0200, Oliver Falk wrote: 
> On 06/28/2005 04:22 PM, Fredrik Tolf wrote:
> > As I mentioned, I don't know much about building RPMs, so you may well
> > be right, but does this "%configure" set the libdir correctly to /lib?
> > AFAIK, that's pretty important for NSS modules.
> 
> Is it a problem if they are under /usr/lib? I'm not sure...

Well, I'm no NSS expert (I just know the API), but since *every* other NSS
module there is puts itself in /lib, I'd say it seems appropriate to do so
as well.

Again, thanks for all your comments. I'll attach the version of the
specfile.in as it looks right now, so that you can see whether I made
all the changes correctly.

Fredrik Tolf

-------------- next part --------------
Name:		icmpdn
Version:	@VERSION@
Release:	2
License:	LGPL for library, GPL for utilities
Group:		System Environment/Libraries
Summary:	ICMP host name utilities
Source0:	http://www.dolda2000.com/~fredrik/icmp-dn/%name-%version.tar.gz
URL:		http://www.dolda2000.com/~fredrik/icmp-dn/
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
Since the Linux kernel does not support the ICMP host name facilities as
described in RFC 1788, I wrote a simple implementation in user-space.
It comprises three parts:

    * icmpdnd - The ICMP Domain Name daemon, which listens to ICMP
      domain name requests and replies to them.

    * idnlookup - A user utility to query a host for its host name over
      ICMP. Like ping and all other utilities that use ICMP, it needs to
      be installed SUID root.

    * libnss_icmp.so.2 - A glibc NSS module, which uses idnlookup to
      perform queries for the gethostbyaddr function.

%prep
%setup

%build
CXXFLAGS="$RPM_OPT_FLAGS" CFLAGS="$RPM_OPT_FLAGS"	\
	./configure			\
	--prefix=%_prefix		\
	--sysconfdir=%_sysconfdir	\
	--libdir=/lib
make %{?_smp_mflags}

%install
rm -rf "$RPM_BUILD_ROOT"
mkdir $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
install -m755 admin/icmpdnd "$RPM_BUILD_ROOT%{_sysconfdir}/init.d"

%post
# $1 = 0 is remove; $1 = 1 is update

%postun
# $1 = 0 is remove; $1 = 1 is update

%files
%defattr(-,root,root)
/lib/libnss_icmp.so
/lib/libnss_icmp.la
/lib/libnss_icmp.so.2.0.0
/lib/libnss_icmp.so.2
%config %{_sysconfdir}/nss-icmp.conf

%attr(4755,root,root) %{_bindir}/idnlookup

%config %{_sysconfdir}/init.d/icmpdnd
%{_sbindir}/icmpdnd

%doc AUTHORS ChangeLog COPYING README

%clean
rm -rf "$RPM_BUILD_ROOT"

%changelog
2005-06-28  Fredrik Tolf <fredrik at dolda2000.com>

	* Fixed a lot of things after a discussion on
	  fedora-extras-list, among other things:
		* Removed Vendor tag
		* Fixed Source tag
		* Replaced en-dashes with ASCII hyphens
		* Added SMP flags to make
		* Removed INSTALL and NEWS from %doc
		* Added this ChangeLog section.


More information about the fedora-extras-list mailing list