<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Robert,<div><br></div><div>Thanks for the script, really appreciated. Already implemented in my Spacewalk and for the moment, working like a charm.</div><div>In fact it even solved an issue I had with the "<a href="http://netplan.io">netplan.io</a>" package always flagged as upgradable (I guess because of a missing header).</div><div><br></div><div>Regarding the fake-upgradable Debian packages appearing on Spacewalk, I have 12 of them for the moment :<br><br></div><div><span style="white-space:pre-wrap">       </span>gcc-8-base-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">       </span>gcc-8-base-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap">      </span></div><div><span style="white-space:pre-wrap"> </span>lib32gcc1-8-20180414-1ubuntu2:1.amd64-deb <span style="white-space:pre-wrap">      </span>lib32gcc1-8.2.0-1ubuntu2~18.04:1.amd64-deb <span style="white-space:pre-wrap">     </span></div><div><span style="white-space:pre-wrap"> </span>libatomic1-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">       </span>libatomic1-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap">      </span></div><div><span style="white-space:pre-wrap"> </span>libcc1-0-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">         </span>libcc1-0-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap"> </span>libgcc1-8-20180414-1ubuntu2:1.amd64-deb <span style="white-space:pre-wrap">        </span>libgcc1-8.2.0-1ubuntu2~18.04:1.amd64-deb <span style="white-space:pre-wrap">       </span></div><div><span style="white-space:pre-wrap"> </span>libgomp1-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">         </span>libgomp1-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap"> </span>libitm1-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">          </span>libitm1-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>liblsan0-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">         </span>liblsan0-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap"> </span>libmpx2-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">          </span>libmpx2-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>libquadmath0-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">     </span>libquadmath0-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap">    </span></div><div><span style="white-space:pre-wrap"> </span>libstdc++6-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">       </span>libstdc++6-8.2.0-1ubuntu2~18.04.amd64-deb <span style="white-space:pre-wrap">      </span></div><div><span style="white-space:pre-wrap"> </span>libtsan0-8-20180414-1ubuntu2.amd64-deb <span style="white-space:pre-wrap">         </span>libtsan0-8.2.0-1ubuntu2~18.04.amd64-deb </div><div><br></div><div>Will try to dig, but indeed if the versioning motor is managed by Java and not Python, will be hard to debug ...</div><div><br></div><div>Regards,</div><div>Philippe.</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 5 Dec 2018 at 22:08, Robert Paschedag <<a href="mailto:robert.paschedag@web.de" target="_blank">robert.paschedag@web.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12.0px"><div>
<div>Hi Philippe,</div>

<div> </div>

<div>Well....until now, I only have very few packages that are shown as upgradable for "Debian" systems. I only found some version comparision problem while testing Uyuni (and testing to get Debian system registered as Salt client). I think this could be further tuned to use the python-apt or python-dpkg package...but I did not have time to dig into that.</div>

<div> </div>

<div>Within spacewalk, I currently do not know, where the comparision takes place (within java or within python).</div>

<div> </div>

<div>The "modified" script is a "new" one. It does not depend on the - from myself - modified sync script. What it needs is the original Packages.gz file for the channel you sync.</div>

<div> </div>

<div>Just throwing this here so you can test yourself. Basically, it should add all "missing" headers for every package.</div>

<div> </div>

<div>
<div>import sys<br>
import os<br>
from debian.deb822 import *</div>

<div>if len(sys.argv) < 3:<br>
    print "Usage: %s <path_to_unzipped_Packages_from_Spacewalk_Uyuni> <path_to_original_Debian_repo>" % sys.argv[0]<br>
    sys.exit(1)</div>

<div>spacewalk_file = sys.argv[1]<br>
original_file = sys.argv[2]</div>

<div>if not os.path.isfile(spacewalk_file):<br>
    print "Error: Inputfile '%s' not available." % spacewalk_file<br>
    sys.exit(1)<br>
if not os.path.isfile(original_file):<br>
    print "Error: Inputfile '%s' not available." % original_file<br>
    sys.exit(1)</div>

<div>spacewalk_packages = {}<br>
original_packages = {}</div>

<div>with open(spacewalk_file, 'r') as pkgs:<br>
    for pkg in Packages.iter_paragraphs(pkgs):<br>
        spacewalk_packages[pkg['Package'] + pkg['Version'] + pkg['Architecture']] = pkg</div>

<div>with open(original_file, 'r') as orig_file:<br>
    for pkg in Packages.iter_paragraphs(orig_file):<br>
        p = pkg['Package']<br>
        v = pkg['Version']<br>
        a = pkg['Architecture']<br>
        if spacewalk_packages.has_key(p + v + a):<br>
            # found package. Check for missing headers<br>
            for header in pkg.keys():<br>
                if not header in spacewalk_packages[p + v + a].keys():<br>
                    spacewalk_packages[p + v + a][header] = pkg[header]</div>

<div># open new file<br>
new_package = open(spacewalk_file + '.new', 'w')<br>
for pkg in spacewalk_packages.values():<br>
    pkg.dump(new_package)<br>
    new_package.write("\n")<br>
new_package.close()<br>
sys.exit(0)</div>

<div> </div>

<div>Cheers,</div>

<div>Robert</div>
</div>

<div> 
<div style="margin:10.0px 5.0px 5.0px 10.0px;padding:10.0px 0 10.0px 10.0px;border-left:2.0px solid rgb(195,217,229)">
<div style="margin:0 0 10.0px 0"><b>Gesendet:</b> Mittwoch, 05. Dezember 2018 um 21:10 Uhr<br>
<b>Von:</b> "philippe bidault" <<a href="mailto:philippe.bidault@gmail.com" target="_blank">philippe.bidault@gmail.com</a>><br>
<b>An:</b> <a href="mailto:robert.paschedag@web.de" target="_blank">robert.paschedag@web.de</a><br>
<b>Cc:</b> <a href="mailto:spacewalk-list@redhat.com" target="_blank">spacewalk-list@redhat.com</a><br>
<b>Betreff:</b> Re: [Spacewalk-list] Ubuntu 18.04 package management in Spacewalk 2.8</div>

<div>
<div>
<div>Hi Robert,
<div> </div>

<div>Good to know, thanks !!</div>

<div> </div>

<div>Regarding the version comparison logic issue for .deb packages, is there a solution that could be implemented ?</div>

<div> </div>

<div>Regards,</div>

<div>Philippe.</div>
</div>
</div>
 

<div class="gmail_quote">
<div>On Wed, 5 Dec 2018 at 20:18, Robert Paschedag <<a href="mailto:robert.paschedag@web.de" target="_blank">robert.paschedag@web.de</a>> wrote:</div>

<blockquote class="gmail_quote" style="margin:0 0 0 0.8ex;border-left:1.0px rgb(204,204,204) solid;padding-left:1.0ex">Am 5. Dezember 2018 00:44:25 MEZ schrieb philippe bidault <<a href="mailto:philippe.bidault@gmail.com" target="_blank">philippe.bidault@gmail.com</a>>:<br>
>Hi all,<br>
><br>
>I am trying to make our Spacewalk 2.8 working with Ubuntu 18.04, but as<br>
>well described here :<br>
><a href="https://github.com/spacewalkproject/spacewalk/wiki/DebianUbuntuSupportIn27" target="_blank">https://github.com/spacewalkproject/spacewalk/wiki/DebianUbuntuSupportIn27</a><br>
><br>
>... there are 3 main issues :<br>
><br>
>"1- The current version comparison logic does not distinct a dot from<br>
>an<br>
>hyphen, a tilde or a plus character. This leads to some packages<br>
>wrongly<br>
>shown as an update for a client in spacewalk when the package is<br>
>actually a<br>
>downgrade. The client however uses a correct comparison and handles the<br>
>package upgrade correctly<br>
><br>
>2- The deb importer does not import all the package header information<br>
>into<br>
>the database and the repository-writer will not write the missing<br>
>information to the repository metadata served by spacewalk. This will<br>
>lead<br>
>to problems on the client in case of the missing Multi-Arch header:<br>
>Clients<br>
>will try to reinstall the same package over and over again when this<br>
>header<br>
>is missing.<br>
><br>
>3- A deb repository provided by spacewalk is not GPG signed and thus<br>
>will<br>
>not work without disabling secure-apt. Spacewalk imports and recreates<br>
>the<br>
>repository based on the imported package catalogue, this will destroy<br>
>the<br>
>GPG signing of the repository vendor."<br>
><br>
>I did manage to solve the point 2 and 3. The point 3 thanks to this<br>
>method<br>
>:<br>
><a href="http://www.devops-blog.net/spacewalk/gpg-signing-apt-repository-in-spacewalk" target="_blank">http://www.devops-blog.net/spacewalk/gpg-signing-apt-repository-in-spacewalk</a><br>
><br>
>Regarding the point 2, I did have to customize the script<br>
><a href="https://github.com/rpasche/spacewalk-debian-sync/tree/add-multiarch-header" target="_blank">https://github.com/rpasche/spacewalk-debian-sync/tree/add-multiarch-header</a><br>
>,<br>
>as it seems that in any case the add of the Multi-Arch header in<br>
>Packages.gz is not enough for Ubuntu 18.04. I did only succeed in not<br>
>ending in an infinite loop of packages flagged to be upgraded as the<br>
>result<br>
>of "apt upgrade" by adding more headers in Packages.gz :<br>
><br>
>        p, v, a, multi, breaks, predeps = line.rstrip().split("||")<br>
>       if (packages.has_key(p + v + a) and (multi is not "#")) :<br>
>           packages[p + v + a]['Multi-Arch'] = multi<br>
>       if (packages.has_key(p + v + a) and (breaks is not "#")) :<br>
>           packages[p + v + a]['Breaks'] = breaks<br>
>       if (packages.has_key(p + v + a) and (predeps is not "#")) :<br>
>           packages[p + v + a]['Pre-Depends'] = predeps<br>
<br>
I did improve the script (still testing). Basically it just adds all missing headers from the original file to that generated by spacewalk. The repo is not yet updated.<br>
<br>
Robert<br>
><br>
>Right now, what is really causing me much more trouble, is the point 1,<br>
>which is making Spacewalk not really reliable for deb package<br>
>management ,<br>
>as I have a permanent list of upgradable packages in the Spacewalk<br>
>console,<br>
>whereas the installed versions are already the latest.<br>
><br>
>Example :<br>
><br>
><br>
>Latest Package<br>
>Installed Package<br>
>gcc-8-base-8-20180414-1ubuntu2.amd64-deb<br>
><<a href="https://space01/rhn/software/packages/Details.do?sid=1000010058&id_combo=21120%7C7544%7C145" target="_blank">https://space01/rhn/software/packages/Details.do?sid=1000010058&id_combo=21120|7544|145</a>><br>
>gcc-8-base-8.2.0-1ubuntu2~18.04.amd64-deb<br>
>lib32gcc1-8-20180414-1ubuntu2:1.amd64-deb<br>
><<a href="https://space01/rhn/software/packages/Details.do?sid=1000010058&id_combo=21933%7C7796%7C145" target="_blank">https://space01/rhn/software/packages/Details.do?sid=1000010058&id_combo=21933|7796|145</a>><br>
>lib32gcc1-8.2.0-1ubuntu2~18.04:1.amd64-deb<br>
><br>
><br>
>So in resume, I have 2 questions :<br>
><br>
>- Regarding the point 1, is there already an existing solution I could<br>
>use,<br>
>or at least some clues ?<br>
>- Regarding the point 2 : Did I miss something, or do we really need to<br>
>add<br>
>some extra headers (Breaks and Pre-depends) to have the Ubuntu 18.04<br>
>client<br>
>servers correctly listing packages to be upgraded ?<br>
><br>
>Regards,<br>
>Philippe.<br>
<br>
<br>
--<br>
sent from my mobile device</blockquote>
</div>
</div>
</div>
</div>
</div></div></div>
</blockquote></div>