Hello Axel,
> Yeah, and the version.sh call itself can be removed, too. Will do.
>
> Thanks for bringing this up despite the initially differing opinions.
> :-)
>
thanks to you!
And forgive me if I wasn't clear enough, I wrote the email after a somewhat
deep analysis of the issue, and my initial effort was to have something like a
"dkms.in" evaulated during build into a "dkms" file, after doing the
substitutions.
Unfortunately, it became a little difficult to implement, due to the version.sh
file
not being easy to convert into a "sed s/FOO/foo/g < dkms.in > dkms"
This is what I did before thinking it was not easily upstreamable:
diff -Nru iptables-netflow-2.5/debian/patches/patch
iptables-netflow-2.5/debian/patches/patch
--- iptables-netflow-2.5/debian/patches/patch 1970-01-01 01:00:00.000000000
+0100
+++ iptables-netflow-2.5/debian/patches/patch 2020-08-11 21:00:13.000000000
+0200
@@ -0,0 +1,30 @@
+--- iptables-netflow-2.5.orig/Makefile.in
++++ iptables-netflow-2.5/Makefile.in
+@@ -43,7 +43,7 @@ mclean:
+ lclean:
+ -rm -f *.so *_sh.o
+ clean: mclean lclean
+- -rm -f *.so *.o modules.order version.h compat_def.h
++ -rm -f *.so *.o modules.order version.h compat_def.h dkms.conf
+
+ snmp_NETFLOW.so: snmp_NETFLOW.c
+ $(CC) -fPIC -shared -o $@ $< -lnetsnmp
+@@ -76,6 +76,7 @@ version.h: ipt_NETFLOW.c ipt_NETFLOW.h c
+
+ linstall: | libipt_NETFLOW.so libip6t_NETFLOW.so
+ @echo " *"
++ sed s/@VERSION@/$(shell ./version.sh)/g < dkms.conf.in > dkms.conf
+ install -D libipt_NETFLOW.so
$(DESTDIR)$(IPTABLES_MODULES)/libipt_NETFLOW.so
+ install -D libip6t_NETFLOW.so
$(DESTDIR)$(IPTABLES_MODULES)/libip6t_NETFLOW.so
+
+--- /dev/null
++++ iptables-netflow-2.5/dkms.conf.in
+@@ -0,0 +1,8 @@
++PACKAGE_NAME="ipt-netflow"
++PACKAGE_VERSION=@VERSION@
++BUILT_MODULE_NAME[0]=ipt_NETFLOW
++DEST_MODULE_LOCATION[0]=/kernel/extra
++STRIP[0]=no
++MAKE[0]="make ipt_NETFLOW.ko"
++PRE_BUILD="./configure --from-dkms-conf=$kernel_source_dir"
++AUTOINSTALL=yes
and then I simplified rules file, to drop the VERSION sed.
--- iptables-netflow-2.5/debian/rules 2020-05-20 17:20:43.000000000 +0200
+++ iptables-netflow-2.5/debian/rules 2020-08-11 21:01:54.000000000 +0200
@@ -42,5 +42,5 @@
[ ! -e Makefile ] || $(MAKE) lclean
override_dh_dkms:
- sed -e
's#`\./version.sh`#$(DEB_VERSION_UPSTREAM)#;s#^PRE_BUILD="\(.*\)"#PRE_BUILD="\1
$(DKMS_CONFIGURE_OPTIONS)"#' dkms.conf > debian/dkms
+ sed -e 's#^PRE_BUILD="\(.*\)"#PRE_BUILD="\1
$(DKMS_CONFIGURE_OPTIONS)"#' dkms.conf > debian/dkms
dh_dkms
this looks somewhat upstreamable, and also Debian friendly (I'm not sure if
having a .git directory makes the script fail to provide the correct output,
this is one reason for me not giving the patch before)
Feel free to send it upstream if you like it!
thanks a lot!
G.