unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Apply patch to read-only file
@ 2021-09-16  7:49 phodina via
  2021-09-25 12:08 ` Guillaume Le Vaillant
  0 siblings, 1 reply; 6+ messages in thread
From: phodina via @ 2021-09-16  7:49 UTC (permalink / raw)
  To: help-guix

Hi,

I'm attempting to package realmd program. However, there seems to be an issue as it does not support GuixSD. Therefore I created a patch.

When I specify the patch the hunk fails as the configure.ac file is read-only.
I tried to use snippets but they seem to be applied after the patch therefore don't work.

Is there a way how to patch a read-only files? I got the idea from this thread [1]. Below is the package definition and patch.

[1] https://lists.gnu.org/archive/html/help-guix/2020-01/msg00063.html

realmd.scm
-------------------------------------------------------------------------------------
(define-module (realmd)
#:use-module (guix packages)
#:use-module (gnu packages)
#:use-module (gnu packages image)
#:use-module (gnu packages glib)
#:use-module (gnu packages autotools)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages polkit)
#:use-module (guix git-download)
#:use-module (guix build-system gnu)
#:use-module ((guix licenses) #:prefix license:))

(define-public realmd
(package
(name "realmd")
(version "0.17.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/freedesktop/realmd")
(commit version)))
(file-name (git-file-name name version))
(modules '((guix build utils)))
(snippet
'(begin
(delete-file "configure.ac")
;(make-file-writable "configure.ac")
#t))
(patches '("realmd-guixsd-support.patch"))
(sha256
(base32
"1c6q2a86kk2f1akzc36nh52hfwsmmc0mbp6ayyjxj4zsyk9zx5bf"))))
(build-system gnu-build-system)
(native-inputs `(("pkg-config" ,pkg-config)
("autoconf" ,autoconf)
("intltool" ,intltool)
("automake" ,automake)))
(inputs `(("glib" ,glib)
("polkit" ,polkit)))
(synopsis "DBus service for configuring kerberos and other online identities")
(description "Dbus system service that manages discovery and enrollment
in realms/domains like Active Directory or IPA.")
(home-page "https://www.freedesktop.org/software/realmd/")
(license license:lgpl2.1)))
------------------------------------------------------------------------------
realmd-guixsd-support.patch ([PATCH] Add GuixSD support)
-------------------------------------------------------------------------------

diff --git a/configure.ac b/configure.ac
index 4dac5a9..9e818d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ if test -z $DISTRO; then
AC_CHECK_FILE(/etc/redhat-release, [DISTRO="redhat"])
AC_CHECK_FILE(/etc/debian_version, [DISTRO="debian"])
AC_CHECK_FILE(/etc/SuSE-release, [DISTRO="suse"])
+ AC_CHECK_FILE(/gnu/store, [DISTRO="guixsd"])

# Not customized for these yet
dnl AC_CHECK_FILE(/etc/gentoo-release, [DISTRO="gentoo"])
@@ -103,51 +104,6 @@ PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)
AC_SUBST(POLKIT_CFLAGS)
AC_SUBST(POLKIT_LIBS)

-# --------------------------------------------------------------------
-# systemd
-
-AC_MSG_CHECKING([systemd unit directory])
-AC_ARG_WITH(systemd-unit-dir,
- AS_HELP_STRING([--with-systemd-unit-dir],
- [Directory to install systemd service file]))
-
-if test "$with_systemd_unit_dir" = "" -o "$with_systemd_unit_dir" = "yes"; then
- with_systemd_unit_dir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
- if test "$with_systemd_unit_dir" = ""; then
- AC_MSG_ERROR(["Couldn't find systemd system unit directory"])
- fi
-
-elif test "$with_systemd_unit_dir" = "no"; then
- with_systemd_unit_dir=""
-
-fi
-
-SYSTEMD_UNIT_DIR="$with_systemd_unit_dir"
-AC_SUBST(SYSTEMD_UNIT_DIR)
-AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemd_unit_dir"])
-
-dbus_systemd_service=""
-if test -n "$with_systemd_unit_dir"; then
- dbus_systemd_service="SystemdService=realmd.service"
-fi
-AC_SUBST(dbus_systemd_service)
-
-AC_MSG_RESULT($with_systemd_unit_dir)
-
-AC_ARG_WITH(systemd-journal,
- AS_HELP_STRING([--with-systemd-journal],
- [Use systemd's journal for logging]))
-
-if test "$with_systemd_journal" != "no"; then
- AC_DEFINE_UNQUOTED(WITH_JOURNAL, 1, [Use systemd's journal])
- PKG_CHECK_MODULES(SYSTEMD_JOURNAL, [libsystemd],,
- [PKG_CHECK_MODULES(SYSTEMD_JOURNAL, [libsystemd-journal])])
- with_systemd_journal="yes"
-fi
-
-AC_SUBST(SYSTEMD_JOURNAL_CFLAGS)
-AC_SUBST(SYSTEMD_JOURNAL_LIBS)
-
# -------------------------------------------------------------------
# resolv

diff --git a/service/realmd-guixsd.conf b/service/realmd-guixsd.conf
new file mode 100644
index 0000000..ac4b436
--- /dev/null
+++ b/service/realmd-guixsd.conf
@@ -0,0 +1,42 @@
+# Default values for realmd
+[service]
+debug = no
+automatic-install = yes
+
+[paths]
+net = /usr/bin/net
+winbindd = /usr/sbin/winbindd
+smb.conf = /etc/smb.conf
+sssd.conf = /etc/sssd/sssd.conf
+adcli = /usr/sbin/adcli
+ipa-client-install = /usr/sbin/ipa-client-install
+pam_winbind.conf = /etc/security/pam_winbind.conf
+krb5.conf = /etc/krb5.conf
+
+[active-directory]
+default-client = sssd
+os-name =
+os-version =
+
+[providers]
+sssd = yes
+samba = yes
+example = no
+
+[samba-packages]
+
+[winbind-packages]
+
+[sssd-packages]
+
+[adcli-packages]
+
+[commands]
+
+[users]
+default-shell = /bin/bash
+default-home = /home/%U@%D
+
+[example.com]
+example-administrator = Administrator
+example-password = bureaucracy
--
2.32.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Apply patch to read-only file
  2021-09-16  7:49 Apply patch to read-only file phodina via
@ 2021-09-25 12:08 ` Guillaume Le Vaillant
  2021-09-27 22:57   ` phodina
  0 siblings, 1 reply; 6+ messages in thread
From: Guillaume Le Vaillant @ 2021-09-25 12:08 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

Hi,

It looks like your email client removed many spaces in your definitions
for "realmd.scm" and "realmd-guixsd-support.patch", which made the
package definition hard to read and the patch invalid.
Could send these files as attachment (or prevent your email client from
mangling them)?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Apply patch to read-only file
  2021-09-25 12:08 ` Guillaume Le Vaillant
@ 2021-09-27 22:57   ` phodina
  2021-09-29  8:42     ` Guillaume Le Vaillant
  0 siblings, 1 reply; 6+ messages in thread
From: phodina @ 2021-09-27 22:57 UTC (permalink / raw)
  To: Guillaume Le Vaillant; +Cc: help-guix

Hi Guillaume,

Sure, here's the formatted file. My appology for the issue with the mail client.

--8<---------------cut here---------------start------------->8---

(define-module (realmd)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (gnu packages image)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages polkit)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module ((guix licenses) #:prefix license:))

(define-public realmd
(package
  (name "realmd")
  (version "0.17.0")
  (source (origin
            (method git-fetch)
            (uri (git-reference
             (url "https://github.com/freedesktop/realmd")
             (commit version)))
            (file-name (git-file-name name version))
            (modules '((guix build utils)))
             (snippet
              '(begin
               (delete-file "configure.ac")
               ;(make-file-writable "configure.ac")
                #t))
            (patches '("endgame/packages/patches/realmd-guixsd-support.patch"))
            (sha256
             (base32
              "1c6q2a86kk2f1akzc36nh52hfwsmmc0mbp6ayyjxj4zsyk9zx5bf"))))
  (build-system gnu-build-system)
  (arguments
    `(#:phases
      (modify-phases %standard-phases
		     (add-after 'unpack 'make-git-checkout-writable
				(lambda* (#:key inputs #:allow-other-keys)
				       (make-file-writable "configure.ac"))
		     (add-after 'unpack 'apply-patches
					 (for-each
					   (lambda (file)
					     (invoke "patch" "--force" "-p1" "-input" "endgame/packages/patches/realmd-guixsd-support.patch"))))
		     ))))

		     ; gnuzilla.scm
						     ; jami.scm
  (native-inputs `(("pkg-config" ,pkg-config)
                   ("autoconf" ,autoconf)
                   ("intltool" ,intltool)
                   ("automake" ,automake)))
  (inputs `(("glib" ,glib)
            ("polkit" ,polkit)))
  (synopsis "DBus service for configuring kerberos and other online identities")
  (description "Dbus system service that manages discovery and enrollment
in realms/domains like Active Directory or IPA.")
  (home-page "https://www.freedesktop.org/software/realmd/")
  (license license:lgpl2.1)))


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Apply patch to read-only file
@ 2021-09-28  4:47 Sarah Morgensen
  0 siblings, 0 replies; 6+ messages in thread
From: Sarah Morgensen @ 2021-09-28  4:47 UTC (permalink / raw)
  To: phodina; +Cc: help-guix

Hello Petr,

phodina <phodina@protonmail.com> writes:

> Hi Guillaume,
>
> Sure, here's the formatted file. My appology for the issue with the mail client.
>
> --8<---------------cut here---------------start------------->8---
>
> (define-module (realmd)
>   #:use-module (guix packages)
>   #:use-module (gnu packages)
>   #:use-module (gnu packages image)
>   #:use-module (gnu packages glib)
>   #:use-module (gnu packages autotools)
>   #:use-module (gnu packages pkg-config)
>   #:use-module (gnu packages polkit)
>   #:use-module (guix git-download)
>   #:use-module (guix build-system gnu)
>   #:use-module ((guix licenses) #:prefix license:))
>
> (define-public realmd
> (package
>   (name "realmd")
>   (version "0.17.0")
>   (source (origin
>             (method git-fetch)
>             (uri (git-reference
>              (url "https://github.com/freedesktop/realmd")
>              (commit version)))
>             (file-name (git-file-name name version))
>             (modules '((guix build utils)))
>              (snippet
>               '(begin
>                (delete-file "configure.ac")
>                ;(make-file-writable "configure.ac")
>                 #t))
>             (patches '("endgame/packages/patches/realmd-guixsd-support.patch"))
>             (sha256
>              (base32
>               "1c6q2a86kk2f1akzc36nh52hfwsmmc0mbp6ayyjxj4zsyk9zx5bf"))))
>   (build-system gnu-build-system)
>   (arguments
>     `(#:phases
>       (modify-phases %standard-phases
> 		     (add-after 'unpack 'make-git-checkout-writable
> 				(lambda* (#:key inputs #:allow-other-keys)
> 				       (make-file-writable "configure.ac"))
> 		     (add-after 'unpack 'apply-patches
> 					 (for-each
> 					   (lambda (file)
> 					     (invoke "patch" "--force" "-p1" "-input" "endgame/packages/patches/realmd-guixsd-support.patch"))))
> 		     ))))
>
> 		     ; gnuzilla.scm
> 						     ; jami.scm
>   (native-inputs `(("pkg-config" ,pkg-config)
>                    ("autoconf" ,autoconf)
>                    ("intltool" ,intltool)
>                    ("automake" ,automake)))
>   (inputs `(("glib" ,glib)
>             ("polkit" ,polkit)))
>   (synopsis "DBus service for configuring kerberos and other online identities")
>   (description "Dbus system service that manages discovery and enrollment
> in realms/domains like Active Directory or IPA.")
>   (home-page "https://www.freedesktop.org/software/realmd/")
>   (license license:lgpl2.1)))

Is the issue maybe from deleting "configure.ac" in the snippet, then
trying to modify its permissions in 'make-git-checkout-writable'?

--
Sarah


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Apply patch to read-only file
  2021-09-27 22:57   ` phodina
@ 2021-09-29  8:42     ` Guillaume Le Vaillant
  2021-10-02 19:49       ` phodina
  0 siblings, 1 reply; 6+ messages in thread
From: Guillaume Le Vaillant @ 2021-09-29  8:42 UTC (permalink / raw)
  To: phodina; +Cc: Sarah Morgensen, help-guix


[-- Attachment #1.1: Type: text/plain, Size: 203 bytes --]

Hi,

I tried with simplified versions of your package definition and patch,
and it builds fine for me. The patch gets applied successfully.

However I haven't tried using the program to see if it works.

[-- Attachment #1.2: realmd.scm --]
[-- Type: application/octet-stream, Size: 1890 bytes --]

(define-module (gnu packages realmd)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages image)
  #:use-module (gnu packages kerberos)
  #:use-module (gnu packages openldap)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages polkit)
  #:use-module (gnu packages python)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module ((guix licenses) #:prefix license:))

(define-public realmd
  (package
    (name "realmd")
    (version "0.17.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/freedesktop/realmd")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1c6q2a86kk2f1akzc36nh52hfwsmmc0mbp6ayyjxj4zsyk9zx5bf"))
              (patches (search-patches "realmd-guixsd-support.patch"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("glib-bin" ,glib "bin")
       ("intltool" ,intltool)
       ("pkg-config" ,pkg-config)
       ("python" ,python)))
    (inputs
     `(("glib" ,glib)
       ("mit-krb5" ,mit-krb5)
       ("openldap" ,openldap)
       ("polkit" ,polkit)))
    (arguments
     `(#:configure-flags '("--with-systemd-unit-dir=no"
                           "--with-systemd-journal=no"
                           "--disable-doc")))
    (synopsis
     "DBus service for configuring kerberos and other online identities")
    (description
     "Dbus system service that manages discovery and enrollment in
realms/domains like Active Directory or IPA.")
    (home-page "https://www.freedesktop.org/software/realmd/")
    (license license:lgpl2.1)))

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: realmd-guixsd-support.patch --]
[-- Type: text/x-patch, Size: 1589 bytes --]

commit ffa79f48ce454b00c0590432010dbe58cdfd3ed2
Author: Guillaume Le Vaillant <glv@posteo.net>
Date:   Wed Sep 29 10:17:50 2021 +0200

    Add GuixSD support

diff --git a/configure.ac b/configure.ac
index ee067d9..27dea11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,8 @@ if test -z $DISTRO; then
 	AC_CHECK_FILE(/etc/redhat-release, [DISTRO="redhat"])
 	AC_CHECK_FILE(/etc/debian_version, [DISTRO="debian"])
 	AC_CHECK_FILE(/etc/SuSE-release, [DISTRO="suse"])
+	AC_CHECK_FILE(/gnu/store, [DISTRO="guixsd"])
 
 	# Not customized for these yet
 	dnl AC_CHECK_FILE(/etc/gentoo-release, [DISTRO="gentoo"])
 
diff --git a/service/realmd-guixsd.conf b/service/realmd-guixsd.conf
new file mode 100644
index 0000000..ac4b436
--- /dev/null
+++ b/service/realmd-guixsd.conf
@@ -0,0 +1,42 @@
+# Default values for realmd
+[service]
+debug = no
+automatic-install = yes
+
+[paths]
+net = /usr/bin/net
+winbindd = /usr/sbin/winbindd
+smb.conf = /etc/smb.conf
+sssd.conf = /etc/sssd/sssd.conf
+adcli = /usr/sbin/adcli
+ipa-client-install = /usr/sbin/ipa-client-install
+pam_winbind.conf = /etc/security/pam_winbind.conf
+krb5.conf = /etc/krb5.conf
+
+[active-directory]
+default-client = sssd
+os-name =
+os-version =
+
+[providers]
+sssd = yes
+samba = yes
+example = no
+
+[samba-packages]
+
+[winbind-packages]
+
+[sssd-packages]
+
+[adcli-packages]
+
+[commands]
+
+[users]
+default-shell = /bin/bash
+default-home = /home/%U@%D
+
+[example.com]
+example-administrator = Administrator
+example-password = bureaucracy

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Apply patch to read-only file
  2021-09-29  8:42     ` Guillaume Le Vaillant
@ 2021-10-02 19:49       ` phodina
  0 siblings, 0 replies; 6+ messages in thread
From: phodina @ 2021-10-02 19:49 UTC (permalink / raw)
  To: Guillaume Le Vaillant; +Cc: help-guix, Sarah Morgensen

[-- Attachment #1: Type: text/plain, Size: 905 bytes --]

Hi Guillaume,

On Wednesday, September 29th, 2021 at 10:42 AM, Guillaume Le Vaillant <glv@posteo.net> wrote:

> Hi,
>
> I tried with simplified versions of your package definition and patch,
>
> and it builds fine for me. The patch gets applied successfully.
>

Thanks for the help and the package definition. I also managed to figure out what went wrong - I created the patch on master and attempted to patch 0.17.0.

The only other issue I had was with the xmlto, where I attempted to use local validation using docbook-xml based on example provided in gnu/packages/gnome.scm. See the attached file.

However, I gave up and also used the --disable-docs flag.
> However I haven't tried using the program to see if it works.

Well, that's another issue.
- It needs correct config file
- There has to be a service running. So I'll look into that now.

Thanks and have a nice day
Petr

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: realmd.scm --]
[-- Type: text/x-scheme; name=realmd.scm, Size: 3034 bytes --]

(define-module (endgame packages realmd)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (gnu packages kerberos)
  #:use-module (gnu packages openldap)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages docbook)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages polkit)
  #:use-module (gnu packages xml)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module ((guix licenses) #:prefix license:))

(define-public realmd
  (package
    (name "realmd")
    (version "0.17.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                (url "https://github.com/freedesktop/realmd")
                (commit version)))
              (file-name (git-file-name name version))
              (patches '("endgame/packages/patches/realmd-remove-distro-detection.patch"))
              (sha256
                (base32
                  "1c6q2a86kk2f1akzc36nh52hfwsmmc0mbp6ayyjxj4zsyk9zx5bf"))))
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags (list "--with-systemd-unit-dir=no" "--with-systemd-journal=no" "--disable-doc")
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'xml-validation
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((local (string-append (assoc-ref inputs "docbook-xml") "/xml/dtd/docbook")))
	     ; substitute in order to validate locally due to network restriction
             (substitute*  "doc/internals/realmd-internals.xml"
			   (("http://.*/xml/4.3") local))
             (substitute*  "doc/manual/realm.xml"
			   (("http://.*/xml/4.2") local))
             (substitute*  "doc/manual/realmd.conf.xml"
			   (("http://.*/xml/4.2") local))
             (substitute*  "doc/manual/realmd-docs.xml"
			   (("http://.*/xml/4.3") local))
             (substitute*  "doc/manual/realmd-guide-active-directory.xml"
			   (("http://.*/xml/4.3") local))
             (substitute*  "doc/manual/realmd-guide-ipa.xml"
			   (("http://.*/xml/4.3") local))
             (substitute*  "./doc/manual/realmd-guide-kerberos.xml"
			   (("http://.*/xml/4.3") local))#t))))))
  (native-inputs `(("pkg-config" ,pkg-config)
                   ("autoconf" ,autoconf)
                   ("intltool" ,intltool)
                   ("libxslt" ,libxslt)
                   ("xmlto" ,xmlto)
                   ("python" ,python)
		   ("docbook-xml" ,docbook-xml)
                   ("automake" ,automake)))
  (inputs `(("glib" ,glib "bin")
	    ("dbus" ,dbus)
	    ("mit-krb5" ,mit-krb5)
	    ("openldap" ,openldap)
            ("polkit" ,polkit)))
  (synopsis "DBus service for configuring kerberos and other online identities")
  (description "Dbus system service that manages discovery and enrollment
in realms/domains like Active Directory or IPA.")
  (home-page "https://www.freedesktop.org/software/realmd/")
  (license license:lgpl2.1)))

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-02 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-16  7:49 Apply patch to read-only file phodina via
2021-09-25 12:08 ` Guillaume Le Vaillant
2021-09-27 22:57   ` phodina
2021-09-29  8:42     ` Guillaume Le Vaillant
2021-10-02 19:49       ` phodina
  -- strict thread matches above, loose matches on Subject: below --
2021-09-28  4:47 Sarah Morgensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).