Closed Bug 672655 Opened 10 years ago Closed 10 years ago

Move to a single version number for packaging

Categories

(Cloud Services :: Server: Core, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: telliott, Assigned: tarek)

References

Details

Attachments

(3 files, 2 obsolete files)

At present, between foo.spec and setup.py, we define the current version in 4 separate places. This leads to human errors where we tag an rpm, then discover that we missed one and have to reversion and retag.

A central location for this value would save us every once in a while.
Let's agree on this convention, and propagate this snippet in all projects
Assignee: nobody → tarek
Status: NEW → ASSIGNED
Attachment #548969 - Flags: review?(telliott)
Attachment #548969 - Flags: review?(rmiller)
Comment on attachment 548969 [details] [diff] [review]
Extracts the version from the spec file

Review of attachment 548969 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #548969 - Flags: review?(rmiller) → review+
Comment on attachment 548969 [details] [diff] [review]
Extracts the version from the spec file

I agree that's the best place. This looks good.
Attachment #548969 - Flags: review?(telliott) → review+
done for core in http://hg.mozilla.org/services/server-core/rev/e7b6170e5b22

can we split the work for the propagation if you don't mind ?

=> Rob: server-sreg
=> Toby: account-portal, server-reg
=> Tarek: server-storage

also in the spec file: don't forget to do the %define unmangled_version %{version}
A good check is to try:

$ python setup.py --version

You should get the right version
I removed unmangled in storage' spec
Attached patch single version number for a-p (obsolete) — Splinter Review
Here's the account-portal one. The main gotcha is to remember to change the name of the spec file in setup.py
Attachment #548994 - Flags: review?(tarek)
Comment on attachment 548994 [details] [diff] [review]
single version number for a-p

Review of attachment 548994 [details] [diff] [review]:
-----------------------------------------------------------------

I don't see any good reason to change this line:

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

You should define %pythonname and keep it in the BuildRoot, like what we did in other projects.

And reuse it for Source0 definition.

See http://hg.mozilla.org/services/server-sreg/file/f601c21bbfc9/SyncSReg.spec#l1 for an example

(I am wondering how come it worked before since I don't see it defined at all right now)
Attachment #548994 - Flags: review?(tarek) → review-
Yeah, I was wondering how it worked myself, given that it clearly has been. I guess it's Accountportal
Attachment #548994 - Attachment is obsolete: true
Attachment #549172 - Flags: review?(tarek)
Attachment #549172 - Flags: review?(tarek) → review+
Attached patch Central versioning for reg (obsolete) — Splinter Review
reg is pretty clean. Just needs the setup.py changes, mostly
Attachment #549183 - Flags: review?(tarek)
Hmm, tried to implement this and actually build RPMs in node assignment, and it failed. 

The problem is that the build is actually done in build/bdist.macosx-10.6-x86_64/rpm/BUILD/Nodes-1.0 Setup.py has been moved there, but it fails because it can't find the spec file in there when it tries os.path.dirname(__file__).

Am I missing something?
Ah interesting:

make: *** [build_rpms] Error 1
tarek@tarek-laptop:~/dev/hg.mozilla.org/account-portal$ bin/python setup.py --command-packages=pypi2rpm.command bdist_rpm2 --spec-file=AccountPortal.spec --dist-dir=/home/tarek/dev/hg.mozilla.org/account-portal/rpms
Traceback (most recent call last):
  File "setup.py", line 49, in <module>
    with open(spec) as f:
IOError: [Errno 2] No such file or directory: 'Accountportal.spec'

Noticed the difference in the cases (AccountPortal vs Accountportal)

digging
Found the issue. It's a typo in your setup.py:

http://hg.mozilla.org/services/account-portal/file/6ce0f732f5d2/setup.py#l48
Oh irony. We've replaced build mismatches with product name mismatches. 

Fortunately, we only have to get that right once. Fixed.
Comment on attachment 549183 [details] [diff] [review]
Central versioning for reg

Looks good. 

One possible improvment: remove unmangled_version in the Spec file.

%define version 0.5
%define unmangled_version 0.5   <=== can be removed
Attachment #549183 - Flags: review?(tarek) → review+
(In reply to comment #18)
> Comment on attachment 549183 [details] [diff] [review] [diff] [details] [review]
> Central versioning for reg
> 
> Looks good. 
> 
> One possible improvment: remove unmangled_version in the Spec file.
> 
> %define version 0.5
> %define unmangled_version 0.5   <=== can be removed

Hmm, I thought we shouldn't remove that one. Presumably we'll need to update

Source0: %{pythonname}-%{unmangled_version}.tar.gz

as well?
We ended up saying that unmangled_version was unecessary and its definition could be removed + its usage replaced everywhere by version to make the spec file simpler. But it works with it so no worries if it stays.
Oh, ok, good. I must have misremembered. Unmangled-free version attached.
Attachment #549183 - Attachment is obsolete: true
Attachment #549813 - Flags: review?(tarek)
Comment on attachment 549813 [details] [diff] [review]
Central versioning for reg

LGTM

I've tried it with:

$ python setup.py --version
0.5

$ make build build_rpms
** output ok **
Attachment #549813 - Flags: review?(tarek) → review+
Blocks: 676423
reg done by Toby in https://hg.mozilla.org/services/server-reg/rev/a3f2c420be09

I believe we're done here
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.