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=abd3a064ef8a9004e7ff2c9e5841e507487130ac

commit abd3a064ef8a9004e7ff2c9e5841e507487130ac
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Wed Aug 18 06:28:47 2021 +0200

    dpkg-fsys-usrunmess: Generate a regression prevention package
    
    Generate a package that Conflicts/Provides/Replaces the package
    currently known to mess the filesystem into an unsupported state.
---
 man/dpkg-fsys-usrunmess.pod    |  4 ++++
 scripts/dpkg-fsys-usrunmess.pl | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/man/dpkg-fsys-usrunmess.pod b/man/dpkg-fsys-usrunmess.pod
index 818eec3af..d4857ba83 100644
--- a/man/dpkg-fsys-usrunmess.pod
+++ b/man/dpkg-fsys-usrunmess.pod
@@ -46,6 +46,10 @@ Check for dpkg database consistency and otherwise abort.
 
 =item *
 
+Generate and install a regression prevention package.
+
+=item *
+
 Get the list of files and alternatives that need to be restored.
 
 =item *
diff --git a/scripts/dpkg-fsys-usrunmess.pl b/scripts/dpkg-fsys-usrunmess.pl
index 7a38caae0..56bc72b8b 100755
--- a/scripts/dpkg-fsys-usrunmess.pl
+++ b/scripts/dpkg-fsys-usrunmess.pl
@@ -26,6 +26,7 @@ our $PROGVERSION = '1.21.x';
 our $ADMINDIR = '/var/lib/dpkg/';
 
 use POSIX;
+use File::Temp qw(tempdir);
 use Getopt::Long qw(:config posix_default bundling_values no_ignorecase);
 
 eval q{
@@ -85,6 +86,46 @@ if (glob "$ADMINDIR/updates/*") {
     fatal('dpkg is in an inconsistent state, please fix that');
 }
 
+debug('building regression prevention measures');
+my $tmpdir = tempdir(CLEANUP => 1, TMPDIR => 1);
+my $pkgdir = "$tmpdir/pkg";
+my $pkgfile = "$tmpdir/dpkg-fsys-usrunmess.deb";
+
+mkdir "$pkgdir" or fatal('cannot create temporary package directory');
+mkdir "$pkgdir/DEBIAN" or fatal('cannot create temporary directory');
+open my $ctrl_fh, '>', "$pkgdir/DEBIAN/control"
+    or fatal('cannot create temporary control file');
+print { $ctrl_fh } <<"CTRL";
+Package: dpkg-fsys-usrunmess
+Version: $PROGVERSION
+Architecture: all
+Protected: yes
+Multi-Arch: foreign
+Section: admin
+Priority: optional
+Maintainer: Dpkg Developers <debian-dpkg\@lists.debian.org>
+Installed-Size: 5
+Conflicts: usrmerge
+Provides: usrmerge (= 25)
+Replaces: usrmerge
+Description: prevention measure to avoid unsuspected filesystem breakage
+ This package will prevent automatic migration of the filesystem to the
+ broken merge-/usr-via-aliased-dirs via the usrmerge package.
+ .
+ This package was generated and installed by the dpkg-fsys-usrunmess(8)
+ program.
+
+CTRL
+close $ctrl_fh or fatal('cannot write temporary control file');
+
+system(('dpkg-deb', '-b', $pkgdir, $pkgfile)) == 0
+    or fatal('cannot create prevention package');
+
+if (not $opt_noact) {
+    system(('dpkg', '-GBi', $pkgfile)) == 0
+        or fatal('cannot install prevention package');
+}
+
 my $aliased_regex = '^(' . join('|', @aliased_dirs) . ')/';
 
 #

-- 
Dpkg.Org's dpkg

Reply via email to