Skip to content

restore-new-distro seems to be broken since --exclude was added #4

@martinvonwittich

Description

@martinvonwittich

I'm trying to get restore-new-distro to work, but apt-clone wrote this into the /etc/apt/sources.list file:

deb http://ftp.de.debian.org/debian/ True main non-free contrib
deb http://ftp.de.debian.org/debian/ True-updates main non-free contrib
deb http://security.debian.org/ True main non-free contrib
deb https://update.iserv.eu/debian/ True main non-free contrib
deb https://update.iserv.eu/debian/ True main non-free
deb http://deb.avast.com/lin/repo True release

I believe that this bug was introduced by 567b2f1; the arguments of AptClone.restore_state were changed, but the elif args.command == "restore-new-distro" block wasn't updated to reflect this.

The following patch should fix it:

host ~ # diff -u =apt-clone apt-clone
--- /usr/bin/apt-clone  2015-11-13 21:11:38.000000000 +0100
+++ apt-clone   2018-04-04 15:36:45.810880259 +0200
@@ -79,6 +79,11 @@
     command.add_argument("new_distro_codename")
     command.add_argument("--destination", default="/")
     command.add_argument("--simulate", action="store_true", default=False)
+    command.add_argument(
+        "--rewrite-server",
+        help="rewrite all URIs in sources.list to the specified url")
+    command.add_argument("--exclude", nargs='*',
+                         help="exclude the listed package names from the restore")
     command.set_defaults(command="restore-new-distro")
     # show-diff
     command = subparser.add_parser(
@@ -141,8 +146,10 @@

         if args.simulate:
             miss = clone.simulate_restore_state(
-                args.source, args.new_distro_codename)
+                args.source, args.exclude, args.new_distro_codename)
             print("missing: %s" % ",".join(sorted(list(miss))))
         else:
             clone.restore_state(
-                args.source, args.destination, args.new_distro_codename, protect_installed)
+                args.source, args.destination, args.exclude,
+                args.new_distro_codename, protect_installed,
+                mirror=args.rewrite_server)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions