parameters: (options)
docstring: Creates debian packages.
  
      Example uses:
          paver deb
          paver deb -k 12345
          paver deb -k 12345 -p geonode/testing
docstring_summary: Creates debian packages.
docstring_tokens: Creates debian packages .
function: def deb(options):
      """
      Creates debian packages.
  
      Example uses:
          paver deb
          paver deb -k 12345
          paver deb -k 12345 -p geonode/testing
      """
      key = options.get('key', None)
      ppa = options.get('ppa', None)
  
      version, simple_version = versions()
  
      info(f'Creating package for GeoNode version {version}')
  
      # Get rid of any uncommitted changes to debian/changelog
      info('Getting rid of any uncommitted changes in debian/changelog')
      sh('git checkout package/debian/changelog')
  
      # Workaround for git-dch bug
      # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594580
      sh(f"rm -rf {os.path.realpath('package')}/.git")
      sh(f"ln -s {os.path.realpath('.git')} {os.path.realpath('package')}")
  
      with pushd('package'):
  
          # Install requirements
          # sh('sudo apt-get -y install debhelper devscripts git-buildpackage')
  
          # sh(('git-dch --spawn-editor=snapshot --git-author --new-version=%s'
          #     ' --id-length=6 --ignore-branch --release' % (simple_version)))
          # In case you publish from Ubuntu Xenial (git-dch is removed from upstream)
          #  use the following line instead:
          # sh(('gbp dch --spawn-editor=snapshot --git-author --new-version=%s'
          #    ' --id-length=6 --ignore-branch --release' % (simple_version)))
          distribution = "bionic"
          # sh(('gbp dch --distribution=%s --force-distribution --spawn-editor=snapshot --git-author --new-version=%s'
          #    ' --id-length=6 --ignore-branch --release' % (distribution, simple_version)))
  
          deb_changelog = path('debian') / 'changelog'
          for idx, line in enumerate(fileinput.input([deb_changelog], inplace=True)):
              if idx == 0:
                  logger.info(f"geonode ({simple_version}) {distribution}; urgency=high", end='')
              else:
                  print(line.replace("urgency=medium", "urgency=high"), end='')
  
          # Revert workaround for git-dhc bug
          sh('rm -rf .git')
  
          if key is None and ppa is None:
              print("A local installable package")
              sh('debuild -uc -us -A')
          elif key is None and ppa is not None:
              print("A sources package, signed by daemon")
              sh('debuild -S')
          elif key is not None and ppa is None:
              print("A signed installable package")
              sh(f'debuild -k{key} -A')
          elif key is not None and ppa is not None:
              print("A signed, source package")
              sh(f'debuild -k{key} -S')
  
      if ppa is not None:
          sh(f'dput ppa:{ppa} geonode_{simple_version}_source.changes')
function_tokens: def deb ( options ) : key = options . get ( 'key' , None ) ppa = options . get ( 'ppa' , None ) version , simple_version = versions ( ) info ( f'Creating package for GeoNode version {version}' ) # Get rid of any uncommitted changes to debian/changelog info ( 'Getting rid of any uncommitted changes in debian/changelog' ) sh ( 'git checkout package/debian/changelog' ) # Workaround for git-dch bug # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594580 sh ( f"rm -rf {os.path.realpath('package')}/.git" ) sh ( f"ln -s {os.path.realpath('.git')} {os.path.realpath('package')}" ) with pushd ( 'package' ) : # Install requirements # sh('sudo apt-get -y install debhelper devscripts git-buildpackage') # sh(('git-dch --spawn-editor=snapshot --git-author --new-version=%s' #     ' --id-length=6 --ignore-branch --release' % (simple_version))) # In case you publish from Ubuntu Xenial (git-dch is removed from upstream) #  use the following line instead: # sh(('gbp dch --spawn-editor=snapshot --git-author --new-version=%s' #    ' --id-length=6 --ignore-branch --release' % (simple_version))) distribution = "bionic" # sh(('gbp dch --distribution=%s --force-distribution --spawn-editor=snapshot --git-author --new-version=%s' #    ' --id-length=6 --ignore-branch --release' % (distribution, simple_version))) deb_changelog = path ( 'debian' ) / 'changelog' for idx , line in enumerate ( fileinput . input ( [ deb_changelog ] , inplace = True ) ) : if idx == 0 : logger . info ( f"geonode ({simple_version}) {distribution}; urgency=high" , end = '' ) else : print ( line . replace ( "urgency=medium" , "urgency=high" ) , end = '' ) # Revert workaround for git-dhc bug sh ( 'rm -rf .git' ) if key is None and ppa is None : print ( "A local installable package" ) sh ( 'debuild -uc -us -A' ) elif key is None and ppa is not None : print ( "A sources package, signed by daemon" ) sh ( 'debuild -S' ) elif key is not None and ppa is None : print ( "A signed installable package" ) sh ( f'debuild -k{key} -A' ) elif key is not None and ppa is not None : print ( "A signed, source package" ) sh ( f'debuild -k{key} -S' ) if ppa is not None : sh ( f'dput ppa:{ppa} geonode_{simple_version}_source.changes' )