Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1295115 - Review Request: swift-lang - Swift Programming Language by Apple
Summary: Review Request: swift-lang - Swift Programming Language by Apple
Keywords:
Status: CLOSED DUPLICATE of bug 1536780
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1362511
Blocks: FE-NEEDSPONSOR
TreeView+ depends on / blocked
 
Reported: 2016-01-02 15:10 UTC by jeremy.fergason
Modified: 2019-11-15 05:45 UTC (History)
19 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 20:27:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description jeremy.fergason 2016-01-02 15:10:38 UTC
Spec URL: https://s3-us-west-2.amazonaws.com/swift-rpm/swift-lang.spec
SRPM URL: https://s3-us-west-2.amazonaws.com/swift-rpm/swift-lang-2.2-0.1.snapshot20151231.fc23.src.rpm
Description: 

Hi, all!  If someone could review the swift package I've put together for Fedora Extras I would really appreciate it.

Swift is a modern programming language that Apple recently released as open source.  This is a package of the current pre-release of Swift 2.2.  It produces 3 RPM's:

 * swift-lang
 * swift-lang-docs
 * swift-lang-package-manager

Thanks for all your feedback.

URL for Swift: http://www.swift.org/
License: Apache 2.0 with Runtime Exception

Fedora Account System Username: jdfergason

Comment 1 jeremy.fergason 2016-01-02 15:12:11 UTC
Also, I am a new packager so I will need a sponsor.  Thank you!

Comment 2 jeremy.fergason 2016-01-03 04:25:45 UTC
Successful Koji Build of swift-lang: http://koji.fedoraproject.org/koji/taskinfo?taskID=12380144

Comment 3 Upstream Release Monitoring 2016-01-03 04:35:45 UTC
jdfergason's scratch build of swift-lang-2.2-0.1.snapshot20151231.fc23.src.rpm for epel7 failed http://koji.fedoraproject.org/koji/taskinfo?taskID=12386680

Comment 4 Upstream Release Monitoring 2016-01-03 04:48:19 UTC
jdfergason's scratch build of swift-lang-2.2-0.1.snapshot20151231.fc23.src.rpm for epel7 failed http://koji.fedoraproject.org/koji/taskinfo?taskID=12386874

Comment 5 Upstream Release Monitoring 2016-01-03 05:05:13 UTC
jdfergason's scratch build of swift-lang-2.2-0.1.snapshot20151231.fc23.src.rpm for f24 failed http://koji.fedoraproject.org/koji/taskinfo?taskID=12386610

Comment 6 Upstream Release Monitoring 2016-01-03 05:06:58 UTC
jdfergason's scratch build of swift-lang-2.2-0.1.snapshot20151231.fc23.src.rpm for f24-llvm failed http://koji.fedoraproject.org/koji/taskinfo?taskID=12386918

Comment 7 Upstream Release Monitoring 2016-01-03 05:23:13 UTC
jdfergason's scratch build of swift-lang-2.2-0.1.snapshot20151231.fc23.src.rpm for f22 failed http://koji.fedoraproject.org/koji/taskinfo?taskID=12386556

Comment 8 Dave Johansen 2016-01-05 05:16:26 UTC
Here's my initial feedback:
 - Use an ExclusiveArch instead of such a long list of ExcludeArch.
 - Use global instead of define ( https://fedoraproject.org/wiki/Packaging:Guidelines#.25global_preferred_over_.25define )
 - Remove the defintion for _libdir and _lib64dir (should already be defined)
 - Is that Requires list really necessary? ( https://fedoraproject.org/wiki/Packaging:Guidelines#Explicit_Requires )
 - Would be nice to get tests working on koji. Do they work in mock? If not, then I'm guessing that the BuildRequires list is missing something ( https://fedoraproject.org/wiki/Using_Mock_to_test_package_builds )
 - Are you hoping to target EL 5? rm/mkdir of %{buildroot} is done automatically in recent versions of rpmbuild (I believe starting with EL >= 6)
 - Setting %attr only required if supporting EL <= 5
 - Use the license macro ( compatibility workaround for EPEL can be found at https://fedoraproject.org/wiki/EPEL:Packaging#The_.25license_tag )
 - Use wildcards to reduce list in %files section
 - Can the .h and other such files be moved to a -devel package?
 - Use Python macros for paths ( https://fedoraproject.org/wiki/Packaging:Python#Macros )
 - Use %{_includedir} instead of hardcoded path to /usr/include
 - Don't use hard coded path to /usr/share/doc/* (%{_datarootdir} or maybe %doc)

Comment 9 Christopher Meng 2016-01-05 05:42:24 UTC
Please learn how to use RPM macros first, your spec is too complex. Meanwhile please rename package -docs to -doc.

Comment 10 jeremy.fergason 2016-01-06 06:48:41 UTC
I've cleaned up a lot of the comments from Dave Johansen in the spec file.  Swift doesn't like to play well in the /usr/lib64 directory ... /usr/lib is hardcoded in a number of places.  I'm looking at ways to fix this as %{_libdir} is %{prefix}/lib64 on multiline systems.

Comment 11 jeremy.fergason 2016-01-06 07:32:52 UTC
I have updated the SPEC file and SRPM:

Spec URL: https://s3-us-west-2.amazonaws.com/swift-rpm/swift-lang.spec
SRPM URL: https://s3-us-west-2.amazonaws.com/swift-rpm/swift-lang-2.2-0.1.snapshot20151231.fc23.src.rpm

The one thing that I don't know how to do is deal with the /usr/lib vs /usr/lib64 issue.  I just redefined the macro; is this the way to deal with that?

Comment 12 Dave Johansen 2016-01-06 16:10:16 UTC
(In reply to jeremy.fergason from comment #11)
> I have updated the SPEC file and SRPM:
> 
> Spec URL: https://s3-us-west-2.amazonaws.com/swift-rpm/swift-lang.spec
> SRPM URL:
> https://s3-us-west-2.amazonaws.com/swift-rpm/swift-lang-2.2-0.1.
> snapshot20151231.fc23.src.rpm

That was a big step in the right direction, but here's some more comments:
 - Release is usually just an integer (i.e. 1 instead of 0.1) and it's usually best to increment it with each change so that it's easier for reviewers to compare different versions
 - As Meng pointed out, the Source* tags should use macros so that only a single value has to be changed when a new release is made
 - Get rid of # in Source* tags and use original names in source .rpm
 - Are versions listed in BuildRequires "real" (i.e. listed in Swift documentation and/or the true minimum version required)?
 - All patches needs to have at least an issue opened upstream and documented in the .spec file what the expected resolution is ( https://fedoraproject.org/wiki/Packaging:Guidelines#All_patches_should_have_an_upstream_bug_link_or_comment )
 - I don't believe the "cd .." is necessary at the end of %prep
 - Add version to changelog entries ( https://fedoraproject.org/wiki/Packaging:Guidelines#Changelogs )

> The one thing that I don't know how to do is deal with the /usr/lib vs
> /usr/lib64 issue.  I just redefined the macro; is this the way to deal with
> that?

Is this actually building Swift or just unpacking a pre-built binary?

If it's just a pre-built binary, then this package cannot be packaged for Fedora ( https://fedoraproject.org/wiki/Packaging:Guidelines#No_inclusion_of_pre-built_binaries_or_libraries ).

If it's actually building Swift, then you should open a ticket upstream and get the issue resolved in their build system so it can play nice with Fedora.

Comment 13 Michael Schwendt 2016-01-06 17:54:42 UTC
> Release is usually just an integer (i.e. 1 instead of 0.1)

Generally, that's not true, since you seem to forget the pre-release guidelines:

  https://fedoraproject.org/wiki/Packaging:NamingGuidelines#Pre-Release_packages

And if this package really is a snapshot, there are specific guidelines for snapshots, too:

  https://fedoraproject.org/wiki/Packaging:NamingGuidelines#Snapshot_packages


> %setup -q -T -D -a 1
> %setup -q -T -D -a 2
> %setup -q -T -D -a 3
> %setup -q -T -D -a 4
> %setup -q -T -D -a 5
> %setup -q -T -D -a 6
> %setup -q -T -D -a 7
> %setup -q -T -D -a 8
> %setup -q -T -D -a 9
> %setup -q -T -D -a 10

Isn't it possibly anymore to specify -a multiple times in a single %setup invocation?


> %post -p /sbin/ldconfig
> 
> %postun -p /sbin/ldconfig

Why is ldconfig run for the base package, although the package does not store any libs in runtime linker's search path?


> %files lldb
> %{_libdir}/liblldb.so*

This subpackage wants to run ldconfig in its scriptlets.


> %{_libdir}/swift/pm/*

Lots of so-called "unowned directories" created by this package. Kindly review the following pages

  https://fedoraproject.org/wiki/Packaging:Guidelines#File_and_Directory_Ownership
  https://fedoraproject.org/wiki/Packaging:UnownedDirectories

and carefully examine directory ownership of all [sub-]packages.


> %doc %{_mandir}/man1/swift.1.gz
> %doc %{_datarootdir}/doc/swift/*

%_datarootdir/doc = %_datadir/doc = %_docdir

And both %_docdir as well as %_mandir is a path where files implicitly are marked as %doc, because it's in the %__docdir_path list. See: rpm -E %__docdir_path

Comment 14 jeremy.fergason 2016-01-07 17:30:05 UTC
> Is this actually building Swift or just unpacking a pre-built binary?

The package is being built from source; not just unpacking a pre-build binary.  The problem is that /usr/lib is hardcoded in a number of places throughout the build system.  I have been going through and trying to clean that up and providing a patch to upstream.

> Get rid of # in Source* tags and use original names in source .rpm

Since this is a snapshot from upstream not all repos required for building have tags yet.  This was my way to work around conflicting filenames.

> Release is usually just an integer (i.e. 1 instead of 0.1)

I thought this was the convention for snapshots.  As @Michael Schwendt pointed out: 

https://fedoraproject.org/wiki/Packaging:NamingGuidelines#Pre-Release_packages

> Are versions listed in BuildRequires "real" (i.e. listed in Swift documentation and/or the true minimum version required)?

Yes.

I'll take a look at the unowned directories and other comments and clean up.  Thanks for all the feedback!

Comment 15 Zbigniew Jędrzejewski-Szmek 2016-01-08 14:32:26 UTC
URLs should use https (not http) if possible. Both swift.org and github.com support https.


You should define a macro with the common parameters to build commands:
%global buildcmd \
  -swift/utils/build-script \
  --assertions \
  --no-swift-stdlib-assertions \
  --llbuild --swiftpm \
  --xctest ... \
   --reconfigure

and then use it instead of the common part in %build, %check, %install.


%files lldb
...
%{python2_sitelib}/readline.so

This looks very wrong. swift should be be installing a file with a name of an existing python module. It should also not be installing a binary file in a non-arched directory.

For the other .so files: usually the versioned libraries (*.so.*) are packaged in the library subpackage (swift-lang-lldb in this case), and the versionless .so link is packaged in the devel subpackage (swift-lang-lldb-devel) in this case.

Comment 16 Dave Johansen 2016-01-22 17:59:35 UTC
(In reply to jeremy.fergason from comment #14)
> > Get rid of # in Source* tags and use original names in source .rpm
> 
> Since this is a snapshot from upstream not all repos required for building
> have tags yet.  This was my way to work around conflicting filenames.

Could these tags be requested so that everything is uniform?

> > Release is usually just an integer (i.e. 1 instead of 0.1)
> 
> I thought this was the convention for snapshots.  As @Michael Schwendt
> pointed out: 
> 
> https://fedoraproject.org/wiki/Packaging:NamingGuidelines#Pre-
> Release_packages

Sorry about that. I forgot about that policy.

> I'll take a look at the unowned directories and other comments and clean up.
> Thanks for all the feedback!

%license is now defined in EPEL, so you can get rid of the compatibility definition that you added.
https://lists.fedoraproject.org/archives/list/epel-devel%40lists.fedoraproject.org/message/DKPU2WQ3H7XD5ELGLKGB5MV3JIMM3HIV/

Comment 17 Dave Johansen 2016-01-29 03:46:49 UTC
Just as an FYI, llvm is moving to using cmake in rawhide (F24) and is now separate packages (see bug #1300945).

Comment 18 jeremy.fergason 2016-01-29 03:48:42 UTC
Thanks!  I'm still trying to get the lib vs lib64 issue sorted with the swift developers.

Comment 19 Dennis Chen 2016-03-16 07:36:47 UTC
You may want to look into what I did for Editorconfig to get their lib/lib64 working. Hopefully you find this useful. https://barracks510.fedorapeople.org/packaging/editorconfig-install.patch

Comment 20 Roman Tsisyk 2016-04-17 09:21:31 UTC
Any news? I'm interested in this package.

Comment 21 jeremy.fergason 2016-07-18 07:15:11 UTC
I believe that I have successfully integrated all the feedback received and the RPM now installs into the appropriate lib64 directory.  It also builds in Koji, see: http://koji.fedoraproject.org/koji/taskinfo?taskID=14931923

Updated spec file:
https://raw.githubusercontent.com/jdfergason/swift-rpm/master/SPECS/swift-lang.spec

What are the next steps necessary to get this into EPEL?

Comment 22 Dave Johansen 2016-07-18 15:30:54 UTC
The main thing is performing the actual review ( https://fedoraproject.org/wiki/Package_Review_Process ) and resolving any issues that come up.

Also, have you been sponsored as a packager?

Comment 23 Dennis Chen 2016-07-18 16:31:50 UTC
It seems like there's still a lot of excessive bundling going on. I'm under the impression that a lot of these tarballs can be and should be split into separate packages, each with their own package review. Also, conflicting with LLDB is not good.

Comment 24 jeremy.fergason 2016-07-18 18:00:34 UTC
@DaveJohansen No I have not been sponsored as a packager yet.

@DennisChen I agree.  To some extent this is the way that the Swift development team views the world.  The package can be split into 3 different packages but the main package will still require a lot of bundling.

Possible packages:

Swift Compiler / REPL - Requires Sources 0, 1, 2, 3, 4, 7, 9, 11
Swift Pacakge Manager - Requires 5, 6 (depends on above)
XCTest - Requires 8 (depends on Swift Compiler)

It would also be nice to have the standard library be separate from the compiler package / REPL to ease distributing software built with swift.

Regarding the LLDB conflict I agree that it is not good but I see no way around it as that is how Swift's REPL works.  They have modified LLDB and it conflicts with the main package.

Comment 25 jeremy.fergason 2016-07-19 08:16:29 UTC
Updated SPEC to address unowned directories, remove swift package manager, and divide sub packages in a more sane way:

swiftlang (meta-package installs swiftlang-lib swiftlang-bin swiftlang-devel)
swiftlang-lib - Runtime libraries
swiftlang-bin - Compiler / REPL
swiftlang-xctest - Runtime libraries for XCTest framework (included because it is required for testing the compiler)
swiftlang-devel - Headers

New SPEC file:
https://raw.githubusercontent.com/jdfergason/swift-rpm/master/SPECS/swiftlang.spec

Possible Todos:

* Add versioning to shared libraries
* Confirm the subpackge naming convention ... specifically should a swiftlang-static
  be added for all the .a files
* Determine if *.h files used by compiler need to be moved into -devel package
  or someother package.  It seems to me that -devel should only include headers
  relevant to the standard library and Foundation.  However, the headers for clang
  and lldb are required for the compiler to work.

Comment 26 jeremy.fergason 2016-07-22 19:31:46 UTC
I got the Todos added into the most recent version of the spec file.  Swift is a complicated packaging scenario and I believe that it conforms to the Fedora Packaging Guidelines.

The one fly in the ointment is the conflict with LLDB.  I see no good way around this.  If we rename the swift version of lldb it will be confusing to users as all the swift documentation just says type lldb.  If we don't rename it then there is a conflict with the lldb package.

At this point I need a sponsor and a review.  I'm not sure how to go about getting that so until I hear otherwise the SPEC is ready to go.

https://raw.githubusercontent.com/jdfergason/swift-rpm/master/SPECS/swiftlang.spec

Comment 27 Dave Johansen 2016-08-24 14:26:44 UTC
(In reply to jeremy.fergason from comment #26)
> The one fly in the ointment is the conflict with LLDB.  I see no good way
> around this.  If we rename the swift version of lldb it will be confusing to
> users as all the swift documentation just says type lldb.  If we don't
> rename it then there is a conflict with the lldb package.

My personal opinion is that having the "official" lldb binary left as is should take precendence over catering to Swift's documentation.

The Fedora policy seems to indicate the same general feeling:
https://fedoraproject.org/wiki/Packaging:Conflicts#Binary_Name_Conflicts

Comment 28 Fedora End Of Life 2016-11-24 14:39:21 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 29 Tim Hawkins 2016-12-15 06:47:44 UTC
(In reply to jeremy.fergason from comment #26)
> I got the Todos added into the most recent version of the spec file.  Swift
> is a complicated packaging scenario and I believe that it conforms to the
> Fedora Packaging Guidelines.
> 
> The one fly in the ointment is the conflict with LLDB.  I see no good way
> around this.  If we rename the swift version of lldb it will be confusing to
> users as all the swift documentation just says type lldb.  If we don't
> rename it then there is a conflict with the lldb package.
> 
> At this point I need a sponsor and a review.  I'm not sure how to go about
> getting that so until I hear otherwise the SPEC is ready to go.
> 
> https://raw.githubusercontent.com/jdfergason/swift-rpm/master/SPECS/
> swiftlang.spec

I will give this a go on fedora 25 and see if your spec still works, we should change the version this bug relates to to f25. 

I seem to have built up a community around a "hack" script i built, and i want to retire it if possible, and redirect it to more "official" distro support.

https://github.com/FedoraSwift/fedora-swift

Comment 30 Tim Hawkins 2017-01-26 23:23:56 UTC
(In reply to jeremy.fergason from comment #26)
> I got the Todos added into the most recent version of the spec file.  Swift
> is a complicated packaging scenario and I believe that it conforms to the
> Fedora Packaging Guidelines.
> 
> The one fly in the ointment is the conflict with LLDB.  I see no good way
> around this.  If we rename the swift version of lldb it will be confusing to
> users as all the swift documentation just says type lldb.  If we don't
> rename it then there is a conflict with the lldb package.
> 
> At this point I need a sponsor and a review.  I'm not sure how to go about
> getting that so until I hear otherwise the SPEC is ready to go.
> 
> https://raw.githubusercontent.com/jdfergason/swift-rpm/master/SPECS/
> swiftlang.spec

@jeremy, do you have all the patchfiles that match your spec file? Im trying tro reproduce your package

Comment 31 Dave Johansen 2017-01-26 23:33:46 UTC
(In reply to Tim Hawkins from comment #30)
> @jeremy, do you have all the patchfiles that match your spec file? Im trying
> tro reproduce your package

It appears that they're available in the github repo that Jeremy referenced:
https://github.com/jdfergason/swift-rpm/tree/master/SOURCES

Or the SRPM linked to in this review has all of the code and patches (see comment 11).

Comment 32 Gilles Dubreuil 2017-04-27 07:59:21 UTC
A more recent and also *great* work is available with [1]

Using patch [2], I generated a Swift 3.1 RPM for Fedora 25.
It provides REPL, LLDB, Package and Foundation:

------------------------------------------
$ swift --version
Swift version 3.1 (swift-3.1-RELEASE)
Target: x86_64-unknown-linux-gnu
------------------------------------------

------------------------------------------
$ swift
Welcome to Swift version 3.1 (swift-3.1-RELEASE). Type :help for assistance.
  1> 
------------------------------------------

------------------------------------------
$ lldb --version
lldb version 4.0.0
  Swift-3.1 (revision 6309a8a39f499549676a1ac889f01d04ac823d8f)
------------------------------------------


[1] https://github.com/corinnekrych/swift-rpm
[2] https://github.com/corinnekrych/swift-rpm/pull/6

Comment 33 Ron Olson 2017-10-24 19:03:21 UTC
As an update, I have updated the scripts to build Swift 4 (waiting for Corinne to pull the request):

https://github.com/tachoknight/swift-rpm

Comment 34 Ron Olson 2017-10-24 19:07:16 UTC
One thing that would presumably need to be worked out is that there are a bunch of pulls from Github that I presume would be frowned on in that it's not a properly self-contained project. Also Fedora does not provide libBlocksRuntime for some reason, so that is yet another explicit checkout and install that wouldn't pass muster from package reviewers. 

(In reply to Ron Olson from comment #33)
> As an update, I have updated the scripts to build Swift 4 (waiting for
> Corinne to pull the request):
> 
> https://github.com/tachoknight/swift-rpm

Comment 35 Dennis Chen 2018-10-30 20:27:14 UTC

*** This bug has been marked as a duplicate of bug 1536780 ***

Comment 36 jeremy.fergason 2019-11-15 05:45:45 UTC
Closed -> duplicate


Note You need to log in before you can comment on or make changes to this bug.