This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=affb86e43bdf72ed2b4deaa8b9fe13f313c58363

commit affb86e43bdf72ed2b4deaa8b9fe13f313c58363
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Dec 4 05:10:33 2021 +0100

    build: Reorganize dpkg programs source code under src/
    
    - Move dpkg-deb and dpkg-split under src/ as these are part of the dpkg
      toolset.
    - Move common source files under src/common/.
    - Move program specific source files under subdirectories in src/.
    - Rename the various *cmd.c into <tool>/main.c.
    - Set automake option subdir-objects.
---
 .gitignore                             |  1 +
 Makefile.am                            |  2 -
 README.l10n                            |  4 +-
 configure.ac                           |  3 +-
 dpkg-deb/.gitignore                    |  1 -
 dpkg-deb/Makefile.am                   | 27 ----------
 dpkg-split/.gitignore                  |  1 -
 dpkg-split/Makefile.am                 | 29 ----------
 po/POTFILES.in                         | 73 +++++++++++++------------
 src/.gitignore                         |  2 +
 src/Makefile.am                        | 98 +++++++++++++++++++++++-----------
 src/{ => common}/actions.h             |  0
 src/{ => common}/force.c               |  0
 src/{ => common}/force.h               |  0
 src/{ => common}/security-mac.h        |  0
 src/{ => common}/selinux.c             |  0
 {dpkg-deb => src/deb}/build.c          |  0
 {dpkg-deb => src/deb}/dpkg-deb.h       |  0
 {dpkg-deb => src/deb}/extract.c        |  0
 {dpkg-deb => src/deb}/info.c           |  0
 {dpkg-deb => src/deb}/main.c           |  0
 src/{divertcmd.c => divert/main.c}     |  0
 src/{ => main}/archives.c              |  0
 src/{ => main}/archives.h              |  0
 src/{ => main}/cleanup.c               |  0
 src/{ => main}/configure.c             |  0
 src/{ => main}/depcon.c                |  0
 src/{ => main}/enquiry.c               |  0
 src/{ => main}/errors.c                |  0
 src/{ => main}/file-match.c            |  0
 src/{ => main}/file-match.h            |  0
 src/{ => main}/filters.c               |  0
 src/{ => main}/filters.h               |  0
 src/{ => main}/help.c                  |  0
 src/{ => main}/main.c                  |  0
 src/{ => main}/main.h                  |  0
 src/{ => main}/packages.c              |  0
 src/{ => main}/perpkgstate.c           |  0
 src/{ => main}/remove.c                |  0
 src/{ => main}/script.c                |  0
 src/{ => main}/select.c                |  0
 src/{ => main}/trigproc.c              |  0
 src/{ => main}/unpack.c                |  0
 src/{ => main}/update.c                |  0
 src/{ => main}/verify.c                |  0
 src/{querycmd.c => query/main.c}       |  0
 {dpkg-split => src/split}/dpkg-split.h |  0
 {dpkg-split => src/split}/info.c       |  0
 {dpkg-split => src/split}/join.c       |  0
 {dpkg-split => src/split}/main.c       |  0
 {dpkg-split => src/split}/queue.c      |  0
 {dpkg-split => src/split}/split.c      |  0
 src/{statcmd.c => statoverride/main.c} |  0
 src/{trigcmd.c => trigger/main.c}      |  0
 t-func/atlocal.in                      |  2 +-
 t/cppcheck/cppcheck.supp               |  8 +--
 tests/Test.mk                          |  2 +-
 57 files changed, 117 insertions(+), 136 deletions(-)

diff --git a/.gitignore b/.gitignore
index 37d5a0ee2..555b4b981 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@
 *.trs
 *~
 .*.swp
+.dirstamp
 .deps/
 .libs/
 Makefile
diff --git a/Makefile.am b/Makefile.am
index dfd92850e..9b5801df2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,8 +6,6 @@ endif
 
 SUBDIRS = \
        lib \
-       dpkg-deb \
-       dpkg-split \
        src \
        utils \
        $(MAYBE_DSELECT) \
diff --git a/README.l10n b/README.l10n
index 0b9645a63..01e5d2c24 100644
--- a/README.l10n
+++ b/README.l10n
@@ -21,8 +21,8 @@ the following rules:
 
   - <Action> is one of “Update” or “Add”,
   - <Language> should be capitalized (such as “English”),
-  - <part> should be one of «programs» (for lib, src/, dpkg-deb/, dpkg-split/
-    and utils/), «dselect», «scripts» and «man pages» (man/).
+  - <part> should be one of «programs» (for lib/, src/ and utils/), «dselect»,
+    «scripts» and «man pages» (man/).
 
   For example:
 
diff --git a/configure.ac b/configure.ac
index 68d17eb41..b3beeef75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,7 @@ AM_INIT_AUTOMAKE(
   [-Wall]
   [foreign]
   [nostdinc]
+  [subdir-objects]
   [tar-ustar no-dist-gzip dist-xz]
 )
 AM_SILENT_RULES([yes])
@@ -230,8 +231,6 @@ AC_CONFIG_FILES([
   Makefile
   t-func/Makefile
   t-func/atlocal
-  dpkg-deb/Makefile
-  dpkg-split/Makefile
   dselect/Makefile
   dselect/methods/Makefile
   dselect/po/Makefile.in
diff --git a/dpkg-deb/.gitignore b/dpkg-deb/.gitignore
deleted file mode 100644
index 135d53c50..000000000
--- a/dpkg-deb/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dpkg-deb
diff --git a/dpkg-deb/Makefile.am b/dpkg-deb/Makefile.am
deleted file mode 100644
index e24bb2484..000000000
--- a/dpkg-deb/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-AM_CPPFLAGS = \
-       -DLOCALEDIR=\"$(localedir)\" \
-       -idirafter $(top_srcdir)/lib/compat \
-       -I$(top_builddir) \
-       -I$(top_srcdir)/lib \
-       # EOL
-
-
-bin_PROGRAMS = dpkg-deb
-
-dpkg_deb_SOURCES = \
-       dpkg-deb.h \
-       build.c \
-       extract.c \
-       info.c \
-       main.c \
-       # EOL
-
-dpkg_deb_LDADD = \
-       ../lib/dpkg/libdpkg.la \
-       $(LIBINTL) \
-       $(Z_LIBS) \
-       $(LZMA_LIBS) \
-       $(BZ2_LIBS) \
-       # EOL
diff --git a/dpkg-split/.gitignore b/dpkg-split/.gitignore
deleted file mode 100644
index 26aab3932..000000000
--- a/dpkg-split/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dpkg-split
diff --git a/dpkg-split/Makefile.am b/dpkg-split/Makefile.am
deleted file mode 100644
index ee2c13dd5..000000000
--- a/dpkg-split/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-AM_CPPFLAGS = \
-       -DLOCALEDIR=\"$(localedir)\" \
-       -DADMINDIR=\"$(admindir)\" \
-       -idirafter $(top_srcdir)/lib/compat \
-       -I$(top_builddir) \
-       -I$(top_srcdir)/lib \
-       # EOL
-
-
-bin_PROGRAMS = dpkg-split
-
-dpkg_split_SOURCES = \
-       dpkg-split.h \
-       info.c \
-       join.c \
-       main.c \
-       queue.c \
-       split.c \
-       # EOL
-
-dpkg_split_LDADD = \
-       ../lib/dpkg/libdpkg.la \
-       $(LIBINTL) \
-       # EOL
-
-install-data-local:
-       $(MKDIR_P) $(DESTDIR)$(admindir)/parts
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2bc37a9b3..4008a3abf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -72,42 +72,47 @@ lib/dpkg/utils.c
 lib/dpkg/varbuf.c
 lib/dpkg/version.c
 
-src/archives.c
-src/cleanup.c
-src/configure.c
-src/depcon.c
-src/divertcmd.c
-src/enquiry.c
-src/errors.c
-src/file-match.c
-src/filters.c
-src/force.c
-src/help.c
-src/main.c
-src/packages.c
-src/perpkgstate.c
-src/querycmd.c
-src/remove.c
-src/script.c
-src/select.c
-src/selinux.c
-src/statcmd.c
-src/trigcmd.c
-src/trigproc.c
-src/unpack.c
-src/update.c
-src/verify.c
+src/common/force.c
+src/common/selinux.c
 
-dpkg-deb/build.c
-dpkg-deb/extract.c
-dpkg-deb/info.c
-dpkg-deb/main.c
+src/deb/build.c
+src/deb/extract.c
+src/deb/info.c
+src/deb/main.c
 
-dpkg-split/info.c
-dpkg-split/join.c
-dpkg-split/main.c
-dpkg-split/queue.c
-dpkg-split/split.c
+src/split/info.c
+src/split/join.c
+src/split/main.c
+src/split/queue.c
+src/split/split.c
+
+src/divert/main.c
+
+src/statoverride/main.c
+
+src/trigger/main.c
+
+src/query/main.c
+
+src/main/archives.c
+src/main/cleanup.c
+src/main/configure.c
+src/main/depcon.c
+src/main/enquiry.c
+src/main/errors.c
+src/main/file-match.c
+src/main/filters.c
+src/main/help.c
+src/main/main.c
+src/main/packages.c
+src/main/perpkgstate.c
+src/main/remove.c
+src/main/script.c
+src/main/select.c
+src/main/trigproc.c
+src/main/unpack.c
+src/main/update.c
+src/main/verify.c
 
 utils/start-stop-daemon.c
 utils/update-alternatives.c
diff --git a/src/.gitignore b/src/.gitignore
index f406f2879..bf6a355d1 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,6 +1,8 @@
 dpkg
+dpkg-deb
 dpkg-divert
 dpkg-query
+dpkg-split
 dpkg-statoverride
 dpkg-trigger
 t.tmp
diff --git a/src/Makefile.am b/src/Makefile.am
index bb585b977..2b1d4d3ce 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,7 @@ AM_CPPFLAGS = \
        -idirafter $(top_srcdir)/lib/compat \
        -I$(top_builddir) \
        -I$(top_srcdir)/lib \
+       -I$(srcdir)/common \
        # EOL
 LDADD = \
        ../lib/dpkg/libdpkg.la \
@@ -19,36 +20,43 @@ EXTRA_DIST = \
 
 bin_PROGRAMS = \
        dpkg \
+       dpkg-deb \
        dpkg-divert \
        dpkg-query \
+       dpkg-split \
        dpkg-statoverride \
        dpkg-trigger \
        # EOL
 
 dpkg_SOURCES = \
-       actions.h \
-       archives.c archives.h \
-       cleanup.c \
-       configure.c \
-       depcon.c \
-       enquiry.c \
-       errors.c \
-       file-match.c file-match.h \
-       filters.c filters.h \
-       force.c force.h \
-       help.c \
-       main.c main.h \
-       packages.c \
-       perpkgstate.c \
-       remove.c \
-       script.c \
-       security-mac.h \
-       select.c \
-       selinux.c \
-       trigproc.c \
-       unpack.c \
-       update.c \
-       verify.c \
+       common/actions.h \
+       common/force.c \
+       common/force.h \
+       common/security-mac.h \
+       common/selinux.c \
+       main/archives.c \
+       main/archives.h \
+       main/cleanup.c \
+       main/configure.c \
+       main/depcon.c \
+       main/enquiry.c \
+       main/errors.c \
+       main/file-match.c \
+       main/file-match.h \
+       main/filters.c \
+       main/filters.h \
+       main/help.c \
+       main/main.c \
+       main/main.h \
+       main/packages.c \
+       main/perpkgstate.c \
+       main/remove.c \
+       main/script.c \
+       main/select.c \
+       main/trigproc.c \
+       main/unpack.c \
+       main/update.c \
+       main/verify.c \
        # EOL
 
 dpkg_LDADD = \
@@ -56,21 +64,46 @@ dpkg_LDADD = \
        $(SELINUX_LIBS) \
        # EOL
 
+dpkg_deb_SOURCES = \
+       deb/dpkg-deb.h \
+       deb/build.c \
+       deb/extract.c \
+       deb/info.c \
+       deb/main.c \
+       # EOL
+
+dpkg_deb_LDADD = \
+       $(LDADD) \
+       $(Z_LIBS) \
+       $(LZMA_LIBS) \
+       $(BZ2_LIBS) \
+       # EOL
+
 dpkg_divert_SOURCES = \
-       divertcmd.c \
+       divert/main.c \
        # EOL
 
 dpkg_query_SOURCES = \
-       actions.h \
-       querycmd.c \
+       common/actions.h \
+       query/main.c \
+       # EOL
+
+dpkg_split_SOURCES = \
+       split/dpkg-split.h \
+       split/info.c \
+       split/join.c \
+       split/main.c \
+       split/queue.c \
+       split/split.c \
        # EOL
 
 dpkg_statoverride_SOURCES = \
-       actions.h \
-       force.c force.h \
-       security-mac.h \
-       selinux.c \
-       statcmd.c \
+       common/actions.h \
+       common/force.c \
+       common/force.h \
+       common/security-mac.h \
+       common/selinux.c \
+       statoverride/main.c \
        # EOL
 
 dpkg_statoverride_LDADD = \
@@ -79,12 +112,13 @@ dpkg_statoverride_LDADD = \
        # EOL
 
 dpkg_trigger_SOURCES = \
-       trigcmd.c \
+       trigger/main.c \
        # EOL
 
 install-data-local:
        $(MKDIR_P) $(DESTDIR)$(pkgconfdir)/dpkg.cfg.d
        $(MKDIR_P) $(DESTDIR)$(admindir)/info
+       $(MKDIR_P) $(DESTDIR)$(admindir)/parts
        $(MKDIR_P) $(DESTDIR)$(admindir)/updates
 
 test_tmpdir = t.tmp
diff --git a/src/actions.h b/src/common/actions.h
similarity index 100%
rename from src/actions.h
rename to src/common/actions.h
diff --git a/src/force.c b/src/common/force.c
similarity index 100%
rename from src/force.c
rename to src/common/force.c
diff --git a/src/force.h b/src/common/force.h
similarity index 100%
rename from src/force.h
rename to src/common/force.h
diff --git a/src/security-mac.h b/src/common/security-mac.h
similarity index 100%
rename from src/security-mac.h
rename to src/common/security-mac.h
diff --git a/src/selinux.c b/src/common/selinux.c
similarity index 100%
rename from src/selinux.c
rename to src/common/selinux.c
diff --git a/dpkg-deb/build.c b/src/deb/build.c
similarity index 100%
rename from dpkg-deb/build.c
rename to src/deb/build.c
diff --git a/dpkg-deb/dpkg-deb.h b/src/deb/dpkg-deb.h
similarity index 100%
rename from dpkg-deb/dpkg-deb.h
rename to src/deb/dpkg-deb.h
diff --git a/dpkg-deb/extract.c b/src/deb/extract.c
similarity index 100%
rename from dpkg-deb/extract.c
rename to src/deb/extract.c
diff --git a/dpkg-deb/info.c b/src/deb/info.c
similarity index 100%
rename from dpkg-deb/info.c
rename to src/deb/info.c
diff --git a/dpkg-deb/main.c b/src/deb/main.c
similarity index 100%
rename from dpkg-deb/main.c
rename to src/deb/main.c
diff --git a/src/divertcmd.c b/src/divert/main.c
similarity index 100%
rename from src/divertcmd.c
rename to src/divert/main.c
diff --git a/src/archives.c b/src/main/archives.c
similarity index 100%
rename from src/archives.c
rename to src/main/archives.c
diff --git a/src/archives.h b/src/main/archives.h
similarity index 100%
rename from src/archives.h
rename to src/main/archives.h
diff --git a/src/cleanup.c b/src/main/cleanup.c
similarity index 100%
rename from src/cleanup.c
rename to src/main/cleanup.c
diff --git a/src/configure.c b/src/main/configure.c
similarity index 100%
rename from src/configure.c
rename to src/main/configure.c
diff --git a/src/depcon.c b/src/main/depcon.c
similarity index 100%
rename from src/depcon.c
rename to src/main/depcon.c
diff --git a/src/enquiry.c b/src/main/enquiry.c
similarity index 100%
rename from src/enquiry.c
rename to src/main/enquiry.c
diff --git a/src/errors.c b/src/main/errors.c
similarity index 100%
rename from src/errors.c
rename to src/main/errors.c
diff --git a/src/file-match.c b/src/main/file-match.c
similarity index 100%
rename from src/file-match.c
rename to src/main/file-match.c
diff --git a/src/file-match.h b/src/main/file-match.h
similarity index 100%
rename from src/file-match.h
rename to src/main/file-match.h
diff --git a/src/filters.c b/src/main/filters.c
similarity index 100%
rename from src/filters.c
rename to src/main/filters.c
diff --git a/src/filters.h b/src/main/filters.h
similarity index 100%
rename from src/filters.h
rename to src/main/filters.h
diff --git a/src/help.c b/src/main/help.c
similarity index 100%
rename from src/help.c
rename to src/main/help.c
diff --git a/src/main.c b/src/main/main.c
similarity index 100%
rename from src/main.c
rename to src/main/main.c
diff --git a/src/main.h b/src/main/main.h
similarity index 100%
rename from src/main.h
rename to src/main/main.h
diff --git a/src/packages.c b/src/main/packages.c
similarity index 100%
rename from src/packages.c
rename to src/main/packages.c
diff --git a/src/perpkgstate.c b/src/main/perpkgstate.c
similarity index 100%
rename from src/perpkgstate.c
rename to src/main/perpkgstate.c
diff --git a/src/remove.c b/src/main/remove.c
similarity index 100%
rename from src/remove.c
rename to src/main/remove.c
diff --git a/src/script.c b/src/main/script.c
similarity index 100%
rename from src/script.c
rename to src/main/script.c
diff --git a/src/select.c b/src/main/select.c
similarity index 100%
rename from src/select.c
rename to src/main/select.c
diff --git a/src/trigproc.c b/src/main/trigproc.c
similarity index 100%
rename from src/trigproc.c
rename to src/main/trigproc.c
diff --git a/src/unpack.c b/src/main/unpack.c
similarity index 100%
rename from src/unpack.c
rename to src/main/unpack.c
diff --git a/src/update.c b/src/main/update.c
similarity index 100%
rename from src/update.c
rename to src/main/update.c
diff --git a/src/verify.c b/src/main/verify.c
similarity index 100%
rename from src/verify.c
rename to src/main/verify.c
diff --git a/src/querycmd.c b/src/query/main.c
similarity index 100%
rename from src/querycmd.c
rename to src/query/main.c
diff --git a/dpkg-split/dpkg-split.h b/src/split/dpkg-split.h
similarity index 100%
rename from dpkg-split/dpkg-split.h
rename to src/split/dpkg-split.h
diff --git a/dpkg-split/info.c b/src/split/info.c
similarity index 100%
rename from dpkg-split/info.c
rename to src/split/info.c
diff --git a/dpkg-split/join.c b/src/split/join.c
similarity index 100%
rename from dpkg-split/join.c
rename to src/split/join.c
diff --git a/dpkg-split/main.c b/src/split/main.c
similarity index 100%
rename from dpkg-split/main.c
rename to src/split/main.c
diff --git a/dpkg-split/queue.c b/src/split/queue.c
similarity index 100%
rename from dpkg-split/queue.c
rename to src/split/queue.c
diff --git a/dpkg-split/split.c b/src/split/split.c
similarity index 100%
rename from dpkg-split/split.c
rename to src/split/split.c
diff --git a/src/statcmd.c b/src/statoverride/main.c
similarity index 100%
rename from src/statcmd.c
rename to src/statoverride/main.c
diff --git a/src/trigcmd.c b/src/trigger/main.c
similarity index 100%
rename from src/trigcmd.c
rename to src/trigger/main.c
diff --git a/t-func/atlocal.in b/t-func/atlocal.in
index b4cbfbf0b..013aaac9c 100644
--- a/t-func/atlocal.in
+++ b/t-func/atlocal.in
@@ -1,6 +1,6 @@
 # Global shell definitions for the autotest test suite
 
-PATH="@abs_top_builddir@/dpkg-deb:@abs_top_builddir@/dpkg-split:@abs_top_builddir@/src:@abs_top_builddir@/utils:$PATH"
+PATH="@abs_top_builddir@/src:@abs_top_builddir@/utils:$PATH"
 export PATH
 
 TESTDATA="@abs_top_srcdir@/t-func"
diff --git a/t/cppcheck/cppcheck.supp b/t/cppcheck/cppcheck.supp
index 16c88d90d..4d2741fc2 100644
--- a/t/cppcheck/cppcheck.supp
+++ b/t/cppcheck/cppcheck.supp
@@ -45,15 +45,15 @@ identicalInnerCondition:lib/dpkg/fsys-hash.c:96
 unusedStructMember:lib/dpkg/triglib.c:378
 
 // BUG: False positive, does not understand non-returning functors.
-negativeIndex:dpkg-deb/build.c
+negativeIndex:src/deb/build.c
 nullPointerArithmeticRedundantCheck:lib/dpkg/db-fsys-files.c
 nullPointerArithmeticRedundantCheck:lib/dpkg/db-fsys-override.c
-nullPointerRedundantCheck:dpkg-deb/build.c
+nullPointerRedundantCheck:src/deb/build.c
 nullPointerRedundantCheck:lib/dpkg/db-fsys-override.c
 nullPointerRedundantCheck:lib/dpkg/options.c
 nullPointerRedundantCheck:lib/dpkg/ehandle.c
-nullPointerRedundantCheck:src/enquiry.c
-nullPointerRedundantCheck:src/unpack.c
+nullPointerRedundantCheck:src/main/enquiry.c
+nullPointerRedundantCheck:src/main/unpack.c
 nullPointerRedundantCheck:utils/update-alternatives.c:1193
 doubleFree:utils/update-alternatives.c:1248
 
diff --git a/tests/Test.mk b/tests/Test.mk
index 606e6f8bd..f793eee04 100644
--- a/tests/Test.mk
+++ b/tests/Test.mk
@@ -18,7 +18,7 @@ endif
 
 DPKG_PATH := 
$(PATH):/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 ifdef DPKG_BUILDTREE
-DPKG_PATH := 
$(DPKG_BUILDTREE)/dpkg-deb:$(DPKG_BUILDTREE)/dpkg-split:$(DPKG_BUILDTREE)/src:$(DPKG_BUILDTREE)/utils:$(DPKG_BUILDTREE)/scripts:$(DPKG_PATH)
+DPKG_PATH := 
$(DPKG_BUILDTREE)/src:$(DPKG_BUILDTREE)/utils:$(DPKG_BUILDTREE)/scripts:$(DPKG_PATH)
 endif
 
 DPKG_ENV = \

-- 
Dpkg.Org's dpkg

Reply via email to