Bug 29292

Summary: rpmbuild does not create the folder structure in $HOME when trying to build using a spec file
Product: Mageia Reporter: Kristoffer Grundström <lovaren>
Component: RPM PackagesAssignee: Lewis Smith <lewyssmith>
Status: UNCONFIRMED --- QA Contact:
Severity: normal    
Priority: Normal CC: lewyssmith, lovaren, mageia, marja11, ngompa13, ouaurelien, rpmstack
Version: 8Keywords: NEEDINFO
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: rpm-4.16.1.3-1.1.mga8.src.rpm CVE:
Status comment:
Attachments: Spec file for tutanota-desktop to test with
spec modifications

Description Kristoffer Grundström 2021-07-27 02:33:50 CEST
Description of problem: I have installed Mageia 8 with MATE and Cinnamon as Desktop Environments. Now, when I'm in Cinnamon I download my own spec file that I made to build Tutanota Desktop and this is where rpmbuild -ba fails to create the folder structure like it should.

Version-Release number of selected component (if applicable): 4.16.1.3

How reproducible: Everytime in a fresh installation.

Steps to Reproduce:
1. Install Mageia 8 with Cinnamon and MATE.
2. Login to Cinnamon.
3. Install rpm-build.
4. Download the tutanota-desktop spec file that I attached.
5. Open a terminal window and cd to the spec file.
6. Run rpmbuild -ba tutanota-desktop.spec
7. rpmbuild fails obviously since there's no rpmbuild folder in $HOME when there should be one followed by the proper subfolders.
Comment 1 Kristoffer Grundström 2021-07-27 02:34:30 CEST
Created attachment 12877 [details]
Spec file for tutanota-desktop to test with

CC: (none) => lovaren

Comment 2 Aurelien Oudelet 2021-07-27 21:33:06 CEST
Unsure if this is relevant to RPM Stack or a wrong SPEC file.

As us at bugsquad we don't know about them.
Add some useful peoples.

CC: (none) => mageia, ouaurelien, rpmstack

Comment 3 Kristoffer Grundström 2021-07-27 23:53:56 CEST
Without being an expert I say that it's NOT due to the spec file as this seems to only happen in Cinnamon. So far I can't recall getting this problem in Plasma.
Comment 4 katnatek 2021-07-28 01:42:46 CEST
Not sure what you mean but the wiki clearly say that you have to manually do some things

https://wiki.mageia.org/en/Packagers_RPM_tutorial#Preliminary_tasks
Comment 5 katnatek 2021-07-28 02:33:33 CEST
Created attachment 12878 [details]
spec modifications

I made a modification because i can't start with the original
But in mg8 i can't go further due npm version

npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for tutanota@3.85.6: wanted: {"npm":">=7.0.0"} (current: {"node":"14.17.3","npm":"6.14.13"})
npm ERR! notsup Not compatible with your version of node/npm: tutanota@3.85.6
npm ERR! notsup Not compatible with your version of node/npm: tutanota@3.85.6
npm ERR! notsup Required: {"npm":">=7.0.0"}
npm ERR! notsup Actual:   {"npm":"6.14.13","node":"14.17.3"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/katnatek/.npm/_logs/2021-07-28T00_25_14_212Z-debug.log
Comment 6 Kristoffer Grundström 2021-07-28 05:30:43 CEST
(In reply to katnatek from comment #4)
> Not sure what you mean but the wiki clearly say that you have to manually do
> some things
> 
> https://wiki.mageia.org/en/Packagers_RPM_tutorial#Preliminary_tasks

Running rpmbuild on its own creates these directories in Plasma, at least for past experience.
Comment 7 katnatek 2021-07-28 23:19:57 CEST
(In reply to Kristoffer Grundström from comment #6)
Did you have your .rpmmacros ?
https://wiki.mageia.org/en/Packagers_RPM_tutorial#.rpmmacros_file_creation
Comment 8 Lewis Smith 2021-08-01 20:17:09 CEST
@Kristoffer
(In reply to Kristoffer Grundström from comment #3)
> Without being an expert I say that it's NOT due to the spec file as this
> seems to only happen in Cinnamon. So far I can't recall getting this problem
> in Plasma.
- It seems that the missing directory structure is created when you run rpmbuild. Did you try under Mate?
- You say it works under Plasma; is that in the past, or with Mageia 8?
- My guess is that this is not desktop dependent.
- Have you heeded all the advice in the Wiki that katnatek indicated? (Thanks).

CC: (none) => lewyssmith

Comment 9 Marja Van Waes 2021-08-10 19:59:50 CEST
@ katnatek

Thanks for having tried to reproduce the issue.

Changing status to unconfirmed.

@ Kristoffer

Please reply to Lewis' questions.

CC: (none) => marja11
Status: NEW => UNCONFIRMED
Ever confirmed: 1 => 0

Marja Van Waes 2021-08-10 20:02:27 CEST

Keywords: (none) => NEEDINFO

Comment 10 Neal Gompa 2021-08-14 16:48:33 CEST
I suspect this might be some kind of user error, but it doesn't matter, because for Mageia 9 (with RPM 4.17), RPM will stop automatically creating these directories anyway.

We should update our documentation to tell people to use rpmdev-setuptree command (from rpmdevtools) to setup their working area.

CC: (none) => ngompa13

Comment 11 Lewis Smith 2021-08-15 22:45:27 CEST
Thanks for your insight, Neal. Is it (rpmdev-setuptree) valid for Mageiaz 8 - now?
Comment 12 Neal Gompa 2021-08-16 16:58:18 CEST
Yes. rpmdev-setuptree (in the rpmdevtools package) has existed since Mageia forked from Mandriva (certainly longer than that).
Comment 13 Kristoffer Grundström 2021-08-16 18:00:44 CEST
(In reply to Lewis Smith from comment #8)
> @Kristoffer
> (In reply to Kristoffer Grundström from comment #3)
> > Without being an expert I say that it's NOT due to the spec file as this
> > seems to only happen in Cinnamon. So far I can't recall getting this problem
> > in Plasma.
> - It seems that the missing directory structure is created when you run
> rpmbuild. Did you try under Mate?

Yes.

> - You say it works under Plasma; is that in the past, or with Mageia 8?


To my recollection it has always worked to just run rpmbuild alone to get the structure created, I may be mistaken though.

> - My guess is that this is not desktop dependent.
> - Have you heeded all the advice in the Wiki that katnatek indicated?
> (Thanks).

Manually creating .rpmmacros is something I haven't done before running rpmbuild because as I stated above it creates the right structure.
Comment 14 Lewis Smith 2021-08-19 09:34:35 CEST
Using Xfce, I have been playing with this to at least the point where the essential files & directories are created; but not succeeding in building the example package from just the attached SPEC file. I suspect that needed something more.
The Wiki comment 7 needs elaborating.

Before doing anything, I checked $HOME for anything 'rpm':
 $ find . -name '*rpm*'
Nothing. 
 $ sudo urpmi rpm-build
Still nothing.
 $ rpmbuild
Still nothing.
 $ rpmbuild -ba tmp/tutanota-desktop.spec
error: Bad source: /home/lewis/rpmbuild/SOURCES/tutanota-desktop-release-3.85.6.tar.gz: No such file or directory
Still nothing 'rpm' in $HOME.
I then created by copying from the wiki .rpmmacros:
 $ vi .rpmmacros
 $ find . -name '*rpm*'
 ./.rpmmacros
Following Neal's advice comment 10:
 $ sudo urpmi rpmdevtools
 $ rpmdev-setuptree
 $ find . -name '*rpm*'
 ./.rpmmacros
 ./rpmbuild
 $ tree rpmbuild/
 rpmbuild/
 ├── BUILD
 ├── RPMS
 ├── SOURCES
 ├── SPECS
 └── SRPMS
Which is what Kristoffer wants, I think. Still no joy for me, though; I suspect something more was needed.:
 $ rpmbuild -ba tmp/tutanota-desktop.spec
error: Bad source: /home/lewis/rpmbuild/SOURCES/tutanota-desktop-release-3.85.6.tar.gz: No such file or directory

So Kristoffer, please do at least:
- Create ~/.rpmmacros
- $ rpmdev-setuptree
and take it from there. If that works, I shall tweak the Wiki accordingly. The mere fact that something auto-magic used to happen and does no more (nor will in the future) seems OK in such a techinical environment.

And can somebody more learned in this field say whether the steps I went through are correct (so I can put them in the Wiki).
Comment 15 Kristoffer Grundström 2021-08-22 01:05:59 CEST
(In reply to Lewis Smith from comment #14)
> Using Xfce, I have been playing with this to at least the point where the
> essential files & directories are created; but not succeeding in building
> the example package from just the attached SPEC file. I suspect that needed
> something more.
> The Wiki comment 7 needs elaborating.
> 
> Before doing anything, I checked $HOME for anything 'rpm':
>  $ find . -name '*rpm*'
> Nothing. 
>  $ sudo urpmi rpm-build
> Still nothing.
>  $ rpmbuild
> Still nothing.
>  $ rpmbuild -ba tmp/tutanota-desktop.spec
> error: Bad source:
> /home/lewis/rpmbuild/SOURCES/tutanota-desktop-release-3.85.6.tar.gz: No such
> file or directory
> Still nothing 'rpm' in $HOME.
> I then created by copying from the wiki .rpmmacros:
>  $ vi .rpmmacros
>  $ find . -name '*rpm*'
>  ./.rpmmacros
> Following Neal's advice comment 10:
>  $ sudo urpmi rpmdevtools
>  $ rpmdev-setuptree
>  $ find . -name '*rpm*'
>  ./.rpmmacros
>  ./rpmbuild
>  $ tree rpmbuild/
>  rpmbuild/
>  ├── BUILD
>  ├── RPMS
>  ├── SOURCES
>  ├── SPECS
>  └── SRPMS
> Which is what Kristoffer wants, I think. Still no joy for me, though; I
> suspect something more was needed.:
>  $ rpmbuild -ba tmp/tutanota-desktop.spec
> error: Bad source:
> /home/lewis/rpmbuild/SOURCES/tutanota-desktop-release-3.85.6.tar.gz: No such
> file or directory
> 
> So Kristoffer, please do at least:
> - Create ~/.rpmmacros
> - $ rpmdev-setuptree
> and take it from there. If that works, I shall tweak the Wiki accordingly.
> The mere fact that something auto-magic used to happen and does no more (nor
> will in the future) seems OK in such a techinical environment.
> 
> And can somebody more learned in this field say whether the steps I went
> through are correct (so I can put them in the Wiki).

I can confirm that creating the rpmmacros file in $HOME does the trick after you install rpmdev-setuptree.
Comment 16 Lewis Smith 2021-08-24 21:09:27 CEST
Thank you. I shall adapt the wiki accordingly, then close this.

Assignee: bugsquad => lewyssmith

Comment 17 Neal Gompa 2021-08-25 14:31:56 CEST
Note that "rpmdev-setuptree" will create ~/.rpmmacros for you if it doesn't exist.
Comment 18 Kristoffer Grundström 2021-08-25 15:16:37 CEST
(In reply to Neal Gompa from comment #17)
> Note that "rpmdev-setuptree" will create ~/.rpmmacros for you if it doesn't
> exist.

That also means that rpmdev-setuptree should become install as a dependancy to rpm-build because otherwise how would one know?
Comment 19 Neal Gompa 2021-08-26 15:38:39 CEST
No. You don't need ~/.rpmmacros to build packages. You also don't need rpmdev-setuptree if you're using tools like Mock[1] to build packages. And we *definitely* don't need rpmdevtools for rpm-build itself. 

[1]: https://wiki.mageia.org/en/Using_Mock