Skip to content

Commit

Permalink
add mwxml2sql
Browse files Browse the repository at this point in the history
  • Loading branch information
42LoCo42 committed Jan 17, 2025
1 parent 253b0d1 commit bd8585c
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A personal collection of unusual things
* substituter: `https://attic.eleonora.gay/default`
* public key: `default:3FYh8sZV8gWa7Jc5jlP7gZFK7pt3kaHRiV70ySaQ42g=`

## 57 Packages
## 58 Packages

| Name | Version | Description | Homepage |
|------|---------|-------------|----------|
Expand Down Expand Up @@ -43,6 +43,7 @@ A personal collection of unusual things
|`modest`|`0.0.6-devel`|A fast HTML renderer implemented as a pure C99 library with no outside dependencies|https://github.com/lexborisov/Modest|
|`msp-cgt`|`21.6.1`|MSP430 code generation tools|https://www.ti.com/tool/MSP-CGT|
|`mspgcc-ti`|`9.3.1.11`|Open Source Compiler for MSP Microcontrollers|https://www.ti.com/tool/MSP430-GCC-OPENSOURCE|
|`mwxml2sql`|`2017-11-02`|Convert Mediawiki XML dumps to SQL|https://gerrit.wikimedia.org/g/operations/dumps/import-tools|
|`my-htop`|`5d778ea`|htop with sorting in tree mode fixed|https://htop.dev|
|`nchess`|`0.0`|A curses based, UCI compatible, chess gui|https://github.com/spinojara/nchess|
|`ncps`|`0.1.1`|Nix binary cache proxy service -- with local caching and signing|https://github.com/kalbasit/ncps|
Expand Down
50 changes: 50 additions & 0 deletions packages/mwxml2sql/0001-Makefile-remove-hardcoded-tool-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
From a58b67c8eeabc7ced0f41129ed41bbf48ceea804 Mon Sep 17 00:00:00 2001
From: Leon Schumacher <[email protected]>
Date: Fri, 17 Jan 2025 10:47:13 +0100
Subject: [PATCH 1/2] Makefile: remove hardcoded tool paths

---
xmlfileutils/Makefile | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/xmlfileutils/Makefile b/xmlfileutils/Makefile
index 7f0f770..8b11209 100644
--- a/xmlfileutils/Makefile
+++ b/xmlfileutils/Makefile
@@ -13,10 +13,6 @@ NAME_SQLFILTER = "filter MySQL INSERT commands with fields matching values"
BINDIR = $(DESTDIR)$(PREFIX)/usr/bin/
MANDIR = $(DESTDIR)$(PREFIX)/usr/share/man/man1/

-GZIP = /bin/gzip
-HELP2MAN = /usr/bin/help2man
-SHELL = /bin/sh
-
CC=gcc
LDFLAGS=
#LDFLAGS= -g
@@ -41,16 +37,16 @@ sqlfilter: sqlfilter.o filebuffers.o sqlutils.o
manpages: mwxml2sql.1.gz sql2txt.1.gz sqlfilter.1.gz

mwxml2sql.1.gz: mwxml2sql
- $(HELP2MAN) --section 1 --no-info --name $(NAME_MWXML2SQL) \
- --no-discard-stderr ./mwxml2sql | $(GZIP) > mwxml2sql.1.gz
+ help2man --section 1 --no-info --name $(NAME_MWXML2SQL) \
+ --no-discard-stderr ./mwxml2sql | gzip > mwxml2sql.1.gz

sql2txt.1.gz: sql2txt
- $(HELP2MAN) --section 1 --no-info --name $(NAME_SQL2TXT) \
- --no-discard-stderr ./sql2txt | $(GZIP) > sql2txt.1.gz
+ help2man --section 1 --no-info --name $(NAME_SQL2TXT) \
+ --no-discard-stderr ./sql2txt | gzip > sql2txt.1.gz

sqlfilter.1.gz: sqlfilter
- $(HELP2MAN) --section 1 --no-info --name $(NAME_SQLFILTER) \
- --no-discard-stderr ./sqlfilter | $(GZIP) > sqlfilter.1.gz
+ help2man --section 1 --no-info --name $(NAME_SQLFILTER) \
+ --no-discard-stderr ./sqlfilter | gzip > sqlfilter.1.gz

install: mwxml2sql sql2txt sqlfilter
install --directory $(BINDIR)
--
2.47.0

27 changes: 27 additions & 0 deletions packages/mwxml2sql/0002-Makefile-dont-install-into-usr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 38f5a9e8815e028788e664480e24bcf7c939b78c Mon Sep 17 00:00:00 2001
From: Leon Schumacher <[email protected]>
Date: Fri, 17 Jan 2025 10:52:38 +0100
Subject: [PATCH 2/2] Makefile: dont install into /usr

---
xmlfileutils/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xmlfileutils/Makefile b/xmlfileutils/Makefile
index 8b11209..e394d5d 100644
--- a/xmlfileutils/Makefile
+++ b/xmlfileutils/Makefile
@@ -10,8 +10,8 @@ NAME_MWXML2SQL = "convert MediaWiki XML dump file to MySQL INSERT commands"
NAME_SQL2TXT = "convert MySQL INSERT commands to tab-separated data"
NAME_SQLFILTER = "filter MySQL INSERT commands with fields matching values"

-BINDIR = $(DESTDIR)$(PREFIX)/usr/bin/
-MANDIR = $(DESTDIR)$(PREFIX)/usr/share/man/man1/
+BINDIR = $(DESTDIR)$(PREFIX)/bin/
+MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1/

CC=gcc
LDFLAGS=
--
2.47.0

35 changes: 35 additions & 0 deletions packages/mwxml2sql/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
pkgs: pkgs.stdenv.mkDerivation rec {
pname = "mwxml2sql";
version = "2017-11-02";

src = pkgs.fetchgit {
url = "https://gerrit.wikimedia.org/r/operations/dumps/import-tools";
rev = "2e3e5ec62e22bba7e7599512019d44dd4e8d005a";
hash = "sha256-EL1rAfJXg0bqKiCefxjbUlZUgfYMPydGp3cCQ4qzJe8=";
};

patches = [
./0001-Makefile-remove-hardcoded-tool-paths.patch
./0002-Makefile-dont-install-into-usr.patch
];

makeFlags = [
"--directory=xmlfileutils"
"PREFIX=$(out)"
];

nativeBuildInputs = with pkgs; [
help2man
];

buildInputs = with pkgs; [
bzip2
libz
];

meta = {
description = "Convert Mediawiki XML dumps to SQL";
homepage = "https://gerrit.wikimedia.org/g/operations/dumps/import-tools";
mainProgram = pname;
};
}

0 comments on commit bd8585c

Please sign in to comment.