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

[QUESTION] Virtualenv, Launchpad PPA, signing package #181

Open
mario33881 opened this issue May 5, 2021 · 0 comments
Open

[QUESTION] Virtualenv, Launchpad PPA, signing package #181

mario33881 opened this issue May 5, 2021 · 0 comments

Comments

@mario33881
Copy link

Good day,

A couple of days ago I tried for the first time to build
and upload a package to my PPA on Launchpad...

I have a couple of (beginner) questions:

  1. First I had problems with the --sign-results parameter:

    gpg skipped my sign key because "no secret key" was found.

    Here is the (translation of) my error:

     gpg: skipped "Stefano Zenaro <email>": No secret key
     gpg: dpkg-sign.SpDitUrv/blifparser_1.0.2-1.dsc: clear-sign failed: No secret key
    

    I guess (from a quick search) that the problem is that I added a comment to the key.

    I did it to remind myself in the future what the key is for but I currently only have this key on this (Virtualbox virtual) machine

    I've successfully built the package by not using that parameter and then by manually extracting and signing the files using the following commands:

     dpkg-source -x ../deb_dist/<myscript>.dsc
     debuild -S -sa -k<email>
    

    I found out about the -k<email> parameter for debuild with that quick search on google

    stdeb.cfg config file:

    [DEFAULT]
    Suite: focal
    Copyright-File: LICENSE.txt
    Build-Depends: dh-python

    Here is what I did first:

    # create dsc file and deb package
    python3 setup.py --command-packages=stdeb.command sdist_dsc --sign-results bdist_deb
    
    # Error because gpg can't use my key
    COMMAND OUTPUT

    sis@SIS:~/Documenti/blifparser$ python3 setup.py --command-packages=stdeb.command sdist_dsc --sign-results bdist_deb
    running sdist_dsc
    running egg_info
    creating blifparser.egg-info
    writing blifparser.egg-info/PKG-INFO
    writing dependency_links to blifparser.egg-info/dependency_links.txt
    writing entry points to blifparser.egg-info/entry_points.txt
    writing top-level names to blifparser.egg-info/top_level.txt
    writing manifest file 'blifparser.egg-info/SOURCES.txt'
    adding license file 'LICENSE.txt' (matched pattern 'LICENSE.txt')
    reading manifest file 'blifparser.egg-info/SOURCES.txt'
    writing manifest file 'blifparser.egg-info/SOURCES.txt'
    running sdist
    running check
    creating blifparser-1.0.2
    creating blifparser-1.0.2/blifparser
    creating blifparser-1.0.2/blifparser.egg-info
    creating blifparser-1.0.2/blifparser/keywords
    copying files to blifparser-1.0.2...
    copying LICENSE.txt -> blifparser-1.0.2
    copying README.md -> blifparser-1.0.2
    copying setup.cfg -> blifparser-1.0.2
    copying setup.py -> blifparser-1.0.2
    copying blifparser/__init__.py -> blifparser-1.0.2/blifparser
    copying blifparser/__main__.py -> blifparser-1.0.2/blifparser
    copying blifparser/_version.py -> blifparser-1.0.2/blifparser
    copying blifparser/blifparser.py -> blifparser-1.0.2/blifparser
    copying blifparser/utils.py -> blifparser-1.0.2/blifparser
    copying blifparser.egg-info/PKG-INFO -> blifparser-1.0.2/blifparser.egg-info
    copying blifparser.egg-info/SOURCES.txt -> blifparser-1.0.2/blifparser.egg-info
    copying blifparser.egg-info/dependency_links.txt -> blifparser-1.0.2/blifparser.egg-info
    copying blifparser.egg-info/entry_points.txt -> blifparser-1.0.2/blifparser.egg-info
    copying blifparser.egg-info/top_level.txt -> blifparser-1.0.2/blifparser.egg-info
    copying blifparser/keywords/__init__.py -> blifparser-1.0.2/blifparser/keywords
    copying blifparser/keywords/fsm.py -> blifparser-1.0.2/blifparser/keywords
    copying blifparser/keywords/generic.py -> blifparser-1.0.2/blifparser/keywords
    copying blifparser/keywords/subfiles.py -> blifparser-1.0.2/blifparser/keywords
    Writing blifparser-1.0.2/setup.cfg
    creating dist
    Creating tar archive
    removing 'blifparser-1.0.2' (and everything under it)
    dpkg-buildpackage: Informazioni: Pacchetto sorgente blifparser
    dpkg-buildpackage: Informazioni: Versione sorgente 1.0.2-1
    dpkg-buildpackage: Informazioni: Distribuzione sorgente focal
    dpkg-buildpackage: Informazioni: Sorgente modificata da Stefano Zenaro <email>
     dpkg-source --before-build .
    dpkg-source: Informazioni: using options from blifparser-1.0.2/debian/source/options: --extend-diff-ignore=\.egg-info$
     fakeroot debian/rules clean
    dh clean --with python3 --buildsystem=python_distutils
       debian/rules override_dh_auto_clean
    make[1]: ingresso nella directory «/home/sis/Documenti/blifparser/deb_dist/blifparser-1.0.2»
    python3 setup.py clean -a
    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]: uscita dalla directory «/home/sis/Documenti/blifparser/deb_dist/blifparser-1.0.2»
       dh_clean -O--buildsystem=python_distutils
     dpkg-source -b .
    dpkg-source: Informazioni: using options from blifparser-1.0.2/debian/source/options: --extend-diff-ignore=\.egg-info$
    dpkg-source: Informazioni: using source format '3.0 (quilt)'
    dpkg-source: Informazioni: building blifparser using existing ./blifparser_1.0.2.orig.tar.gz
    dpkg-source: Informazioni: building blifparser in blifparser_1.0.2-1.debian.tar.xz
    dpkg-source: Informazioni: building blifparser in blifparser_1.0.2-1.dsc
     dpkg-genbuildinfo --build=source
     dpkg-genchanges -sa --build=source >../blifparser_1.0.2-1_source.changes
    dpkg-genchanges: Informazioni: including full source code in upload
     dpkg-source --after-build .
    dpkg-source: Informazioni: using options from blifparser-1.0.2/debian/source/options: --extend-diff-ignore=\.egg-info$
    dpkg-buildpackage: Informazioni: Caricamento completo (sorgente originale incluso)
     signfile blifparser_1.0.2-1.dsc
    gpg: saltato "Stefano Zenaro <email>": Nessuna chiave segreta
    gpg: dpkg-sign.SpDitUrv/blifparser_1.0.2-1.dsc: clear-sign failed: Nessuna chiave segreta
    
    dpkg-buildpackage: Errore: failed to sign .dsc file
    Traceback (most recent call last):
      File "setup.py", line 31, in <module>
    	setuptools.setup(
      File "/usr/local/lib/python3.8/dist-packages/setuptools/__init__.py", line 153, 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 "/home/sis/.local/lib/python3.8/site-packages/stdeb/command/sdist_dsc.py", line 137, in run
    	build_dsc(debinfo,
      File "/home/sis/.local/lib/python3.8/site-packages/stdeb/util.py", line 1569, in build_dsc
    	dpkg_buildpackage(*args, cwd=fullpath_repackaged_dirname)
      File "/home/sis/.local/lib/python3.8/site-packages/stdeb/util.py", line 585, in dpkg_buildpackage
    	process_command(args, cwd=cwd)
      File "/home/sis/.local/lib/python3.8/site-packages/stdeb/util.py", line 226, in process_command
    	check_call(args, cwd=cwd)
      File "/home/sis/.local/lib/python3.8/site-packages/stdeb/util.py", line 59, in check_call
    	raise CalledProcessError(retcode)
    stdeb.util.CalledProcessError: 25
    


    This worked:

    # create dsc file and deb package
    python3 setup.py --command-packages=stdeb.command bdist_deb
    
    # create a temporary folder
    mkdir tmp
    cd tmp
    
    # extract and sign the files
    dpkg-source -x ../deb_dist/<myscript>.dsc
    cd <myscript>
    debuild -S -sa -k<email>
    
    # upload package to my PPA
    dput ppa:<myppa_name> ../<myscript>_source.changes

    Found this way of signing packages here

    Now I can add my PPA and apt-get install my package and execute it with:

    <myscript>
    
  2. After that everything went fine with no virtualenv... But when
    I tried using --with-dh-virtualenv parameter my package stopped working...

    My script doesn't have dependencies but I've tried using virtualenv because I've planned to publish another package in the future that will require python dependencies

    The command that executed my python script previously (without virtualenv) is not recognised by the terminal.

    Using locate I only found the copyright and changelog files.

    I guess I did something wrong but I can't figure out what went wrong...

    Could you please list me the commands/steps that I need to follow to build the package properly and how to use it after that?

    stdeb.cfg config file:

    [DEFAULT]
    Suite: focal
    Copyright-File: LICENSE.txt
    Build-Depends: dh-python, dh-virtualenv

    Here is what I did:

    # create dsc file and deb package
    python3 setup.py --command-packages=stdeb.command sdist_dsc --with-dh-virtualenv bdist_deb
    
    # Install the package
    dpkg -i python3-<myscript>.deb
    
    <myscript> # file or directory not found
    
    python3-<myscript> # command not found
    TERMINAL OUTPUT

    sis@SIS:~/Documenti/blifparser$ python3 setup.py --command-packages=stdeb.command sdist_dsc --with-dh-virtualenv bdist_deb
    running sdist_dsc
    running egg_info
    creating blifparser.egg-info
    writing blifparser.egg-info/PKG-INFO
    writing dependency_links to blifparser.egg-info/dependency_links.txt
    writing entry points to blifparser.egg-info/entry_points.txt
    writing top-level names to blifparser.egg-info/top_level.txt
    writing manifest file 'blifparser.egg-info/SOURCES.txt'
    adding license file 'LICENSE.txt' (matched pattern 'LICENSE.txt')
    reading manifest file 'blifparser.egg-info/SOURCES.txt'
    writing manifest file 'blifparser.egg-info/SOURCES.txt'
    running sdist
    running check
    creating blifparser-1.0.3
    creating blifparser-1.0.3/blifparser
    creating blifparser-1.0.3/blifparser.egg-info
    creating blifparser-1.0.3/blifparser/keywords
    copying files to blifparser-1.0.3...
    copying LICENSE.txt -> blifparser-1.0.3
    copying README.md -> blifparser-1.0.3
    copying setup.cfg -> blifparser-1.0.3
    copying setup.py -> blifparser-1.0.3
    copying blifparser/__init__.py -> blifparser-1.0.3/blifparser
    copying blifparser/__main__.py -> blifparser-1.0.3/blifparser
    copying blifparser/_version.py -> blifparser-1.0.3/blifparser
    copying blifparser/blifparser.py -> blifparser-1.0.3/blifparser
    copying blifparser/utils.py -> blifparser-1.0.3/blifparser
    copying blifparser.egg-info/PKG-INFO -> blifparser-1.0.3/blifparser.egg-info
    copying blifparser.egg-info/SOURCES.txt -> blifparser-1.0.3/blifparser.egg-info
    copying blifparser.egg-info/dependency_links.txt -> blifparser-1.0.3/blifparser.egg-info
    copying blifparser.egg-info/entry_points.txt -> blifparser-1.0.3/blifparser.egg-info
    copying blifparser.egg-info/top_level.txt -> blifparser-1.0.3/blifparser.egg-info
    copying blifparser/keywords/__init__.py -> blifparser-1.0.3/blifparser/keywords
    copying blifparser/keywords/fsm.py -> blifparser-1.0.3/blifparser/keywords
    copying blifparser/keywords/generic.py -> blifparser-1.0.3/blifparser/keywords
    copying blifparser/keywords/subfiles.py -> blifparser-1.0.3/blifparser/keywords
    Writing blifparser-1.0.3/setup.cfg
    creating dist
    Creating tar archive
    removing 'blifparser-1.0.3' (and everything under it)
    dpkg-buildpackage: Informazioni: Pacchetto sorgente blifparser
    dpkg-buildpackage: Informazioni: Versione sorgente 1.0.3-1
    dpkg-buildpackage: Informazioni: Distribuzione sorgente bionic
    dpkg-buildpackage: Informazioni: Sorgente modificata da Stefano Zenaro <email>
    dpkg-source --before-build .
    dpkg-source: Informazioni: using options from blifparser-1.0.3/debian/source/options: --extend-diff-ignore=\.egg-info$
    fakeroot debian/rules clean
    dh clean --with python3 --with python-virtualenv
    dh_clean
    dpkg-source -b .
    dpkg-source: Informazioni: using options from blifparser-1.0.3/debian/source/options: --extend-diff-ignore=\.egg-info$
    dpkg-source: Informazioni: using source format '3.0 (quilt)'
    dpkg-source: Informazioni: building blifparser using existing ./blifparser_1.0.3.orig.tar.gz
    dpkg-source: Informazioni: building blifparser in blifparser_1.0.3-1.debian.tar.xz
    dpkg-source: Informazioni: building blifparser in blifparser_1.0.3-1.dsc
    dpkg-genbuildinfo --build=source
    dpkg-genchanges -sa --build=source >../blifparser_1.0.3-1_source.changes
    dpkg-genchanges: Informazioni: including full source code in upload
    dpkg-source --after-build .
    dpkg-source: Informazioni: using options from blifparser-1.0.3/debian/source/options: --extend-diff-ignore=\.egg-info$
    dpkg-buildpackage: Informazioni: Caricamento completo (sorgente originale incluso)
    dpkg-source: Avviso: extracting unsigned source package (blifparser_1.0.3-1.dsc)
    dpkg-source: Informazioni: extracting blifparser in blifparser-1.0.3
    dpkg-source: Informazioni: unpacking blifparser_1.0.3.orig.tar.gz
    dpkg-source: Informazioni: unpacking blifparser_1.0.3-1.debian.tar.xz
    running bdist_deb
    dpkg-buildpackage: Informazioni: Pacchetto sorgente blifparser
    dpkg-buildpackage: Informazioni: Versione sorgente 1.0.3-1
    dpkg-buildpackage: Informazioni: Distribuzione sorgente bionic
    dpkg-buildpackage: Informazioni: Sorgente modificata da Stefano Zenaro <email>
    dpkg-buildpackage: Informazioni: Architettura host amd64
    dpkg-source --before-build .
    dpkg-source: Informazioni: using options from blifparser-1.0.3/debian/source/options: --extend-diff-ignore=\.egg-info$
    fakeroot debian/rules clean
    dh clean --with python3 --with python-virtualenv
    dh_clean
    debian/rules build
    dh build --with python3 --with python-virtualenv
    dh_update_autotools_config
    dh_auto_configure
    dh_auto_configure: warning: Please use the third-party "pybuild" build system instead of python-distutils
    dh_auto_configure: warning: This feature will be removed in compat 12.
    fakeroot debian/rules binary
    dh binary --with python3 --with python-virtualenv
    dh_testroot
    dh_prep
    dh_installdocs
    dh_installchangelogs
    dh_python3
    debian/rules override_dh_virtualenv
    make[1]: ingresso nella directory «/home/sis/Documenti/blifparser/deb_dist/blifparser-1.0.3»
    dh_virtualenv --python python3
    /usr/bin/dh_virtualenv:60: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
    arguments = inspect.getargspec(DebHelper.__init__).args
    make[1]: uscita dalla directory «/home/sis/Documenti/blifparser/deb_dist/blifparser-1.0.3»
    dh_perl
    dh_link
    dh_strip_nondeterminism
    dh_compress
    dh_fixperms
    dh_missing
    dh_installdeb
    dh_gencontrol
    dpkg-gencontrol: Avviso: Depends field of package python3-blifparser: substitution variable ${python3:Depends} used, but is not defined
    dh_md5sums
    dh_builddeb
    dpkg-deb: generazione del pacchetto "python3-blifparser" in "../python3-blifparser_1.0.3-1_all.deb".
    dpkg-genbuildinfo --build=binary
    dpkg-genchanges --build=binary >../blifparser_1.0.3-1_amd64.changes
    dpkg-genchanges: Informazioni: binary-only upload (no source code included)
    dpkg-source --after-build .
    dpkg-source: Informazioni: using options from blifparser-1.0.3/debian/source/options: --extend-diff-ignore=\.egg-info$
    dpkg-buildpackage: Informazioni: binary-only upload (no source included)
    
    
    sis@SIS:~/Documenti/blifparser$ cd deb_dist/
    sis@SIS:~/Documenti/blifparser/deb_dist$ ls
    blifparser-1.0.3		    blifparser_1.0.3-1_source.buildinfo
    blifparser_1.0.3-1_amd64.buildinfo  blifparser_1.0.3-1_source.changes
    blifparser_1.0.3-1_amd64.changes    blifparser_1.0.3.orig.tar.gz
    blifparser_1.0.3-1.debian.tar.xz    python3-blifparser_1.0.3-1_all.deb
    blifparser_1.0.3-1.dsc
    
    
    sis@SIS:~/Documenti/blifparser/deb_dist$ sudo dpkg -i python3-blifparser_1.0.3-1_all.deb 
    Selezionato il pacchetto python3-blifparser non precedentemente selezionato.
    (Lettura del database... 364161 file e directory attualmente installati.)
    Preparativi per estrarre python3-blifparser_1.0.3-1_all.deb...
    Estrazione di python3-blifparser (1.0.3-1)...
    Configurazione di python3-blifparser (1.0.3-1)...
    
    
    sis@SIS:~/Documenti/blifparser/deb_dist$ blifparser
    bash: /usr/bin/blifparser: File or directory does not exist
    
    
    sis@SIS:~/Documenti/blifparser/deb_dist$ python3-blifparser
    python3-blifparser: command not found
    

    locate found my source files and this:

    /usr/share/doc/python3-blifparser
    /usr/share/doc/python3-blifparser/changelog.Debian.gz
    /usr/share/doc/python3-blifparser/copyright
    /var/lib/dpkg/info/python3-blifparser.list
    /var/lib/dpkg/info/python3-blifparser.md5sums
    

    Where I think the /var/lib/dpkg are from previous tries

    sis@SIS:/usr/share/doc/python3-blifparser$ ls
    changelog.Debian.gz  copyright
    
  3. (this probably is not the correct place to ask this...) dh-virtualenv is not available via apt for Ubuntu focal...

    https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=dh-virtualenv&searchon=names

    • Is there a way to tell Launchpad to use a PPA to install dh-virtualenv? Would this even be a solution?

      I've successfully built the package on Ubuntu Focal locally by installing dh-virtualenv with its PPA.

      I was also able to build the package for the other Ubuntu versions listed in the link above using Launchpad

    • Is there a better way to publish a package with virtualenv on launchpad for ubuntu focal?

    • If this is not the correct place to ask this question, where should I ask?

    LAUNCHPAD BUILDER (PARTIAL) OUTPUT

    Install blifparser build dependencies (apt-based resolver)
    ----------------------------------------------------------
    
    Installing build dependencies
    Reading package lists...
    Building dependency tree...
    Reading state information...
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
    sbuild-build-depends-blifparser-dummy : Depends: dh-virtualenv but it is not installable
    E: Unable to correct problems, you have held broken packages.
    apt-get failed.
    E: Package installation failed
    Reading package lists...
    Building dependency tree...
    Reading state information...
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following packages will be REMOVED:
    sbuild-build-depends-core-dummy*
    0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
    After this operation, 0 B of additional disk space will be used.
    (Reading database ... 12815 files and directories currently installed.)
    Removing sbuild-build-depends-core-dummy (0.invalid.0) ...
    

Short summary because I wrote a lot... The issues I am having are:

  1. The --sign-results parameter resulted in gpg skipping my sign key because "no secret key" was found.
  2. The --with-dh-virtualenv parameter created a package that seems to do nothing because
    the terminal says "Command not found"
  3. I can't build my package for Ubuntu focal with virtualenv on Launchpad because apt can't install dh-virtualenv (because it is only availabe on its PPA for Ubuntu focal)

Is there a way I can fix these Issues?

Thank you for your time for reading this.

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