-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Does not work if /etc/apt/sources.list is a link.
It copies the link into the tar file, bot not the file, where the link points to.
This is mainly an issue if you change sources.list via a config package (built with the help of dh_configpackage).
While running the "clone" it prints this:
# apt-clone clone test
not installable:
version mismatch:
Note that you can use --with-dpkg-repack to include those packges in the clone file.
The info command on the generated tar file:
# apt-clone info test.apt-clone.tar.gz
Traceback (most recent call last):
File "/usr/local/bin/apt-clone", line 104, in <module>
info = clone.info(args.source)
File "/usr/local/lib/python2.7/dist-packages/apt_clone.py", line 375, in info
"Date: %(date)s\n" % self._get_clone_info_dict(statefile)
File "/usr/local/lib/python2.7/dist-packages/apt_clone.py", line 330, in _get_clone_info_dict
distro = self._get_info_distro(statefile) or "unknown"
File "/usr/local/lib/python2.7/dist-packages/apt_clone.py", line 319, in _get_info_distro
f = tar.extractfile(self.TARPREFIX+"etc/apt/sources.list")
File "/usr/lib/python2.7/tarfile.py", line 2154, in extractfile
return self.extractfile(self._find_link_target(tarinfo))
File "/usr/lib/python2.7/tarfile.py", line 2433, in _find_link_target
raise KeyError("linkname %r not found" % linkname)
KeyError: "linkname './etc/apt/sources.list.test not found"
There are several solutions for this.
-
add the link and the file the link points to.
This could break the config package, which is installed by apt-clone on the new host. -
don't add the link at all
The file would be handled by the config package which is installed on the new host by apt-clone, but requires that the config package is available without the sources.list from the clone host. -
add the linked file instead of the link
The file will be overwritten by the config package on the new host, but it would break the purge of the config package, because config packages save the original file and restore it on purge. -
Handle the file according to the rules of "dh_configpackage"
Usedpkg-divert --list /etc/apt/sources.listto check if the file is handled as diversion.
Download the package and add it to the clone-tar-file and ignore/etc/apt/sources.list.
On restore install the config package from the clone-tar first.
Example for diversion:
# dpkg-divert --list /etc/apt/sources.list
diversion of /etc/apt/sources.list to /etc/apt/sources.list.test-orig by test-repo
# dpkg-divert --listpackage /etc/apt/sources.list
test-repo