Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fedora build files #166

Closed
wants to merge 2 commits into from
Closed

Fedora build files #166

wants to merge 2 commits into from

Conversation

orbisvicis
Copy link

Details in notes.md

fedora/copyright Outdated
Source: https://github.com/Sonarr/Sonarr

Files: *
Copyright: 2010-2014 Sonarr <hello@sonarr.tv>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob 2015 now ;) 🎆

@kayone
Copy link
Member

kayone commented Jan 5, 2015

Thank you for this! definitely something we want to get included. couple of questions,

  • Is there something Fedora specific here? or can we just make this an rpm thing rather than Fedora?

@kayone
Copy link
Member

kayone commented Jan 5, 2015

We would ideally want to have our own rpm repo just like we do for debian, it would be great if you could give us some help with that.

Incorporate suggested pull-request changes.
@orbisvicis
Copy link
Author

Is there something Fedora specific here? or can we just make this an rpm thing rather than Fedora?

Probably nothing fedora-specific, though I'm not sure. It is possible the macro scriptlets - Requires(pre|post|preun|postun) - of the systemd and shadow-utils packages are fedora-specific.

@orbisvicis
Copy link
Author

We would ideally want to have our own rpm repo just like we do for debian, it would be great if you could give us some help with that.

Though I'm pretty new to fedora myself, I would:

  1. Determine repository name and public uri

  2. Get a fedora machine/vm

  3. Install development environment and fedora build tools

    yum install @development-tools fedora-packager rpm-sign
    
  4. Install repoview (optional) for repository web-ui

    yum install repoview
    
  5. Create the directory containing the source build files

    for package in sonarr "${repository-name}-release"; do
        mkdir -p "/path/to/packages/${package}/"{RPMS,SRPMS,BUILD,SPECS,SOURCES}
    done
    
  6. Create the directory containing the repository

    for release in 20 21; do
        mkdir -p "/path/to/repository/fedora/releases/${release}/"{source/SRPMS,noarch}
        mkdir -p "/path/to/repository/fedora/releases/${release}/"{i386,x86_64}/{os,debug}
    done
    
  7. Create PGP signing key

    gpg --gen-key
    
  8. Configure RPM package signing

    printf "%s\n" "%_signature gpg" >>~/.rpmmacros
    # make sure to get the right uid
    gpg --list-keys | sed -n 's#^uid:\s*\(.*\)#%_gpg_name \1#p' >>~/.rpmmacros
    
  9. Create repository release package

    cd "/path/to/packages/${repository-name}-release"
    cd SOURCES
    
    gpg --export --armor "${GPG_ID}" >"RPM-GPG-KEY-${repository-name}"
    
    cat <<EOF >"${repository-name}.repo"
    # modelled after rpmfusion/livna
    ["${repository-name}"]
    name="${repository-name^}" for Fedora $releasever
    baseurl="${repository-uri}"'/fedora/releases/$releasever/$basearch/os/'
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-${repository-name}-$releasever
    
    ["${repository-name}-debuginfo"]
    name="${repository-name^}" for Fedora $releasever - Debug
    baseurl="${repository-uri}"'/fedora/releases/$releasever/$basearch/debug/'
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-${repository-name}-$releasever
    
    ["${repository-name}-source"]
    name="${repository-name^}" for Fedora $releasever - Source
    baseurl="${repository-uri}"'/fedora/releases/$releasever/source/SRPMS/'
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-${repository-name}-$releasever
    EOF
    
    cd ../SPECS
    # modelled after rpmfusion/livna
    cat <<EOF >"${repository-name}-release.spec"
    Name:           ${repository-name}-release"
    Version:        1
    Release:        1
    Summary:        ${repository-name^} Repository Configuration
    
    License:        GPLv3
    URL:            ${upstream-url}
    Source1:        ${repository-name}.repo
    Source2:        RPM-GPG-KEY-${repository-name}
    BuildArch:      noarch
    
    
    %description
    <put description here>
    
    %prep
    echo "Nothing to prep"
    
    %build
    echo "Nothing to build"
    
    %install
    
    # Create dirs
    install -m 0755 -d \
      %{buildroot}%{_sysconfdir}/pki/rpm-gpg  \
      %{buildroot}%{_sysconfdir}/yum.repos.d
    
    # GPG Key
    install -m 0644 -p \
        %{SOURCE2} \
        %{buildroot}%{_sysconfdir}/pki/rpm-gpg
    
    # Yum .repo files
    install -m0644 -p \
        %{SOURCE1}
        %{buildroot}%{_sysconfdir}/yum.repos.d
    
    
    %files
    %{_sysconfdir}/pki/rpm-gpg/*
    %config(noreplace) %{_sysconfdir}/yum.repos.d/*
    
    %changelog
    * <date> <name> <email> - 1-1
    - <put changelog here>
    EOF
    
  10. Configure mock (optional)

    cd /etc/mock
    # configure site-defaults.cfg if necessary
    # configure other files if necessary
    
  11. create repository

    for release in 20, 21; do
        for arch in i386 x86_64 source noarch; do
            for version in os debug; do
                path="/path/to/repository/fedora/release/${release}/${arch}/${version}"
                createrepo "$path"
                repoview "$path"
                gpg --detach-sign --armor "${path}/repodata/repomd.xml"
            done
        done
    done
    
  12. build and install new/modified packages

    packages=(sonarr "${repository-name}-release")
    for release in 20 21; do
        for arch in x86_64 i386; do
            chroot="fedora-${release}-${arch}"
            for package in "${packages[@]}"; do
                pathsrc="/path/to/packages/${package}"
                pathrpo="/path/to/repository/fedora/release/${release}"
                pathmck="${mock-basedir}/${chroot}/result"
                cd "$pathsrc"
                spectool --directory "${pathsrc}/SOURCES" "${pathsrc}/SPECS/"*.spec
                # couldn't figure out how to properly separate the
                # srpm/debuginfo/regular rpm packages
                mock \
                    --root "$chroot" \
                    --buildsrpm \
                    --sources "${pathsrc}/SOURCES" \
                    --spec "${pathsrc}/SPECS/"*.spec \
                mock \
                    --root "$chroot" \
                    --rebuild "${pathmck}/"*.src.rpm
                rpm --addsign "${pathmck}/"*.rpm
                # hopefully no packages are named "*debuginfo*"
                mv "${pathmck}/"*.src.rpm "${pathrpo}/source/SRPMS"
                mv "${pathmck}/"*debuginfo*.rpm "${pathrpo}/${arch}/debug"
                mv "${pathmck}/"*.rpm "${pathrpo}/${arch}/os"
            done
        done
    done
    
  13. update repository

    for release in 20, 21; do
        for arch in i386 x86_64 source noarch; do
            for version in os debug; do
                path="/path/to/repository/fedora/release/${release}/${arch}/${version}"
                createrepo --update "$path"
                repoview "$path"
                gpg --detach-sign --armor "${path}/repodata/repomd.xml"
            done
        done
    done
    
  14. Instruct users

    su -c 'yum localinstall --nogpgcheck "${repository-uri}"/fedora/releases/$(rpm -E %fedora)/noarch/os/"${repository-name}-release-${version}-${release}".noarch.rpm'
    

Of course, the repository has to be made public somehow, and you'll probably want to integrate build-failure detection in the final script.

Resources:

Type=simple
User=sonarr
PIDFile=/var/lib/sonarr/.config/NzbDrone/nzbdrone.pid
ExecStart=/usr/bin/mono /opt/sonarr/NzbDrone.exe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--debug to get lines in logs?

@halkeye
Copy link
Contributor

halkeye commented Jun 28, 2015

I don't know if its very applicable in this case (haven't actually used it yet) but have you looked at fpm yet?

@Taloth Taloth added the v3 label Jan 23, 2016
@Taloth Taloth force-pushed the develop branch 2 times, most recently from 443e065 to 766520b Compare May 12, 2017 22:17
@freiheit freiheit mentioned this pull request Nov 10, 2020
6 tasks
@markus101 markus101 closed this Dec 18, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants