Jump to content

Problem in building rpm package as user - not root


Recommended Posts

Hallo all! Yesterday I tried to build a rpm package from source tarball of amsn- amsn-0.96.tar.bz2. Yes, I know, that there is already precompiled rpm package in the urpmi mirrors, but I would like to build it by myself, just for the science- now I'm learning how to build rpms, and I already have built about 10 packages- nemesis, kbedic (this is a dictionary) and others- ordinary non-sophisticated programs. With the amsn, I tried to run spec file with rpm -bi command, in order to stop after installing, so I to be able manually to describe files in %files section of the spec file, which files to be included in the rpm package. But, after a while when I start, I received the following error:

 

Executing(%install): /bin/sh -e /home/nik/rpm/tmp/rpm-tmp.83384

+ umask 022

+ cd /home/nik/rpm/BUILD

+ cd amsn-0.96

+ '[' 1 -eq 1 ']'

+ rm -rf /home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot

+ make prefix=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr exec_prefix=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr bindir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/bin sbindir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/sbin sysconfdir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/etc datadir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/share includedir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/include libdir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/lib libexecdir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/lib localstatedir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/var/lib sharedstatedir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/com mandir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/share/man infodir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/share/info install

rm -Rf /usr/share/amsn

mkdir --parents /usr/share/amsn

mkdir: cannot create directory `/usr/share/amsn': Permission denied

make: *** [install] Error 1

error: Bad exit status from /home/nik/rpm/tmp/rpm-tmp.83384 (%install)

 

 

RPM build errors:

Bad exit status from /home/nik/rpm/tmp/rpm-tmp.83384 (%install)

[nik@localhost SOURCES]$

 

As I understand, the problem is, that mkdir has no right to create a directory, but the directory is in my home directory, and mkdir is started by my user, so it is supposed to have permission to create directory?

I have a directory rpm, in the home directory, with its subdirectories for building rpms- BUILD, RPMS, SOURCES, SPECS, SRPMS, tmp with their subdirectories- like it is described in manual HowTo build rpms in mandriva. In my home directory, I have the files .rpmmacros and .rpmrc - their contents:

.rpmrc

 

buildarchtranslate: i386: i586

buildarchtranslate: i486: i586

buildarchtranslate: i586: i586

buildarchtranslate: i686: i586

 

.rpmmacros

 

%_topdir /home/nik/rpm

%_tmppath /home/nik/rpm/tmp

 

%_signature gpg

%_gpg_name Mandrivalinux

%_gpg_path ~/.gnupg

 

%distribution Mandriva Linux

%vendor Mandriva

%packager Nik123

 

And the content of the amsn spec file- section %files is not finished yet, but this is not supposed to prevent mkdir creating subdirectory in the /home/rpm directory of my user:

 

amsn-0.96.spec

 

%define name amsn

%define version 0.96

%define release %mkrel 1

 

Name: %{name}

Version: %{version}

Release: %{release}

 

Summary: Free open source MSN messenger clone

Source: http://mesh.dl.sourceforge.net/%{name}-%{version}.tar.bz2

URL: http://amsn-project.net/index.php

Group: Applications/Internet/Instant Messaging

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot

License: GPL

 

%description

Linux clone of the Microsoft MSN messenger

 

%prep

%setup -q

%build

%configure

%make

%install

rm -rf $RPM_BUILD_ROOT

%makeinstall

%clean

rm -rf $RPM_BUILD_ROOT

%files

 

 

 

%defattr(0755,root,root)

%doc README NEWS COPYING AUTHORS

%{_mandir}/man1/*

 

 

Any ideas ho to solve the problem? Thanks in advance

 

 

[moved from Software by spinynorman]

Link to comment
Share on other sites

but the directory is in my home directory
Actually, the directory it's getting an error on is not in your home dir:
mkdir --parents /usr/share/amsn
mkdir: cannot create directory `/usr/share/amsn': Permission denied

I believe this is the result of the %makeinstall you are telling the spec file to perform. It's been a bit since I built an RPM from spec (did a few many years ago) but this appears to be the source of your problem. Unfortunately I don't have much advice on how to resolve it :unsure:

Link to comment
Share on other sites

I think, according to .rpmmacros and the spec file, posted above, the directory /usr/share actually is the directory

/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/share - here are the prefixes:

 

+ rm -rf /home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot

+ make prefix=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr exec_prefix=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr bindir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/bin sbindir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/sbin sysconfdir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/etc datadir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/share includedir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/include libdir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/lib libexecdir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/lib localstatedir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/var/lib sharedstatedir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/com mandir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/share/man infodir=/home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/share/info install

 

Almost the same spec files I've used to build another packages. But, thank you for the reply, I hope here will be another opinions too ;-)

Link to comment
Share on other sites

Or ls -l ;)

 

I'm guessing here but it looks like it uses the directories under your home for the build step, but then for the install it really does (try to) use the real /usr/share/amsn.

 

Easy enough to figure out, just run it again as root and see if it does create a directory under /usr/share. If so then you at least know why it's failing - I'll leave it to the experts to tweak the scripts to install under your home!

Link to comment
Share on other sites

  • 2 weeks later...

I do not want to run it as root, because in some .tar.gz (source code) there is not an option to make uninstall, or make clean and I may fall in situation, that I will install some program, and won't be able to uninstall it . And the Rpm How To for mandriva says that it is dangerous to build rpm as root. Maybe I have to try finding amsn's source rpm, so I to be able to examine it's .spec file, maybe there I will find a way out from that trouble

 

What are the permissions on that directory? Use ls =l in /home/nik/rpm/tmp/amsn-0.96-1mdv2007.0-buildroot/usr/

I can't view permissions, because this is temporary directory, which is being cleared by the rpm program after process is completed/interrupted. But this is a directory, being build from the rpm program, and the rpm program is started by my user, and this directory is in the tree of my home folder

Edited by Nik123
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...