[med-svn] [Git][med-team/yaggo][master] 10 commits: Add autopkgtests

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Sat Sep 25 15:29:35 BST 2021



Nilesh Patra pushed to branch master at Debian Med / yaggo


Commits:
9d0b4d51 by Nilesh Patra at 2021-09-25T18:52:25+05:30
Add autopkgtests

- - - - -
8343b220 by Nilesh Patra at 2021-09-25T18:52:25+05:30
Do not generate pages at build time, add maintainer manual page

- - - - -
6289f651 by Nilesh Patra at 2021-09-25T19:27:26+05:30
d/p/add-gemspec.patch: Add gemspec file

- - - - -
71650c1f by Nilesh Patra at 2021-09-25T19:28:00+05:30
d/{control,rules}: Adapt to ruby-packaging style

- - - - -
1bbc4c28 by Nilesh Patra at 2021-09-25T19:32:06+05:30
d/rules: Make create_yaggo_one_file executable

- - - - -
eed79489 by Nilesh Patra at 2021-09-25T19:34:45+05:30
d/control: Add myself to uploaders

- - - - -
b5cc8f71 by Nilesh Patra at 2021-09-25T19:44:11+05:30
d/rules: Enable tests at build time

- - - - -
3f84feb4 by Nilesh Patra at 2021-09-25T19:48:00+05:30
Drop d/install, let ruby buildsystem handle it

- - - - -
22d292a0 by Nilesh Patra at 2021-09-25T19:49:03+05:30
d/rules: Repect nocheck build profile for tests

- - - - -
479372ee by Nilesh Patra at 2021-09-25T19:54:51+05:30
Upload to unstable

- - - - -


11 changed files:

- debian/changelog
- debian/control
- + debian/createmanpages
- − debian/install
- + debian/manpages
- + debian/patches/add-gemspec.patch
- + debian/patches/series
- debian/rules
- + debian/tests/control
- + debian/tests/run-unit-test
- + debian/yaggo.1


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,22 @@
+yaggo (1.5.10-4) unstable; urgency=medium
+
+  * Add autopkgtests
+  * Do not generate pages at build time, add maintainer manual page
+  * d/p/add-gemspec.patch: Add gemspec file
+  * d/rules
+    - Use buildsystem=ruby, switch to ruby-style packaging
+    - Make create_yaggo_one_file executable
+    - Enable build-time tests, respecting nocheck build profile
+    - Fix permissions of create_yaggo_one_file
+  * d/control
+    - Add myself to uploaders
+    - Add fields XS-Ruby-Versions, XB-Ruby-Versions, Testsuite
+    - Drop Depends on "ruby:any | ruby-interpreter", use ${ruby:Depends}
+      instead which does the right thing
+  * Drop d/install, let ruby buildsystem handle it
+
+ -- Nilesh Patra <nilesh at debian.org>  Sat, 25 Sep 2021 19:49:28 +0530
+
 yaggo (1.5.10-3) unstable; urgency=medium
 
   [ Steffen Moeller ]


=====================================
debian/control
=====================================
@@ -1,22 +1,25 @@
 Source: yaggo
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
+Uploaders: Andreas Tille <tille at debian.org>, Nilesh Patra <nilesh at debian.org>
 Section: misc
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
-               ruby,
-               help2man
+               gem2deb (>= 1),
+               ruby
 Standards-Version: 4.6.0
 Vcs-Browser: https://salsa.debian.org/med-team/yaggo
 Vcs-Git: https://salsa.debian.org/med-team/yaggo.git
 Homepage: https://github.com/gmarcais/yaggo
+Testsuite: autopkgtest-pkg-ruby
+XS-Ruby-Versions: all
 Rules-Requires-Root: no
 
 Package: yaggo
 Architecture: all
+XB-Ruby-Versions: ${ruby:Versions}
 Depends: ${shlibs:Depends},
+         ${ruby:Depends},
          ${misc:Depends},
-         ruby:any | ruby-interpreter
 Description: generate command line parser using getopt_long
  Yaggo is a tool to generate command line parsers for C++. Yaggo stands
  for "Yet Another GenGetOpt" and is inspired by GNU Gengetopt.


=====================================
debian/createmanpages
=====================================
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+set -e
+
+if [ ! -x /usr/bin/help2man ]; then
+    echo "E: Missing /usr/bin/help2man, please install it from the cognate package."
+    exit 1
+fi
+
+if [ ! -n "$NAME" ]; then
+    NAME=`grep "^Description:" debian/control | sed 's/^Description: *//' | head -n1`
+fi
+
+if [ ! -n "$VERSION" ]; then
+    VERSION=`dpkg-parsechangelog | awk '/^Version:/ {print $2}' | sed -e 's/^[0-9]*://' -e 's/-.*//' -e 's/[+~]dfsg$//'`
+fi
+
+if [ ! -n "$PROGNAME" ]; then
+    PROGNAME=`grep "^Package:" debian/control | sed 's/^Package: *//' | head -n1`
+fi
+
+MANDIR=debian
+
+HELPOPTION='--help'
+echo "PROGNAME: '$PROGNAME'"
+echo "NAME:     '$NAME'"
+echo "VERSION:  '$VERSION'"
+echo "MANDIR:   '$MANDIR'"
+echo "HELPOPTION: '$HELPOPTION'"
+
+mkdir -p $MANDIR
+
+
+AUTHOR=".SH AUTHOR\n \
+This manpage was written by $DEBFULLNAME for the Debian distribution and\n \
+can be used for any other usage of the program.\
+"
+
+# If program name is different from package name or title should be
+# different from package short description change this here
+progname=${PROGNAME}
+help2man --no-info --no-discard-stderr --help-option="$HELPOPTION" \
+         --name="$NAME" \
+            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1
+echo $AUTHOR >> $MANDIR/${progname}.1
+
+echo "$MANDIR/*.1" > debian/manpages
+
+cat <<EOT
+Please enhance the help2man output in '$MANDIR/${progname}.1'.
+To inspect it, try 'nroff -man $MANDIR/${progname}.1'.
+If very unhappy, try passing the HELPOPTION as an environment variable.
+The following web page might be helpful in doing so:
+    http://liw.fi/manpages/
+EOT


=====================================
debian/install deleted
=====================================
@@ -1,2 +0,0 @@
-yaggo	usr/bin
-


=====================================
debian/manpages
=====================================
@@ -0,0 +1 @@
+debian/*.1


=====================================
debian/patches/add-gemspec.patch
=====================================
@@ -0,0 +1,29 @@
+Description: Since gemspec is not present in the github repo, manually pull the one from rubygems
+Author: Nilesh Patra <nilesh at debian.org>
+Last-Update: 2021-09-25
+--- /dev/null
++++ b/yaggo.gemspec
+@@ -0,0 +1,23 @@
++#########################################################
++# This file has been automatically generated by gem2tgz #
++#########################################################
++# -*- encoding: utf-8 -*-
++# stub: yaggo 1.5.10 ruby lib
++
++Gem::Specification.new do |s|
++  s.name = "yaggo".freeze
++  s.version = "1.5.10"
++
++  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6".freeze) if s.respond_to? :required_rubygems_version=
++  s.require_paths = ["lib".freeze]
++  s.authors = ["Guillaume Mar\u00E7ais".freeze]
++  s.date = "2017-07-07"
++  s.description = "Yaggo defines a DSL to generate GNU compatible command line parsers for C++ using getopt.".freeze
++  s.email = ["gmarcais at umd.edu".freeze]
++  s.executables = ["yaggo".freeze]
++  s.files = ["README.md".freeze, "bin/create_yaggo_one_file".freeze, "bin/yaggo".freeze, "lib/yaggo/dsl.rb".freeze, "lib/yaggo/general.rb".freeze, "lib/yaggo/library.rb".freeze, "lib/yaggo/main.rb".freeze, "lib/yaggo/man_page.rb".freeze, "lib/yaggo/parser.rb".freeze, "lib/yaggo/stub.rb".freeze, "lib/yaggo/version.rb".freeze, "lib/yaggo/zsh_completion.rb".freeze]
++  s.homepage = "https://github.com/gmarcais/yaggo".freeze
++  s.licenses = ["GPL-3.0".freeze]
++  s.rubygems_version = "3.2.5".freeze
++  s.summary = "Yet Another Generator for getopt".freeze
++end


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+add-gemspec.patch


=====================================
debian/rules
=====================================
@@ -1,18 +1,16 @@
 #!/usr/bin/make -f
 
-include /usr/share/dpkg/default.mk
-
-mandir=$(CURDIR)/debian/$(DEB_SOURCE)/usr/share/man/man1/
-HELP2MAN = help2man --no-info --version-string="$(DEB_VERSION_UPSTREAM)"
+export GEM2DEB_TEST_RUNNER = --check-dependencies
+export DH_RUBY = --gem-install
 
 %:
-	dh $@
+	dh $@ --buildsystem=ruby --with ruby
 
-override_dh_auto_install:
-	dh_auto_install -- DESTDIR="" prefix=$(CURDIR)/debian/$(DEB_SOURCE)/usr
+override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	cd test && $(MAKE) && $(MAKE) clean && rm -f _count
+endif
 
-override_dh_installman:
-	mkdir -p $(mandir)
-	$(HELP2MAN) \
-		--name='generate command line parser using getopt_long' \
-		$(CURDIR)/$(DEB_SOURCE) > $(mandir)/$(DEB_SOURCE).1
+override_dh_fixperms:
+	dh_fixperms
+	find debian -name create_yaggo_one_file -exec chmod +x \{\} \;


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,3 @@
+Tests: run-unit-test
+Depends: @, build-essential
+Restrictions: allow-stderr


=====================================
debian/tests/run-unit-test
=====================================
@@ -0,0 +1,77 @@
+#!/bin/bash
+set -e
+
+pkg=yaggo
+
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cd "${AUTOPKGTEST_TMP}"
+
+function compare_cksum()
+{
+	# $1: file whose md5sum needs to be tested
+	# $2: expected checksum
+	if [ "$(cat $1 | md5sum | awk '{print $1}')" != "$2" ]
+	then
+		echo "Checksums do not match"
+		exit 1
+	fi
+
+}
+
+# Prepare .yaggo file
+cat<<EOF > parser.yaggo
+purpose "Demonstrate yaggo capabilities"
+description "This simple configuration file shows some of the capabilities of yaggo.
+This is supposed to be a longer description of the program.
+"
+
+option("f", "flag") {
+  description "This is a flag"
+  off
+}
+option("i", "int") {
+  description "This take an integer"
+  int
+  default 20
+}
+arg("path") {
+  description "Path to file"
+  c_string
+}
+EOF
+
+# Prepare a .cpp file using the header output by yaggo
+cat<<EOF > parser.cpp
+#include <iostream>
+#include "parser.hpp"
+
+int main(int argc, char* argv[]) {
+  parser args(argc, argv); // Does all the parsing
+
+  std::cout << "--flag " << (args.flag_flag ? "not passed" : "passed") << "\n"
+            << "--int: " << args.int_arg << "\n"
+            << "path: " << args.path_arg << "\n";
+
+  return 0;
+}
+EOF
+
+# Make the header file and compile the parser C++ program
+yaggo parser.yaggo
+g++ -o parser parser.cpp
+
+echo "Test 1: Check if --int and --flag work in sample program"
+./parser --int=20 ./parser.yaggo > test1
+compare_cksum test1 b55b48b745aa2be80024b8698a2c2718 
+rm -f test1
+echo "PASS"
+
+echo "Test 2: Check if --help works in sample program"
+./parser --help > test2
+compare_cksum test2 e537fc705813c89adf9386e10b3f5e0b
+rm -f test2
+echo "PASS"


=====================================
debian/yaggo.1
=====================================
@@ -0,0 +1,36 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.16.
+.TH YAGGO "1" "September 2021" "yaggo 1.5.10" "User Commands"
+.SH NAME
+yaggo \- generate command line parser using getopt_long
+.SH SYNOPSIS
+.B yaggo
+[\fI\,options\/\fR] [\fI\,file.yaggo\/\fR]
+.SH DESCRIPTION
+.SS "Specific options:"
+.TP
+\fB\-o\fR, \fB\-\-output\fR FILE
+Output file
+.TP
+\fB\-l\fR, \fB\-\-license\fR PATH
+License file to copy in header
+.TP
+\fB\-m\fR, \fB\-\-man\fR [FILE]
+Display or write manpage
+.TP
+\fB\-s\fR, \fB\-\-stub\fR
+Output a stub yaggo file
+.TP
+\fB\-\-zc\fR PATH
+Write zsh completion file
+.TP
+\fB\-e\fR, \fB\-\-extended\-syntax\fR
+Use extended syntax
+.TP
+\fB\-\-debug\fR
+Debug yaggo
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Show this message
+.SH AUTHOR
+ This manpage was written by Nilesh Patra for the Debian distribution and
+ can be used for any other usage of the program.



View it on GitLab: https://salsa.debian.org/med-team/yaggo/-/compare/a4960022ce47f86858e0fd1ccfb97e5e437beedf...479372ee383edeac92cc340a425c10aa737604e9

-- 
View it on GitLab: https://salsa.debian.org/med-team/yaggo/-/compare/a4960022ce47f86858e0fd1ccfb97e5e437beedf...479372ee383edeac92cc340a425c10aa737604e9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210925/d8cb64ac/attachment-0001.htm>


More information about the debian-med-commit mailing list