Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: How to create a spec file for Atom that is suitable for the OBS?

  1. #1
    Join Date
    Nov 2015
    Location
    Townsville, Australia
    Posts
    270

    Default How to create a spec file for Atom that is suitable for the OBS?

    Hi,

    I would like to know how I might write a spec file for Atom that is suitable for the OBS. This may seem like a duplicate of this question, but that question was me looking for any solution that gave me an RPM package locally that I could install. This question is me asking whether and how I can setup an OBS repository that can build Atom, despite the fact that the OBS does not give spec files access to the Internet during the build. See I suspect it might be possible if I provide all the node modules, apm modules and the electron package source code, required for the build of Atom. I have done a Google Search and found a few similar questions to this one, including this issue at Atom's GitHub repository, but the answers have all been written for people that have an excellent knowledge of both spec files and npm, which I do not have. If it helps here is the spec file I have successfully used to build the latest stable release of Atom (1.5.2), with an Internet connection:
    Code:
    Name:           atom
    Version:        1.5.2
    Release:        0
    Summary:        A hackable text editor for the 21st century
    License:        MIT
    Group:          Productivity/Publishing/Other
    Url:            https://atom.io/
    Source0:        v%{version}.tar.gz
    Source1:        atom.desktop
    BuildRequires:  git-core
    BuildRequires:  hicolor-icon-theme
    BuildRequires:  npm
    BuildRequires:  nodejs-packaging
    BuildRequires:  libgnome-keyring-devel
    BuildRequires:  python-setuptools
    BuildRequires:  update-desktop-files
    # MANUAL BEGIN
    Requires:       nodejs
    Requires:       python-http-parser
    # MANUAL END
    BuildRoot:      %{_tmppath}/%{name}-%{version}-build
    
    
    %description
    Atom is a text editor that's modern, approachable, yet hackable to the core
    - a tool you can customize to do anything but also use productively without
    ever touching a config file.
    
    
    %prep
    %setup -q
    
    
    %build
    # Hardened package
    export CFLAGS="%{optflags} -fPIC -pie"
    export CXXFLAGS="%{optflags} -fPIC -pie"
    until ./script/build 2>&1; do :; done
    
    
    %install
    script/grunt install --install-dir "%{buildroot}%{_prefix}"
    # copy over icons in sizes that most desktop environments like
    for i in 1024 512 256 128 64 48 32 24 16; do
        install -Dm 0644 /tmp/atom-build/icons/${i}.png \
          %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png
    done
    install -Dm 0644 %{S:1} %{buildroot}%{_datadir}/applications/atom.desktop
    %suse_update_desktop_file %{name}
    
    
    %post
    %desktop_database_post
    %icon_theme_cache_post
    
    
    %postun
    %desktop_database_postun
    %icon_theme_cache_postun
    
    
    %files
    %defattr(-,root,root,-)
    %doc CONTRIBUTING.md README.md docs/
    %{license} LICENSE.md
    %{_bindir}/atom
    %{_bindir}/apm
    %dir %{_datadir}/atom
    %{_datadir}/atom/*
    %{_datadir}/atom
    %{_datadir}/applications/atom.desktop
    %{_datadir}/icons/hicolor/*/apps/%{name}.png
    %exclude %{_datadir}/%{name}/libgcrypt.so.*
    %exclude %{_datadir}/%{name}/libnotify.so.*
    
    
    %changelog
    Thanks for your time,
    Brenton
    Brenton Horne: Linux enthusiast and writer of ​The Hornery.
    Five favourite distros: Arch Linux, Fedora, openSUSE Tumbleweed, Sabayon Linux and Ubuntu.

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    22,314
    Blog Entries
    15

    Default Re: How to create a spec file for Atom that is suitable for the OBS?

    Hi
    The problem is you need to download all the sources it uses to build the various modules etc as there is no internet access (during build time) and modify/patch the build script/process to use those local sources....

    Now you could create them as _service files, run these first, then build.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE Leap 42.2 (x86_64) GNOME 3.20.2
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3

    Default Re: How to create a spec file for Atom that is suitable for the OBS?

    You may find this link useful for a start: https://en.opensuse.org/openSUSEackaging_nodejs

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    22,314
    Blog Entries
    15

    Default Re: How to create a spec file for Atom that is suitable for theOBS?

    On Fri 12 Feb 2016 05:26:02 AM CST, fusion809 wrote:

    Hi,

    I would like to know how I might write a spec file for Atom that is
    suitable for the OBS. This may seem like a duplicate of 'this question'
    (http://tinyurl.com/jtgwtxo), but that question was me looking for any
    solution that gave me an RPM package locally that I could install. This
    question is me asking whether and how I can setup an OBS repository that
    can build Atom, despite the fact that the OBS does not give spec files
    access to the Internet during the build. See I suspect it might be
    possible if I provide all the node modules, apm modules and the electron
    package source code, required for the build of Atom. I have done a
    Google Search and found a few similar questions to this one, including
    'this issue' (https://github.com/atom/atom/issues/3269) at Atom's GitHub
    repository, but the answers have all been written for people that have
    an excellent knowledge of both spec files and npm, which I do not have.
    If it helps here is the spec file I have successfully used to build the
    latest stable release of Atom (1.5.2), with an Internet connection:

    Code:
    --------------------

    Name: atom
    Version: 1.5.2
    Release: 0
    Summary: A hackable text editor for the 21st century
    License: MIT
    Group: Productivity/Publishing/Other
    Url: https://atom.io/
    Source0: v%{version}.tar.gz
    Source1: atom.desktop
    BuildRequires: git-core
    BuildRequires: hicolor-icon-theme
    BuildRequires: npm
    BuildRequires: nodejs-packaging
    BuildRequires: libgnome-keyring-devel
    BuildRequires: python-setuptools
    BuildRequires: update-desktop-files
    # MANUAL BEGIN
    Requires: nodejs
    Requires: python-http-parser
    # MANUAL END
    BuildRoot: %{_tmppath}/%{name}-%{version}-build


    %description
    Atom is a text editor that's modern, approachable, yet hackable to
    the core
    - a tool you can customize to do anything but also use productively
    without ever touching a config file.


    %prep
    %setup -q


    %build
    # Hardened package
    export CFLAGS="%{optflags} -fPIC -pie"
    export CXXFLAGS="%{optflags} -fPIC -pie"
    until ./script/build 2>&1; do :; done


    %install
    script/grunt install --install-dir "%{buildroot}%{_prefix}"
    # copy over icons in sizes that most desktop environments like
    for i in 1024 512 256 128 64 48 32 24 16; do
    install -Dm 0644 /tmp/atom-build/icons/${i}.png \
    %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png
    done
    install -Dm 0644 %{S:1}
    %{buildroot}%{_datadir}/applications/atom.desktop
    %suse_update_desktop_file %{name}

    %post
    %desktop_database_post
    %icon_theme_cache_post


    %postun
    %desktop_database_postun
    %icon_theme_cache_postun


    %files
    %defattr(-,root,root,-)
    %doc CONTRIBUTING.md README.md docs/
    %{license} LICENSE.md
    %{_bindir}/atom
    %{_bindir}/apm
    %dir %{_datadir}/atom
    %{_datadir}/atom/*
    %{_datadir}/atom
    %{_datadir}/applications/atom.desktop
    %{_datadir}/icons/hicolor/*/apps/%{name}.png
    %exclude %{_datadir}/%{name}/libgcrypt.so.*
    %exclude %{_datadir}/%{name}/libnotify.so.*


    %changelog

    --------------------


    Thanks for your time,
    Brenton


    Hi
    I also note on the Packaging ML
    https://lists.opensuse.org/opensuse-.../msg00075.html
    there has been work on nodejs packages, so a lot you may need for atom
    have already been built, you just need to work on the package.json file
    and if not on OBS, then create/submit....?

    --
    Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.25-default
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  5. #5
    Join Date
    Nov 2015
    Location
    Townsville, Australia
    Posts
    270

    Default Re: How to create a spec file for Atom that is suitable for the OBS?

    Must admit I have found the discussion so far in this thread confusing as I'm not a Node.js/npm expert, the openSUSE Wiki link wasn't particularly helpful either as I have little Node.js knowledge. What I tried as a workaround though was I compressed the /home/makerpm/BUILD/atom-1.5.3 directory I got from building Atom with the atom.spec file I'm using to build it locally to atom-1.5.3.tar.gz (as it contains all the needed downloaded files) and used it instead of v%{version}.tar.gz as Source0. The problem is that this failed giving this error:
    Code:
    No live log available: connect: Connection refused
    Here is my spec file:
    Code:
    Name:           atom
    Version:        1.5.3
    Release:        0
    Summary:        A hackable text editor for the 21st century
    License:        MIT
    Group:          Productivity/Publishing/Other
    Url:            https://atom.io/
    Source0:        %{name}-%{version}.tar.gz
    Source1:        atom.desktop
    BuildRequires:  git-core
    BuildRequires:  hicolor-icon-theme
    BuildRequires:  npm
    BuildRequires:  nodejs-packaging
    BuildRequires:  libgnome-keyring-devel
    BuildRequires:  python-setuptools
    BuildRequires:  update-desktop-files
    # MANUAL BEGIN
    Requires:       nodejs
    Requires:       python-http-parser
    # MANUAL END
    BuildRoot:      %{_tmppath}/%{name}-%{version}-build
    
    %description
    Atom is a text editor that's modern, approachable, yet hackable to the core
    - a tool you can customize to do anything but also use productively without
    ever touching a config file.
    
    %prep
    %setup -q
    
    %install
    cd $RPM_BUILD_DIR/atom-%{version}
    script/grunt install --install-dir "%{buildroot}%{_prefix}"
    # copy over icons in sizes that most desktop environments like
    for i in 1024 512 256 128 64 48 32 24 16; do
        install -Dm 0644 /tmp/atom-build/icons/${i}.png \
          %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png
    done
    install -Dm 0644 %{S:1} %{buildroot}%{_datadir}/applications/atom.desktop
    %suse_update_desktop_file %{name}
    
    %post
    %desktop_database_post
    %icon_theme_cache_post
    
    %postun
    %desktop_database_postun
    %icon_theme_cache_postun
    
    %files
    %defattr(-,root,root,-)
    %doc CONTRIBUTING.md README.md docs/
    %{license} LICENSE.md
    %{_bindir}/atom
    %{_bindir}/apm
    %dir %{_datadir}/atom
    %{_datadir}/atom/*
    %{_datadir}/atom
    %{_datadir}/applications/atom.desktop
    %{_datadir}/icons/hicolor/*/apps/%{name}.png
    %exclude %{_datadir}/%{name}/libgcrypt.so.*
    %exclude %{_datadir}/%{name}/libnotify.so.*
    
    %changelog
    Brenton Horne: Linux enthusiast and writer of ​The Hornery.
    Five favourite distros: Arch Linux, Fedora, openSUSE Tumbleweed, Sabayon Linux and Ubuntu.

  6. #6
    Join Date
    Nov 2015
    Location
    Townsville, Australia
    Posts
    270

    Default Re: How to create a spec file for Atom that is suitable for the OBS?

    After some debuging I managed to (almost) fix it, i.e., fix it, such that no errors are returned when I build it locally with
    Code:
    osc build openSUSE_Tumbleweed
    . Here is my current spec file:
    Code:
    Name:           atom
    Version:        1.5.3
    Release:        0
    Summary:        A hackable text editor for the 21st century
    License:        MIT
    Group:          Productivity/Publishing/Other
    Url:            https://atom.io/
    Source0:        %{name}-%{version}.tar.gz
    Source1:        %{name}-build-%{version}.tar.gz
    Source2:        atom.desktop
    BuildRequires:  git-core
    BuildRequires:  hicolor-icon-theme
    BuildRequires:  npm
    BuildRequires:  nodejs-packaging
    BuildRequires:  libgnome-keyring-devel
    BuildRequires:  python-setuptools
    BuildRequires:  update-desktop-files
    # MANUAL BEGIN
    Requires:       nodejs
    Requires:       python-http-parser
    # MANUAL END
    BuildRoot:      %{_tmppath}/%{name}-%{version}-build
    
    %description
    Atom is a text editor that's modern, approachable, yet hackable to the core
    - a tool you can customize to do anything but also use productively without
    ever touching a config file.
    
    %prep
    %setup -q
    tar -xzf %{S:1} -C $RPM_BUILD_DIR
    
    %install
    cd $RPM_BUILD_DIR/atom-%{version}
    script/grunt install --install-dir "%{buildroot}%{_prefix}" --build-dir $RPM_BUILD_DIR/atom-build
    # copy over icons in sizes that most desktop environments like
    for i in 1024 512 256 128 64 48 32 24 16; do
        install -Dm 0644 $RPM_BUILD_DIR/atom-build/icons/${i}.png \
          %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png
    done
    install -Dm 0644 %{S:2} %{buildroot}%{_datadir}/applications/atom.desktop
    %suse_update_desktop_file %{name}
    
    %post
    %desktop_database_post
    %icon_theme_cache_post
    
    %postun
    %desktop_database_postun
    %icon_theme_cache_postun
    
    %files
    %defattr(-,root,root,-)
    %doc CONTRIBUTING.md README.md docs/
    %{license} LICENSE.md
    %{_bindir}/atom
    %{_bindir}/apm
    %dir %{_datadir}/atom
    %{_datadir}/atom/*
    %{_datadir}/atom
    %{_datadir}/applications/atom.desktop
    %{_datadir}/icons/hicolor/*/apps/%{name}.png
    %exclude %{_datadir}/%{name}/libgcrypt.so.*
    %exclude %{_datadir}/%{name}/libnotify.so.*
    
    %changelog
    now it is returning this error message:
    Code:
    [  408s] ... checking filelist
    [  408s] atom-1.5.3-5.1.i586.rpm: directories not owned by a package:
    [  408s]  - /usr/share/icons/hicolor/1024x1024
    [  408s]  - /usr/share/icons/hicolor/1024x1024/apps
    [  408s] 
    [  408s] cloud113 failed "build atom.spec" at Tue Feb 16 12:56:56 UTC 2016.
    [  408s] 
    [  408s] ### WATCHDOG MARKER START ###
    [  411s] [  375.261551] sysrq: SysRq : Power Off
    [  411s] [  375.379608] reboot: Power down
    [  415s] ### WATCHDOG MARKER END ###
    [  415s] 
    [  415s] cloud113 failed "build atom.spec" at Tue Feb 16 12:57:04 UTC 2016.
    which I suspect will be an easier issue for someone here to help me with than what I was previously asking.
    Brenton Horne: Linux enthusiast and writer of ​The Hornery.
    Five favourite distros: Arch Linux, Fedora, openSUSE Tumbleweed, Sabayon Linux and Ubuntu.

  7. #7

    Default Re: How to create a spec file for Atom that is suitable for the OBS?

    All files/directories that exist in build root must be owned by some package. You need to either find package that owns them and add it to BuildRequires or add directories (as %dir) to file list. In principle, directory can belong to multiple packages and this is not an error as long as attributes are the same everywhere. But the former is probably more clean.

  8. #8
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    22,314
    Blog Entries
    15

    Default Re: How to create a spec file for Atom that is suitable for theOBS?

    On Tue 16 Feb 2016 01:26:01 PM CST, arvidjaar wrote:

    All files/directories that exist in build root must be owned by some
    package. You need to either find package that owns them and add it to
    BuildRequires or add directories (as %dir) to file list. In principle,
    directory can belong to multiple packages and this is not an error as
    long as attributes are the same everywhere. But the former is probably
    more clean.


    Hi
    There is that, but I would be tempted to drop a 1024x1024 icon.... or
    is this the start of having 4K screens etc?

    Might be worth a bug report to include in hicolor-icons-theme
    package....

    --
    Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.25-default
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  9. #9
    Join Date
    Nov 2015
    Location
    Townsville, Australia
    Posts
    270

    Default Re: How to create a spec file for Atom that is suitable for the OBS?

    Quote Originally Posted by arvidjaar View Post
    All files/directories that exist in build root must be owned by some package. You need to either find package that owns them and add it to BuildRequires or add directories (as %dir) to file list. In principle, directory can belong to multiple packages and this is not an error as long as attributes are the same everywhere. But the former is probably more clean.
    OK, well, this spec file's %install and %files sections are basically identical to the atom.spec file I use to build Atom locally, which is running without these errors. The /usr/share/icons/hicolor/1024x1024/ and /usr/share/icons/hicolor/1024x1024/apps directories both belong to the hicolor-icon-theme package, which is listed in BuildRequires. So suffice it to say I am confused... Is there any way you can think of, whereby I find out which directories belong to which packages? Building for openSUSE 42.1 also lists the /usr/share/licenses directory as belonging to another package. The name of said package is something that escapes me too...
    Brenton Horne: Linux enthusiast and writer of ​The Hornery.
    Five favourite distros: Arch Linux, Fedora, openSUSE Tumbleweed, Sabayon Linux and Ubuntu.

  10. #10
    Join Date
    Nov 2015
    Location
    Townsville, Australia
    Posts
    270

    Default Re: How to create a spec file for Atom that is suitable for the OBS?

    openSUSE Tumbleweed i586's build is giving me this build log (after I removed the 1024px hicolor icon that was causing the previous errors)
    Brenton Horne: Linux enthusiast and writer of ​The Hornery.
    Five favourite distros: Arch Linux, Fedora, openSUSE Tumbleweed, Sabayon Linux and Ubuntu.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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