Where Can I Find The Source Code of Fedora 28?
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 10 of 10
  1. #1
    Join Date
    May 2018
    Location
    Canada
    Posts
    23
    Linux (Fedora) Firefox 61.0

    Where Can I Find The Source Code of Fedora 28?

    Forgive me if this is a stupid question. I am curious to know where can I find the source code of Fedora 28 Operating system. I just installed it in my computer. Now I wish to have a look at the source code of the base operating system .

    Any idea ?

  2. #2
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    7,401
    Unknown Firefox 61.0

    Re: Where Can I Find The Source Code of Fedora 28?

    It's the combined thousands and thousands of fedora src rpms you can get with dnf

  3. #3
    Join Date
    Oct 2010
    Location
    Canberra
    Posts
    3,003
    Linux Firefox 52.0

    Re: Where Can I Find The Source Code of Fedora 28?

    You might try these:

    The "base operating system" is Linux
    https://www.kernel.org/
    https://www.mjmwired.net/kernel/Documentation/

    On top of Linux there are various modules, such as systemd ( https://www.freedesktop.org/wiki/Software/systemd/ ),
    and udev ( https://en.wikipedia.org/wiki/Udev https://git.kernel.org/pub/scm/linux/hotplug/udev.git )

    Many of the command line programs are provided by Gnu CoreUtils ( https://www.gnu.org/software/coreutils/coreutils.html )

    The default GUI interface for Fedora is provided by Gnome

    User error. Please replace user and try again

  4. #4
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,804
    Linux Chrome 67.0.3396.99

    Re: Where Can I Find The Source Code of Fedora 28?

    Not a stupid question at all, but the answer isn't simple. The Fedora OS isn't just one big "thing" in and of itself. It is comprised of hundreds of components. Almost all of those components are part of some rpm package. Each *.rpm package has a corresponding *.src.rpm package, which are kept in a separate branch of the main repo which are disabled by default.

    Just do a "dnf repolist all" command and you will see the others, including the *-source repos. You can download any *src.rpm you desire to examine. Use the format:
    Code:
    # dnf download --source <packagename>
    Say I wanted to download the SRPM for the mousepad package. It would go like this:
    Code:
    $ sudo dnf download --source mousepad
    enabling updates-source repository
    enabling fedora-source repository
    enabling rpmfusion-free-updates-source repository
    enabling rpmfusion-free-source repository
    enabling rpmfusion-nonfree-updates-source repository
    enabling rpmfusion-nonfree-source repository
    Fedora 28 - Updates Source                                                                                       640 kB/s | 2.2 MB     00:03    
    RPM Fusion for Fedora 28 - Free - Updates Source                                                                 134 kB/s |  25 kB     00:00    
    RPM Fusion for Fedora 28 - Nonfree - Updates Source                                                               72 kB/s |  10 kB     00:00    
    Last metadata expiration check: 0:00:00 ago on Thu 28 Jun 2018 08:24:53 PM EDT.
    mousepad-0.4.1-1.fc28.src.rpm                                                                                    533 kB/s | 643 kB     00:01
    And now here the fun part begins. So you're gonna ask..."well, what do I do with that package to get to the source code?" You could research the cpio command to see how to unravel that .src.rpm package into it's individual components, or, better yet, use the rpm command to install it (as user, in your user home directory.

    For the latter you'll need a few tools:
    Code:
    # dnf install rpm-build redhat-rpm-config rpmdevtools
    Once done with that, in your user home directory, as user, using the mousepad SRPM as example, give commands:
    Code:
    $ rpmdev-setuptree
    $ rpm -ivh mousepad-0.4.1-1.fc28.src.rpm
    You will end up with a new directory named rpmbuild with some sub-directories under it. You could actually skip the rpmdev-setuptree command because just doing the rpm -ivh command on the SRPM would automatically trigger setting up that directory tree in the process. And the installed mousepad source code package would looke like this from the tree command:
    Code:
    $ tree rpmbuild
    rpmbuild
    ├── BUILD
    ├── BUILDROOT
    ├── RPMS
    │   ├── i386
    │   ├── noarch
    │   └── x86_64
    ├── SOURCES
    │   └── mousepad-0.4.1.tar.bz2
    ├── SPECS
    │   └── mousepad.spec
    └── SRPMS
    Two files, the tarred and compressed source code file and the package spec file (which controls building the rpm package from the source code tarball). Now all you'd have to do it uncompress/untar that .tar.bz2 package to wherever you wanted to have a look at the source code. You can do that in one command with tar.
    Code:
    $ tar xjf rpmbuild/SOURCES/mousepad-0.4.1.tar.bz2 -C src
    And the result of that is:
    Code:
    ls src/
    baifaao.cpp  baifaao.so  moc  mousepad-0.4.1  pianobar-2018.06.22  pianobar-2018.06.22.tar.bz2
    So lets go have a look...
    Code:
    $ cd src/mousepad-0.4.1/ ; ls
    aclocal.m4  compile       config.sub    COPYING  install-sh           intltool-update.in  Makefile.in  mousepad.desktop.in.in  README
    AUTHORS     config.guess  configure     depcomp  intltool-extract.in  ltmain.sh           missing      NEWS                    THANKS
    ChangeLog   config.h.in   configure.ac  INSTALL  intltool-merge.in    Makefile.am         mousepad     po                      TODO
    The bulk of the source code being in the mousepad directory.

    Or..... you could just go to the koji build server and download the *.src.rpm from there in a browser. Just enter the package name in the search field in upper right from the link I gave here, then choose the version/release and click on that. The SRPM will have a (download) option on it.

  5. #5
    Join Date
    May 2018
    Location
    Canada
    Posts
    23
    Linux (Fedora) Firefox 61.0

    Re: Where Can I Find The Source Code of Fedora 28?

    Quote Originally Posted by PabloTwo
    Not a stupid question at all, but the answer isn't simple. The Fedora OS isn't just one big "thing" in and of itself. It is comprised of hundreds of components. Almost all of those components are part of some rpm package. Each *.rpm package has a corresponding *.src.rpm package, which are kept in a separate branch of the main repo which are disabled by default.

    Just do a "dnf repolist all" command and you will see the others, including the *-source repos. You can download any *src.rpm you desire to examine. Use the format:
    Code:
    # dnf download --source <packagename>
    Say I wanted to download the SRPM for the mousepad package. It would go like this:
    Code:
    $ sudo dnf download --source mousepad
    enabling updates-source repository
    enabling fedora-source repository
    enabling rpmfusion-free-updates-source repository
    enabling rpmfusion-free-source repository
    enabling rpmfusion-nonfree-updates-source repository
    enabling rpmfusion-nonfree-source repository
    Fedora 28 - Updates Source                                                                                       640 kB/s | 2.2 MB     00:03    
    RPM Fusion for Fedora 28 - Free - Updates Source                                                                 134 kB/s |  25 kB     00:00    
    RPM Fusion for Fedora 28 - Nonfree - Updates Source                                                               72 kB/s |  10 kB     00:00    
    Last metadata expiration check: 0:00:00 ago on Thu 28 Jun 2018 08:24:53 PM EDT.
    mousepad-0.4.1-1.fc28.src.rpm                                                                                    533 kB/s | 643 kB     00:01
    And now here the fun part begins. So you're gonna ask..."well, what do I do with that package to get to the source code?" You could research the cpio command to see how to unravel that .src.rpm package into it's individual components, or, better yet, use the rpm command to install it (as user, in your user home directory.

    For the latter you'll need a few tools:
    Code:
    # dnf install rpm-build redhat-rpm-config rpmdevtools
    Once done with that, in your user home directory, as user, using the mousepad SRPM as example, give commands:
    Code:
    $ rpmdev-setuptree
    $ rpm -ivh mousepad-0.4.1-1.fc28.src.rpm
    You will end up with a new directory named rpmbuild with some sub-directories under it. You could actually skip the rpmdev-setuptree command because just doing the rpm -ivh command on the SRPM would automatically trigger setting up that directory tree in the process. And the installed mousepad source code package would looke like this from the tree command:
    Code:
    $ tree rpmbuild
    rpmbuild
    ├── BUILD
    ├── BUILDROOT
    ├── RPMS
    │   ├── i386
    │   ├── noarch
    │   └── x86_64
    ├── SOURCES
    │   └── mousepad-0.4.1.tar.bz2
    ├── SPECS
    │   └── mousepad.spec
    └── SRPMS
    Two files, the tarred and compressed source code file and the package spec file (which controls building the rpm package from the source code tarball). Now all you'd have to do it uncompress/untar that .tar.bz2 package to wherever you wanted to have a look at the source code. You can do that in one command with tar.
    Code:
    $ tar xjf rpmbuild/SOURCES/mousepad-0.4.1.tar.bz2 -C src
    And the result of that is:
    Code:
    ls src/
    baifaao.cpp  baifaao.so  moc  mousepad-0.4.1  pianobar-2018.06.22  pianobar-2018.06.22.tar.bz2
    So lets go have a look...
    Code:
    $ cd src/mousepad-0.4.1/ ; ls
    aclocal.m4  compile       config.sub    COPYING  install-sh           intltool-update.in  Makefile.in  mousepad.desktop.in.in  README
    AUTHORS     config.guess  configure     depcomp  intltool-extract.in  ltmain.sh           missing      NEWS                    THANKS
    ChangeLog   config.h.in   configure.ac  INSTALL  intltool-merge.in    Makefile.am         mousepad     po                      TODO
    The bulk of the source code being in the mousepad directory.

    Or..... you could just go to the koji build server and download the *.src.rpm from there in a browser. Just enter the package name in the search field in upper right from the link I gave here, then choose the version/release and click on that. The SRPM will have a (download) option on it.
    Thanks so much. You really explained it nicely. I just need to spend some time to understand how the source code is organized.I really appreciate your help.

    If I do all the above mentioned task as a root user , is that be a problem ?
    Last edited by LEON71; 29th June 2018 at 03:20 PM.

  6. #6
    Join Date
    Oct 2010
    Location
    Canberra
    Posts
    3,003
    Linux Firefox 52.0

    Re: Where Can I Find The Source Code of Fedora 28?

    Quote Originally Posted by LEON71
    Thanks so much. You really explained it nicely. I just need to spend some time to understand how the source code is organized.I really appreciate your help.

    If I do all the above mentioned task as a root user , is that be a problem ?
    Perhaps we should mention that the source rpms that PabloTwo described are packaged for Fedora, but the source code is drawn from many other sources (such as in my above post). Hence, if you just want to have a look at the source of some package then use the source rpms, but if you ever want to dig deeper and see what the actual developers are doing then you will need to go to the development projects (usually on github, or sourceforge, or savannah)

    It is not good practice to do your routine stuff as the root user. An accidental wrong command can do significant damage to your system - and you will eventually slip up.

    User error. Please replace user and try again

  7. #7
    Join Date
    May 2018
    Location
    Canada
    Posts
    23
    Linux (Fedora) Firefox 61.0

    Re: Where Can I Find The Source Code of Fedora 28?

    Quote Originally Posted by ocratato
    Perhaps we should mention that the source rpms that PabloTwo described are packaged for Fedora, but the source code is drawn from many other sources (such as in my above post). Hence, if you just want to have a look at the source of some package then use the source rpms, but if you ever want to dig deeper and see what the actual developers are doing then you will need to go to the development projects (usually on github, or sourceforge, or savannah)

    It is not good practice to do your routine stuff as the root user. An accidental wrong command can do significant damage to your system - and you will eventually slip up.
    Yes you are right . Once I broke dnf accidentally and i had to re-install the entire system again.

  8. #8
    Join Date
    May 2018
    Location
    Canada
    Posts
    23
    Linux (Fedora) Firefox 61.0

    Re: Where Can I Find The Source Code of Fedora 28?

    OK. I am trying to understand the structure step by step. Here is my understanding so far :

    1.Fedora is comprised of hundreds of components.

    2.This components are built with hundreds of thousands of rpm packages - at this point how can I see all the rpm packages installed in my pc in command line ?

    3.Each rpm package has a corresponding src.rpm package.which are kept in a separate branch of the main repo which are disabled by default.

    4. Now when I run dnf repolist all then I can see a list of rpm folder name.From there I can see the *-source repos. Below is the selected source file that I can see from my list :

    fedora-source Fedora 28 - Source disabled
    rpmfusion-free-source RPM Fusion for Fedor disabled
    rpmfusion-free-updates-source RPM Fusion for Fedor disabled
    rpmfusion-free-updates-testing-source RPM Fusion for Fedor disabled
    pmfusion-nonfree-nvidia-driver-source RPM Fusion for Fedor disabled
    rpmfusion-nonfree-source RPM Fusion for Fedor disabled
    rpmfusion-nonfree-steam-source RPM Fusion for Fedor disabled
    rpmfusion-nonfree-updates-source RPM Fusion for Fedor disabled
    rpmfusion-nonfree-updates-testing-source RPM Fusion for Fedor disabled
    updates-source Fedora 28 - Updates disabled
    updates-testing-source Fedora 28 - Test Upd disabled


    5.Now when it comes to this command: # dnf download --source <packagename> the confusion is I wish to choose a rpm package.But I cant see any rpm package list ?

    PabloTwo can you help ?

  9. #9
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    7,804
    Linux Chrome 67.0.3396.99

    Re: Where Can I Find The Source Code of Fedora 28?

    2) Two ways, but this will be a huge list:
    Code:
     rpm -qa
    Code:
    dnf list installed
    You can pipe the output of either of the above commands by adding "| tee myinstalledpackages.txt" to the end. The list of packages you see on your screen will be piped to a text file (give it whatever name you please). rpm maintains the database that holds the info on installed packages.

    On my laptop I piped it to wc (word count), counting lines only to get a count of the packages.
    Code:
    $ sudo dnf list installed | wc -l
    1965
    4) I'm not sure what you're trying to say here. The "dnf repolist all" is just telling you which online repositories are configured on your system, and letting you know which ones are enabled and disabled. This is just showing the repositories, not whats available in them. This information is taken from your .repo files located in /etc/yum.repos.d/.

    5) Again, I don't quite understand what you're asking here. What "list" are you expecting to see and where? The "dnf download --source <packagename>" command will enable all of disabled *-source repositories temporarily just for this instance and download the source rpm package with the name that you specify from whichever repository it resides in. You just use the base name of the package (such as "mousepad" in the example I showed you earlier. It's up to you to know the name of the package you want the source code package for.

    You can use "dnf search <searchstring>" to help get a list of packages that might be associated with the search string you provided.
    Last edited by PabloTwo; 30th June 2018 at 06:18 AM.

  10. #10
    Join Date
    Oct 2011
    Posts
    1,880
    Linux Chrome 66.0.3359.170

    Re: Where Can I Find The Source Code of Fedora 28?

    You don't have to download the source package to look at the package source. The Fedora packages source repository is hosted at src.fedoraproject.org or its alternative interface cgit at src.fedoraproject.org/cgit.

Similar Threads

  1. How Can I see The source code of fedora 9
    By abhijitsarangi in forum EOL (End Of Life) Versions
    Replies: 4
    Last Post: 1st June 2014, 02:25 AM
  2. Cant find source code, after installation
    By adithyapwav in forum Installation, Upgrades and Live Media
    Replies: 3
    Last Post: 8th June 2010, 09:19 AM
  3. Source code from a Mac on Fedora
    By OffbeatPatriot in forum Programming & Packaging
    Replies: 2
    Last Post: 19th June 2008, 03:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •