#798 Build SRPM fails with: stderr: /bin/bash: UsernameToken: command not found
Closed: Fixed 3 years ago by praiskup. Opened 4 years ago by churchyard.

Try to build python-suds in copr:

 'source_json': {'clone_url': 'https://src.fedoraproject.org/rpms/python-suds.git',
                 'committish': 'master',
                 'spec': '',
                 'srpm_build_method': 'rpkg',
                 'subdirectory': '',
                 'type': 'git'},

master is 393aabe0f834f2c48095da1afe3a8bb391139efb now.

The SRPM build fails with:

Generated rpkg config:
[rpkg]
preprocess_spec = True
# auto-packing is deprecated:
auto_pack = True

[git]
lookaside = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
anongiturl = https://src.fedoraproject.org/%(module)s

Writing config into /tmp/tmpy1dbx0o2/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results63k44rwz --spec /tmp/tmpy1dbx0o2/python-suds

cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results63k44rwz', '--spec', '/tmp/tmpy1dbx0o2/python-suds']
cwd: /tmp/tmpy1dbx0o2/python-suds
rc: 0
stdout: Downloading 94664ddd46a6.tar.bz2 from lookaside cache at src.fedoraproject.org
stderr: /bin/bash: UsernameToken: command not found
UsernameToken failed with value 127

Output: []

Trying to reproduce in a different copr now, but the build is pending.

https://copr.fedorainfracloud.org/coprs/churchyard/dirty-tests/build/934422/


Reproduced. Copied here for reference:

Warning: Permanently added '172.25.85.232' (ECDSA) to the list of known hosts.
Running: /usr/bin/copr-rpmbuild --verbose --drop-resultdir --srpm --build-id 934422 --detached default
Version: 0.29
Task:
{'build_id': 934422,
 'chroot': None,
 'project_dirname': 'dirty-tests',
 'project_name': 'dirty-tests',
 'project_owner': 'churchyard',
 'source_json': {'clone_url': 'https://src.fedoraproject.org/rpms/python-suds.git',
                 'committish': '393aabe0f834f2c48095da1afe3a8bb391139efb',
                 'spec': '',
                 'srpm_build_method': 'rpkg',
                 'subdirectory': '',
                 'type': 'git'},
 'source_type': 8,
 'task_id': '934422'}

Running: git clone https://src.fedoraproject.org/rpms/python-suds.git /tmp/tmpn70u0kei/python-suds --depth 500 --no-single-branch

cmd: ['git', 'clone', 'https://src.fedoraproject.org/rpms/python-suds.git', '/tmp/tmpn70u0kei/python-suds', '--depth', '500', '--no-single-branch']
cwd: .
rc: 0
stdout: 
stderr: Cloning into '/tmp/tmpn70u0kei/python-suds'...

Running: git checkout 393aabe0f834f2c48095da1afe3a8bb391139efb

cmd: ['git', 'checkout', '393aabe0f834f2c48095da1afe3a8bb391139efb']
cwd: /tmp/tmpn70u0kei/python-suds
rc: 0
stdout: 
stderr: Note: checking out '393aabe0f834f2c48095da1afe3a8bb391139efb'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 393aabe Adapt to support pytest4 (#1706285)

Generated rpkg config:
[rpkg]
preprocess_spec = True
# auto-packing is deprecated:
auto_pack = True

[git]
lookaside = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
anongiturl = https://src.fedoraproject.org/%(module)s

Writing config into /tmp/tmpn70u0kei/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/resultsw0hpzpnj --spec /tmp/tmpn70u0kei/python-suds

cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/resultsw0hpzpnj', '--spec', '/tmp/tmpn70u0kei/python-suds']
cwd: /tmp/tmpn70u0kei/python-suds
rc: 0
stdout: Downloading 94664ddd46a6.tar.bz2 from lookaside cache at src.fedoraproject.org
stderr: /bin/bash: UsernameToken: command not found
UsernameToken failed with value 127

Output: []

Thanks for reporting this; it is caused by {{{ UsernameToken }}} which comes from %changelog; and it is because that {{{ ... }}} stuff is parsed by rpkg-util, because we have preprocess_spec = True set in default rpkg.conf, because we on some other places need that.

For this use-case, we should be really using smaller hammer than rpkg-util (e.g. fedpkg-minimal).

You can work-around this by removing the UsernameToken from the %changelog, but it's somewhat ugly to pay for copr issues in the package itself.

Metadata Update from @praiskup:
- Issue tagged with: bug

4 years ago

I've workarounded it by uploading the SRPM manually.

BTW I guess this failure in gdb is caused by similar magic?

[rpkg]
preprocess_spec = True
# auto-packing is deprecated:
auto_pack = True

[git]
lookaside = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
anongiturl = https://src.fedoraproject.org/%(module)s

Writing config into /tmp/tmpbnv7nen4/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/resultsiyj7d4jy --spec /tmp/tmpbnv7nen4/gdb

cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/resultsiyj7d4jy', '--spec', '/tmp/tmpbnv7nen4/gdb']
cwd: /tmp/tmpbnv7nen4/gdb
rc: 0
stdout: Downloading gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz from lookaside cache at src.fedoraproject.org

Downloading v2.0.tar.gz from lookaside cache at src.fedoraproject.org

Downloading gdb-8.3.50.20190610.tar.xz from lookaside cache at src.fedoraproject.org

Wrote: /var/lib/copr-rpmbuild/resultsiyj7d4jy/gdb.spec
stderr: warning: Macro expanded in comment on line 44: %{tarname}.tar.xz

error: Unable to open /var/lib/copr-rpmbuild/resultsiyj7d4jy/_gdb.spec.Patch.include: No such file or directory
can't parse specfile

Output: ['gdb.spec']

Nope, this is different problem - smells like something in rpkg-util (maybe, maybe it is just design). But clearly we are mixing two things in copr -- building from dist-git VS SCM methods. The former should be either done directly by copr-rpmbuild or by fedpkg-minimal, and the letter should be (optionally) handled by rpkg-util.

This issue still hits us with python-suds. We'd appreciate preprocess_spec = False to be the default or at least an option.

Would you be OK to put the preprocess_spec = False option to the affected
dist-git projects for now, to ./rpkg.conf file:

[rpkg]
preprocess_spec = False

?

For me, that would work. How do I do that?

For a long term solution, this is probably better: https://pagure.io/copr/copr/issue/529

For me, that would work. How do I do that?

By creating rpkg.conf file in the root of the package git repo (alongside the spec file).

For a long term solution, this is probably better: https://pagure.io/copr/copr/issue/529

Agreed.

By creating rpkg.conf file in the root of the package git repo (alongside the spec file).

Oh, sorry, that would not work at all, I won't push this to packages in Fedora, especially to packages I don't maintain.

I always claimed that additional metadata "for copr" is no-go, so I
understand ... though PRs could be acceptable by maintainers in this case
(temporary work-arounds).

You could also temporarily configure "custom" method for problematic package, and
use the fedpkg-minimal package for downloading sources.

How does the Auto-rebuild option work with custom?

I missed this question, sorry:

How does the Auto-rebuild option work with custom?

Custom method is supposed to be triggered by "custom webhook". The thing is that
with custom method, we have no clone_url to match the webhook content with:
https://docs.pagure.org/copr.copr/custom_source_method.html

The new copr-rpmbuild will use copr-distgit-client script, which should fix this problem. Tested by@churchyard, thank you!

Metadata Update from @praiskup:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #1478 Merged 3 years ago