guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] pbpst: Help me figure out why tls certificates are not found at


From: ng0
Subject: [PATCH] pbpst: Help me figure out why tls certificates are not found at runtime
Date: Tue, 16 Aug 2016 08:09:50 +0000

Hi,

I packaged pbpst, a cli interface to pastebin instances running pb.
The patch I included in gnu/packages/patches/ is only temporary, it will
make it's way into master of pbpst.
gnutls and openssl are no listed dependencies of it, but I almost assume
by what's displayed with strace that I need openssl instead of gnutls.
But how do I fix the problem that certificates are not found?
Are those native-search-paths?

The patches will be cleaned up before you get the final review, there
are comments and unnecessary lines in there at the moment.
We can't use its native buildsystem, tup, because it requires FUSE to be
loaded at buildtime. The author created this new phase (make simle) I
apply and test here.
For more reasons why I build tup the way I build it, take a look at
NixOS and Archlinux' build of tup.

>From 0395b4c725d8e5df82f12d18aa16d2dad241da20 Mon Sep 17 00:00:00 2001
From: ng0 <address@hidden>
Date: Mon, 15 Aug 2016 00:26:40 +0000
Subject: [PATCH 1/2] gnu: Add tup.

* gnu/packages/tup.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 gnu/local.mk         |  2 ++
 gnu/packages/tup.scm | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 gnu/packages/tup.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 7416850..66d1e43 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -5,6 +5,7 @@
 # Copyright © 2013, 2014, 2015, 2016 Mark H Weaver <address@hidden>
 # Copyright © 2016 Chris Marusich <address@hidden>
 # Copyright © 2016 Kei Kebreau <address@hidden>
+# Coypright © 2016 ng0 <address@hidden>
 #
 # This file is part of GNU Guix.
 #
@@ -342,6 +343,7 @@ GNU_SYSTEM_MODULES =                                \
   %D%/packages/tmux.scm                                \
   %D%/packages/tor.scm                         \
   %D%/packages/tre.scm                         \
+  %D%/packages/tup.scm                         \
   %D%/packages/tv.scm                          \
   %D%/packages/unrtf.scm                       \
   %D%/packages/upnp.scm                                \
diff --git a/gnu/packages/tup.scm b/gnu/packages/tup.scm
new file mode 100644
index 0000000..66ce099
--- /dev/null
+++ b/gnu/packages/tup.scm
@@ -0,0 +1,83 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 ng0 <address@hidden>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages tup)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages version-control)
+  #:use-module (gnu packages perl)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu))
+
+(define-public tup
+  (package
+    (name "tup")
+    (version "0.7.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/gittup/";
+                                  name "/archive/v" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "044h9kbcg1sfwpn13j1grw79kwysqhyn3w3g6yy8ap4j32v10gz2"))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; tup requires fusermount to have suid, which we cannot provide in build 
env,
+     ;; we bootstrap it and use tup generate.  This also means that no tests 
are run.
+     `(#:tests? #f
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (zero? (system* "./build.sh"))
+             (zero? (system* "./build/tup" "generate" "script.sh"))))
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "script.sh"
+               (("`git describe`") (string-append "v" ,version)))
+             (zero? (system* "./script.sh"))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (man (string-append out "/share/man/man1")))
+               (install-file "tup" bin)
+               (install-file "tup.1" man))
+             #t)))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("perl" ,perl)))
+    (inputs
+     `(("fuse" ,fuse)))
+    (synopsis "A file-based build system")
+    (description
+     "Tup is a file-based build system for Linux, OSX, and Windows. It inputs 
a list
+of file changes and a directed acyclic graph (DAG), then processes the DAG to
+execute the appropriate commands required to update dependent files.  Updates 
are
+performed with very little overhead since tup implements powerful build
+algorithms to avoid doing unnecessary work.  This means you can stay focused on
+your project rather than on your build system.")
+    (home-page "http://gittup.org/tup/";)
+    (license license:gpl2)))
-- 
2.9.2

>From 27c41806d20fef44e19d6559760f260f197d1132 Mon Sep 17 00:00:00 2001
From: ng0 <address@hidden>
Date: Tue, 16 Aug 2016 00:59:33 +0000
Subject: [PATCH 2/2] gnu: Add pbpst.

* gnu/packages/pastebin.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/pastebin.scm                     | 108 ++++++++++++++++++++++++++
 gnu/packages/patches/pbpst-makefile-fix.patch |  17 ++++
 3 files changed, 126 insertions(+)
 create mode 100644 gnu/packages/pastebin.scm
 create mode 100644 gnu/packages/patches/pbpst-makefile-fix.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 66d1e43..845ccf2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -272,6 +272,7 @@ GNU_SYSTEM_MODULES =                                \
   %D%/packages/package-management.scm          \
   %D%/packages/parallel.scm                    \
   %D%/packages/password-utils.scm              \
+  %D%/packages/pastebin.scm                    \
   %D%/packages/patchutils.scm                  \
   %D%/packages/pciutils.scm                    \
   %D%/packages/pcre.scm                                \
diff --git a/gnu/packages/pastebin.scm b/gnu/packages/pastebin.scm
new file mode 100644
index 0000000..31c7b42
--- /dev/null
+++ b/gnu/packages/pastebin.scm
@@ -0,0 +1,108 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 ng0 <address@hidden>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages pastebin)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages certs)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages gawk)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages tup)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages version-control)
+  #:use-module (gnu packages web)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages))
+
+(define-public pbpst
+  (package
+    (name "pbpst")
+    (version "1.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/HalosGhost/";
+                                  name "/archive/v" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0vnj7dm76djlzhg0zqiv2mww11knx3vd7bl5wsgd9bd5lvxdlcqw"))
+              (patches (search-patches "pbpst-makefile-fix.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list
+                     (string-append "PREFIX=" (assoc-ref %outputs "out")))
+       ;; (string-append "--cflags=" (getenv "CFLAGS")))
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; We can not use the tup build system. This is the result of `tup 
generate'.
+         (replace 'build
+           (lambda _
+             (zero? (system* "make" "simple"))
+             (patch-shebang "make.sh")
+             (substitute* "make.sh"
+               (("`git describe --tags`") ,version))
+             (zero? (system* "bash" "make.sh"))))
+               ;; ;; (mkdir-p (string-append out "/dist"))
+               ;; (mkdir-p "dist")
+               ;; (chdir "src")
+               ;; (zero? (system* "clang" "-g" "-O3" "-fPIE" "-pie" 
"-Weverything"
+               ;;                 "-Werror" "-std=c11" "-ggdb" 
"-D_FORTIFY_SOURCE=2"
+               ;;                 "-fstack-protector-strong" "-march=native"
+               ;;                 "--param=ssp-buffer-size=1" 
"-Wl,-z,relro,-z,now"
+               ;;                 "-fsanitize=undefined" 
"-fsanitize-trap=undefined"
+               ;;                 "pkg-config" "--libs-only-l" "libcurl" 
"jansson"
+               ;;                 "callback.c" "main.c" "pb.c" "pbpst_db.c"
+               ;;                 "-o ../dist/pbpst"))
+               ;; (chdir "../cmp")
+               ;; (copy-file "zsh" "../dist/zsh")
+               ;; (copy-file "bash" "../dist/bash")
+               ;; (chdir "../doc")
+               ;; (system* "sphinx-build" "-b man" "-Dversion=`git describe 
--tags`"
+               ;;          "-d doctree" "-E . ../dist pbpst.rst pbpst_db.rst")
+               ;; (delete-file-recursively "doctree"))))
+         (delete 'configure))))
+    ;; now run make install as usual.
+    (inputs
+     `(("curl" ,curl)
+       ("jansson" ,jansson)
+       ;;("gnutls" ,gnutls)
+       ("openssl" ,openssl)
+       ("nss-certs" ,nss-certs)))
+    (native-inputs
+     `(("clang" ,clang)
+       ("gawk" ,gawk)
+       ("git" ,git)
+       ("tup" ,tup)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-sphinx" ,python-sphinx)))
+    (synopsis "Command-line libcurl C client for pb deployments")
+    (description
+     "pbpst is a small tool to make interacting with pb instances as simple as
+possible.  pb is a versatile, free and open source pastebin which has more
+ features, is more robust, and is faster than any other pastebin with which I
+ am familiar.  You can find the reference instance (which tracks pb's master
+ branch) at ptpb. Ideally, pbpst will support as many features of pb as
+ possible (hopefully, nearly all) in a simple, unassuming CLI.")
+    (home-page "https://github.com/HalosGhost/pbpst/";)
+    (license license:gpl2)))
diff --git a/gnu/packages/patches/pbpst-makefile-fix.patch 
b/gnu/packages/patches/pbpst-makefile-fix.patch
new file mode 100644
index 0000000..6d817f3
--- /dev/null
+++ b/gnu/packages/patches/pbpst-makefile-fix.patch
@@ -0,0 +1,17 @@
+diff --git a/Makefile b/Makefile
+index 28b484f..29006e0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -21,6 +21,12 @@ cov-build: clean
+       @cov-build --dir cov-int ./make.sh
+       @tar czvf $(PROGNM).tgz cov-int
+ 
++simple: clean
++      @tup generate make1.sh
++      @awk 'NR == 1 { print $$0, "\nmkdir -p dist\ncd src"; next }; NR > 2 { 
print $$0; }' make1.sh > make.sh
++      @chmod +x make.sh
++      @rm make1.sh
++
+ clang-analyze:
+       @(pushd ./src; clang-check -analyze ./*.c)
+ 
-- 
2.9.2

-- 
♥Ⓐ  ng0
For non-prism friendly talk find me on http://www.psyced.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]