[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#222668: [ABI change] apt-shell from apt-rpm ported



On Mon, May 24, 2004 at 02:46:22PM -0700, Matt Zimmerman wrote:
> Questions about the -common patch:
> 
> - The #ifdef SWIG bit can be removed, right?  I assume that apt-shell does not rely on swig.

Yes, sorry for not removing it in the first place. SWIG support will
probably go away in apt-rpm as well as SWIG does not support C++ very
well and Gustavo had to patch upstream SWIG IIRC to deal with apt.
 
> - Why is the PushError/PopError stuff necessary?

I can't say for sure. It's a upstream change from Gustavo. He told me
that it was a needed change. The changelog says:

 - Introduced error stacking. This allows one to
   delay error handling until a later time.

> - What is pkgRecords::HasFile for?  I don't quite follow

This is a apt-rpm feature. It's save to remove it I guess. apt-rpm
understands commands like this:
$ apt-get install /usr/bin/db2html
 
> - There seem to be some spurious reindentations, at least in sourcelist.cc

Probably my fault while doing the patch.

> - I don't think that the GetReleases method is appropriate; it is likely
>   superseded by the Release handling in apt 0.6

This is very likley. I haven't yet looked how apt 0.6 does it. 

thanks for having a look at the patch!
 Michael

P.S. What in particular do you dislike about the lua support in
apt-rpm? Would you accept a patch for it? I ask because it's possible
to do nice things with it :) #134694 for example can be solved with
the attached lua script. 
-- 
Linux is not The Answer. Yes is the answer. Linux is The Question. - Neo
-- This script will log the changes being introduced by
-- the transaction which is going to be run, and is based
-- on an idea of Panu Matilainen. It must be plugged
-- in the slots Scripts::PM::Pre/Post.
--
-- Author: Gustavo Niemeyer <niemeyer@conectiva.com>

if confget("APT::Log::Enable/b", "false") == "false" then
    return
end

confset("Dir::Log", "/var/log", true)
confset("Dir::Log::transaction", "apt.log", true)
filename = confget("Dir::Log::transaction/f", "/var/log/apt.log")

if script_slot == "Scripts::PM::Pre" then
    file = io.open(filename, "a+")
    if not file then
        print("error: can't open log file at "..filename)
        return
    end
    local removing = {}
    local installing = {}
    local reinstalling = {}
    local downgrading = {}
    local upgrading = {}
    for i, pkg in ipairs(pkglist()) do
        if statkeep(pkg) then
            -- Do nothing
        elseif statreinstall(pkg) then
            table.insert(reinstalling,
                         string.format("ReInstalling %s %s\n",
                                       pkgname(pkg),
                                       verstr(pkgvercur(pkg))))
        elseif statremove(pkg) then
            table.insert(removing,
                         string.format("Removing %s %s\n",
                                       pkgname(pkg),
                                       verstr(pkgvercur(pkg))))
        elseif statnewinstall(pkg) then
            table.insert(installing,
                         string.format("Installing %s %s\n",
                                       pkgname(pkg),
                                       verstr(pkgverinst(pkg))))
        elseif statdowngrade(pkg) then
            table.insert(downgrading,
                         string.format("Downgrading %s %s to %s\n",
                                       pkgname(pkg),
                                       verstr(pkgvercur(pkg)),
                                       verstr(pkgverinst(pkg))))
        elseif statupgrade(pkg) then
            table.insert(upgrading,
                         string.format("Upgrading %s %s to %s\n",
                                       pkgname(pkg),
                                       verstr(pkgvercur(pkg)),
                                       verstr(pkgverinst(pkg))))
        end
    end
    file:write("Transaction starting at ", os.date(), "\n")
    local function write(index, str)
        file:write(str)
    end
    table.foreach(removing, write)
    table.foreach(installing, write)
    table.foreach(reinstalling, write)
    table.foreach(downgrading, write)
    table.foreach(upgrading, write)
    file:close()
elseif script_slot == "Scripts::PM::Post" then
    if transaction_success then
        word = "succeeded"
    else
        word = "failed"
    end
    file = io.open(filename, "a+")
    file:write("Transaction ", word, " at ", os.date(), "\n")
    file:close()
end

-- vim:ts=4:sw=4:et

Reply to: