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

Command line option "patch-file" doesn't work as expected #184

Open
Jaimecclin opened this issue Sep 3, 2021 · 0 comments
Open

Command line option "patch-file" doesn't work as expected #184

Jaimecclin opened this issue Sep 3, 2021 · 0 comments

Comments

@Jaimecclin
Copy link

Hi,

I tried to use a "git" patch file in stdeb but found this functionality couldn't work well in my patch.

OS: Ubuntu 20.04
Stdeb Version: 0.10.0
Python Version: 3.8

Herewith is the output:

Writing lw-virt-0.0.6-g83a9cbf/setup.cfg
creating dist
Creating tar archive
removing 'lw-virt-0.0.6-g83a9cbf' (and everything under it)
PATCH COMMAND: /usr/bin/patch -p0 < /s/patch/deb_py3_shebang.patch
  PATCHING in dir: deb_dist/lw-virt-0.0.6-g83a9cbf
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/lw-virt b/lw-virt
|index 0619c27..ed2ee37 100755
|--- a/lw-virt
|+++ b/lw-virt
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
1 out of 1 hunk ignored
ERROR running: /usr/bin/patch -p0
ERROR in deb_dist/lw-virt-0.0.6-g83a9cbf
Traceback (most recent call last):
  File "setup.py", line 47, in <module>
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.8/dist-packages/stdeb/command/sdist_dsc.py", line 137, in run
    build_dsc(debinfo,
  File "/usr/local/lib/python3.8/dist-packages/stdeb/util.py", line 1383, in build_dsc
    apply_patch(debinfo.patch_file,
  File "/usr/local/lib/python3.8/dist-packages/stdeb/util.py", line 644, in apply_patch
    raise RuntimeError('returncode %d' % returncode)
RuntimeError: returncode 1

Apparently, the option -p0 can't go through patch command... I'm confused anyone has used -patch-file option?
Sometimes this causes the need for the input string. But the fact we can't give any input.

I suggest we can't use an option to decide whether to go to -p.

I went through the cod and revised this part for myself. However, another problem was found.

Writing lw-virt-0.0.6-g83a9cbf/setup.cfg
Creating tar archive
removing 'lw-virt-0.0.6-g83a9cbf' (and everything under it)
PATCH COMMAND: /usr/bin/patch < /s/patch/deb_py3_shebang.patch
  PATCHING in dir: deb_dist/lw-virt-0.0.6-g83a9cbf
patching file lw-virt
dpkg-buildpackage: info: source package lw-virt
dpkg-buildpackage: info: source version 0.0.6-g83a9cbf-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Chen Wen, Jack Lin, Amin Wang <[email protected], [email protected], [email protected]>
 dpkg-source --before-build .
dpkg-source: info: using options from lw-virt-0.0.6-g83a9cbf/debian/source/options: --extend-diff-ignore=\.egg-info$
 debian/rules clean
dh clean --with python3 --buildsystem=python_distutils
   debian/rules override_dh_auto_clean
make[1]: Entering directory '/s/deb_dist/lw-virt-0.0.6-g83a9cbf'
python3 setup.py clean -a
/usr/lib/python3/dist-packages/setuptools/dist.py:481: UserWarning: The version specified ('0.0.6-114-g83a9cbf') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  warnings.warn(
running clean
'build/lib' does not exist -- can't clean it
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.8' does not exist -- can't clean it
find . -name \*.pyc -exec rm {} \;
make[1]: Leaving directory '/s/deb_dist/lw-virt-0.0.6-g83a9cbf'
   dh_clean -O--buildsystem=python_distutils
 dpkg-source -b .
dpkg-source: info: using options from lw-virt-0.0.6-g83a9cbf/debian/source/options: --extend-diff-ignore=\.egg-info$
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building lw-virt using existing ./lw-virt_0.0.6-g83a9cbf.orig.tar.gz
dpkg-source: info: local changes detected, the modified files are:
 lw-virt-0.0.6-g83a9cbf/lw-virt
dpkg-source: info: you can integrate the local changes with dpkg-source --commit
dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/lw-virt_0.0.6-g83a9cbf-1.diff.ndbWzp
dpkg-buildpackage: error: dpkg-source -b . subprocess returned exit status 2
Traceback (most recent call last):
  File "setup.py", line 47, in <module>
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.8/dist-packages/stdeb/command/sdist_dsc.py", line 137, in run
    build_dsc(debinfo,
  File "/usr/local/lib/python3.8/dist-packages/stdeb/util.py", line 1569, in build_dsc
    dpkg_buildpackage(*args, cwd=fullpath_repackaged_dirname)
  File "/usr/local/lib/python3.8/dist-packages/stdeb/util.py", line 585, in dpkg_buildpackage
    process_command(args, cwd=cwd)
  File "/usr/local/lib/python3.8/dist-packages/stdeb/util.py", line 226, in process_command
    check_call(args, cwd=cwd)
  File "/usr/local/lib/python3.8/dist-packages/stdeb/util.py", line 59, in check_call
    raise CalledProcessError(retcode)
stdeb.util.CalledProcessError: 2

I have no idea how to fix this but I am willing to do it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant