I found that add-apt-repository calls

 SoftwareProperties().add_source_from_line(line)

In /usr/share/pyshared/softwareproperties/SoftwareProperties.py I found

 self.sourceslist.list.append(new_deb_entry)
 self.sourceslist.list.append(new_debsrc_entry)

I think it would be better to call self.sourceslist.add(), since it avoids
duplicates. The add() function requires more arguments, but the only ones
I had to hard-code were elsewhere in SoftwareProperties.py anyway.

I've included a patch (against 0.80.9 through 0.82) which seems to make thing
work nicely. I hard-coded deb, deb-src, and main.

** Patch added: "patch to SoftwareProperties.py to make add_source_from_line 
idempotent"
   
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/854841/+attachment/2611651/+files/SoftwareProperties.py.diff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/854841

Title:
  add-apt-repository will write duplicate entries to
  /etc/apt/sources.list

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/854841/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to