question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

solution for specfile not in upstream

See original GitHub issue

Some projects do not want to have a spec file in the upstream project.

Now, we have the following solutions:

  • Create a sourcegit with the one commit containing the spec file. (needs manual sync from upstream to sourcegit.)
  • Generate or download the spec file in the post-upstream-clone hook.

What about:

  • Adding a new option (specfile_url) to the config for this situation.
  • Adding support for URL to the specfile_path option.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:24 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
phracekcommented, Jul 25, 2019
1reaction
phracekcommented, Jul 23, 2019

Well, I tested SPEC file not in upstream on rebase-helper package. I have slightly modified rebase-helper/.packit.yaml file for this test.

specfile_path: rebase-helper.spec
synced_files:
    - .packit.yml
    - rebase-helper.spec
upstream_project_name: rebase-helper
downstream_package_name: rebase-helper
actions:
    post-upstream-clone:
    - rm -f "rebase-helper.spec"
    - wget https://src.fedoraproject.org/rpms/rebase-helper/raw/master/f/rebase-helper.spec

Row rm -f rebase-helper.spec was added for sure, that SPEC file is really missing in upstream repository. I In the next step, I run command packit -d srpm

$ packit -d srpm
13:44:49.548 packit_base.py    DEBUG  logging set to DEBUG
Input is a directory: /home/vagrant/rebase-helper
13:44:49.549 local_project.py  DEBUG  working_dir is set and git_repo is not: let's discover...
13:44:49.549 local_project.py  DEBUG  it's a git repo!
13:44:49.553 local_project.py  DEBUG  remote url of the repo is git@github.com:rebase-helper/rebase-helper.git
13:44:49.553 local_project.py  DEBUG  Parsed namespace and repo name from url: rebase-helper/rebase-helper
13:44:49.554 config.py         DEBUG  The local config file '/home/vagrant/rebase-helper/.packit.yaml' not found.
13:44:49.554 config.py         DEBUG  Local package config found: /home/vagrant/rebase-helper/.packit.yml
13:44:49.556 config.py         DEBUG  Package config:
{
    "specfile_path": "rebase-helper.spec",
    "synced_files": [
        ".packit.yml",
        "rebase-helper.spec"
    ],
    "upstream_project_name": "rebase-helper",
    "downstream_package_name": "rebase-helper",
    "actions": {
        "post-upstream-clone": [
            "rm -f \"rebase-helper.spec\"",
            "wget https://src.fedoraproject.org/rpms/rebase-helper/raw/master/f/rebase-helper.spec"
        ]
    }
}
13:44:49.559 utils.py          DEBUG  can't obtain upstream_ref: 'upstream_ref'
13:44:49.560 base_git.py       DEBUG  command handler = RunCommandType.local
13:44:49.560 ogr_services.py   DEBUG  Authenticating with Github using a token.
13:44:49.560 base_git.py       DEBUG  Running ActionName.post_upstream_clone hook.
13:44:49.561 base_git.py       DEBUG  Running ActionName.post_upstream_clone.
Using user-defined script for ActionName.post_upstream_clone: ['rm -f "rebase-helper.spec"', 'wget https://src.fedoraproject.org/rpms/rebase-helper/raw/master/f/rebase-helper.spec']
13:44:49.562 utils.py          DEBUG  cmd = 'rm -f rebase-helper.spec'
13:44:49.565 utils.py          DEBUG  cmd = 'wget https://src.fedoraproject.org/rpms/rebase-helper/raw/master/f/rebase-helper.spec'
ERROR    --2019-07-23 13:44:49--  https://src.fedoraproject.org/rpms/rebase-helper/raw/master/f/rebase-helper.spec
Resolving src.fedoraproject.org (src.fedoraproject.org)... 209.132.181.15, 209.132.181.16
Connecting to src.fedoraproject.org (src.fedoraproject.org)|209.132.181.15|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7018 (6.9K) [text/plain]
Saving to: ‘rebase-helper.spec’

     0K ......                                                100% 3.10M=0.002s

2019-07-23 13:44:50 (3.10 MB/s) - ‘rebase-helper.spec’ saved [7018/7018]


13:44:50.429 utils.py          DEBUG  cmd = 'git describe --tags --match *'
13:44:50.439 upstream.py       DEBUG  version = 0.16.3-40-g4e9458a
13:44:50.439 upstream.py       DEBUG  sanitized version = 0.16.3.40.g4e9458a
Version in spec file is '0.16.3'.
13:44:50.542 base_git.py       DEBUG  Running ActionName.create_archive.
13:44:50.543 base_git.py       DEBUG  Running default implementation for ActionName.create_archive.
13:44:50.543 upstream.py       DEBUG  name + version = rebase-helper-0.16.3.40.g4e9458a
13:44:50.543 utils.py          DEBUG  cmd = 'git archive -o rebase-helper-0.16.3.40.g4e9458a.tar.gz --prefix rebase-helper-0.16.3.40.g4e9458a/ HEAD'
set version '0.16.3.40.g4e9458a' in spec
13:44:50.874 upstream.py       DEBUG  present srpms = {PosixPath('/home/vagrant/rebase-helper/rebase-helper-0.16.3.40.g4e9458a-1.fc30.src.rpm')}
13:44:50.875 utils.py          DEBUG  cmd = 'rpmbuild -bs --define _sourcedir /home/vagrant/rebase-helper --define _specdir /home/vagrant/rebase-helper --define _srcrpmdir /home/vagrant/rebase-helper --define _topdir /home/vagrant/rebase-helper --define _builddir /home/vagrant/rebase-helper --define _rpmdir /home/vagrant/rebase-helper --define _buildrootdir /home/vagrant/rebase-helper rebase-helper.spec'
13:44:51.059 upstream.py       DEBUG  Wrote: /home/vagrant/rebase-helper/rebase-helper-0.16.3.40.g4e9458a-1.fc30.src.rpm
SRPM is /home/vagrant/rebase-helper/rebase-helper-0.16.3.40.g4e9458a-1.fc30.src.rpm
SRPM: /home/vagrant/rebase-helper/rebase-helper-0.16.3.40.g4e9458a-1.fc30.src.rpm

And you can see, that wget or curl solution could be used for SPEC file not in upstream. What is missing now is to document it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ - Packit
If you do not want to have the RPM spec file in your upstream repository, you can download it in actions ... The...
Read more >
fatal: The current branch master has no upstream branch
Then the issue is that you have not configured git to always create new branches on the remote from local ones. The permanent...
Read more >
Cannot build rpms from upstream spec file on rawhide #3779
a build will fail with empty manifest files. This is a reason why it's not possible to build rpms on rawhide. There are...
Read more >
Packaging:Conflicts - Fedora Project Wiki
When renaming or putting files into subdirectories, it is a good idea to try to get upstream to rename their conflicting files (for...
Read more >
Avoiding the Top 10 NGINX Configuration Mistakes
Errors include insufficient file descriptors per worker, disabling proxy buffering, and not using upstream groups and keepalive connections.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found