[apt] kick apt in the butt
Tom Callaway
spot at fedoraproject.org
Wed Dec 10 21:49:15 UTC 2014
commit 7f1e60d8ef5e4e783eb4cfbf6380df5ad6758b66
Author: Tom Callaway <spot at fedoraproject.org>
Date: Wed Dec 10 16:49:23 2014 -0500
kick apt in the butt
apt-0.5.15lorg3.95-lua-5.2d.patch | 379 ++++++++++++++++++++++++++++++
apt-0.5.15lorg3.95-rpm-suggest-fix.patch | 12 +
apt.spec | 23 ++-
3 files changed, 412 insertions(+), 2 deletions(-)
---
diff --git a/apt-0.5.15lorg3.95-lua-5.2d.patch b/apt-0.5.15lorg3.95-lua-5.2d.patch
new file mode 100644
index 0000000..da34155
--- /dev/null
+++ b/apt-0.5.15lorg3.95-lua-5.2d.patch
@@ -0,0 +1,379 @@
+--- apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc.lua-52 2011-04-07 22:18:59.000000000 +0900
++++ apt-0.5.15lorg3.95.git522/apt-pkg/luaiface.cc 2014-05-19 14:21:01.000000000 +0900
+@@ -41,6 +41,18 @@
+
+ using namespace std;
+
++#ifndef lua_pushglobaltable
++#define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
++#endif
++
++#ifndef lua_open
++#define lua_open() luaL_newstate()
++#endif
++
++#ifndef lua_strlen
++#define lua_strlen(L,i) lua_rawlen(L, (i))
++#endif
++
+ #define pushudata(ctype, value) \
+ do { \
+ ctype *_tmp = (ctype *) lua_newuserdata(L, sizeof(ctype)); \
+@@ -107,14 +119,14 @@
+ lua_settop(L, 0); /* discard any results */
+ }
+ #else
+- const luaL_reg lualibs[] = {
++ const luaL_Reg lualibs[] = {
+ {"posix", luaopen_posix},
+ {"rex", luaopen_rex},
+ {"apt", luaopen_apt},
+ {NULL, NULL}
+ };
+ luaL_openlibs(L);
+- const luaL_reg *lib = lualibs;
++ const luaL_Reg *lib = lualibs;
+ for (; lib->name; lib++) {
+ lua_pushcfunction(L, lib->func);
+ lua_pushstring(L, lib->name);
+@@ -174,14 +186,14 @@
+ continue;
+ if (Value == "interactive") {
+ lua_pushstring(L, "script_slot");
+- lua_pushstring(L, ConfListKey);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, ConfListKey);
+
+ RunInteractive(ConfListKey);
+
+ lua_pushstring(L, "script_slot");
+ lua_pushnil(L);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "script_slot");
++
+ continue;
+ }
+ if (Value[0] == '.' || Value[0] == '/') {
+@@ -213,15 +225,13 @@
+ }
+
+ lua_pushstring(L, "script_slot");
+- lua_pushstring(L, ConfListKey);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, ConfListKey);
+
+ InternalRunScript();
+
+ lua_pushstring(L, "script_slot");
+ lua_pushnil(L);
+- lua_rawset(L, LUA_GLOBALSINDEX);
+-
++ lua_setglobal(L, "script_slot");
+ lua_pop(L, 1);
+
+ return true;
+@@ -359,7 +369,7 @@
+ {
+ lua_pushstring(L, Name);
+ lua_pushnil(L);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -368,7 +378,7 @@
+ if (Value != NULL) {
+ lua_pushstring(L, Name);
+ lua_pushstring(L, Value);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ }
+ Globals.push_back(Name);
+ }
+@@ -378,7 +388,7 @@
+ if (Value != NULL) {
+ lua_pushstring(L, Name);
+ pushudata(pkgCache::Package*, Value);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ }
+ Globals.push_back(Name);
+ }
+@@ -393,7 +403,7 @@
+ lua_pushstring(L, Value[i]);
+ lua_rawseti(L, -2, i+1);
+ }
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -408,7 +418,7 @@
+ lua_pushstring(L, Value[i]);
+ lua_rawseti(L, -2, i+1);
+ }
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -423,7 +433,7 @@
+ lua_pushstring(L, Value[i].c_str());
+ lua_rawseti(L, -2, i+1);
+ }
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -438,7 +448,7 @@
+ pushudata(pkgCache::Package*, Value[i]);
+ lua_rawseti(L, -2, i+1);
+ }
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -446,7 +456,7 @@
+ {
+ lua_pushstring(L, Name);
+ lua_pushboolean(L, Value);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -454,7 +464,7 @@
+ {
+ lua_pushstring(L, Name);
+ lua_pushnumber(L, Value);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -463,7 +473,7 @@
+ if (Value != NULL) {
+ lua_pushstring(L, Name);
+ lua_pushlightuserdata(L, Value);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ }
+ Globals.push_back(Name);
+ }
+@@ -472,7 +482,7 @@
+ {
+ lua_pushstring(L, Name);
+ lua_pushcfunction(L, Value);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, Name);
+ Globals.push_back(Name);
+ }
+
+@@ -483,7 +493,7 @@
+ I != Globals.end(); I++) {
+ lua_pushstring(L, I->c_str());
+ lua_pushnil(L);
+- lua_rawset(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, I->c_str());
+ }
+ Globals.clear();
+ }
+@@ -492,7 +502,7 @@
+ const char *Lua::GetGlobalStr(const char *Name)
+ {
+ lua_pushstring(L, Name);
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, Name);
+ const char *Ret = NULL;
+ if (lua_isstring(L, -1))
+ Ret = lua_tostring(L, -1);
+@@ -504,7 +514,7 @@
+ {
+ vector<string> Ret;
+ lua_pushstring(L, Name);
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, Name);
+ int t = lua_gettop(L);
+ if (lua_istable(L, t)) {
+ lua_pushnil(L);
+@@ -520,8 +530,9 @@
+
+ double Lua::GetGlobalNum(const char *Name)
+ {
++
+ lua_pushstring(L, Name);
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, Name);
+ double Ret = 0;
+ if (lua_isnumber(L, -1))
+ Ret = lua_tonumber(L, -1);
+@@ -532,7 +543,7 @@
+ bool Lua::GetGlobalBool(const char *Name)
+ {
+ lua_pushstring(L, Name);
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, Name);
+ bool Ret = lua_toboolean(L, -1);
+ lua_remove(L, -1);
+ return Ret;
+@@ -541,7 +552,7 @@
+ void *Lua::GetGlobalPtr(const char *Name)
+ {
+ lua_pushstring(L, Name);
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, Name);
+ void *Ret = NULL;
+ if (lua_isuserdata(L, -1))
+ Ret = lua_touserdata(L, -1);
+@@ -552,7 +563,7 @@
+ pkgCache::Package *Lua::GetGlobalPkg(const char *Name)
+ {
+ lua_pushstring(L, Name);
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, Name);
+ pkgCache::Package *Ret;
+ checkudata(pkgCache::Package*, Ret, -1);
+ lua_remove(L, -1);
+@@ -563,7 +574,7 @@
+ {
+ vector<pkgCache::Package*> Ret;
+ lua_pushstring(L, Name);
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, Name);
+ int t = lua_gettop(L);
+ if (lua_istable(L, t)) {
+ lua_pushnil(L);
+@@ -1467,7 +1478,7 @@
+ const char *str = luaL_checkstring(L, 1);
+ if (str != NULL) {
+ lua_pushliteral(L, "TEXTDOMAIN");
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, "TEXTDOMAIN");
+ if (lua_isstring(L, -1))
+ lua_pushstring(L, dgettext(lua_tostring(L, -1), str));
+ else
+@@ -1478,7 +1489,7 @@
+ return 0;
+ }
+
+-static const luaL_reg aptlib[] = {
++static const luaL_Reg aptlib[] = {
+ {"confget", AptLua_confget},
+ {"confgetlist", AptLua_confgetlist},
+ {"confset", AptLua_confset},
+@@ -1552,7 +1563,7 @@
+
+ static int luaopen_apt(lua_State *L)
+ {
+- lua_pushvalue(L, LUA_GLOBALSINDEX);
++ lua_pushglobaltable(L);
+ luaL_openlib(L, NULL, aptlib, 0);
+ return 0;
+ }
+--- apt-0.5.15lorg3.95.git522/luaext/lposix.c.lua-52 2011-04-07 22:18:59.000000000 +0900
++++ apt-0.5.15lorg3.95.git522/luaext/lposix.c 2014-05-16 15:53:51.000000000 +0900
+@@ -49,6 +49,15 @@
+
+ typedef int (*Selector)(lua_State *L, int i, const void *data);
+
++/* implemented as luaL_typerror until lua 5.1, dropped in 5.2
++ * (C) 1994-2012 Lua.org, PUC-Rio. MIT license
++ */
++static int typerror (lua_State *L, int narg, const char *tname) {
++ const char *msg = lua_pushfstring(L, "%s expected, got %s",
++ tname, luaL_typename(L, narg));
++ return luaL_argerror(L, narg, msg);
++}
++
+ static int doselection(lua_State *L, int i, const char *const S[], Selector F, const void *data)
+ {
+ if (lua_isnone(L, i))
+@@ -135,7 +144,7 @@
+ return (p==NULL) ? -1 : p->pw_uid;
+ }
+ else
+- return luaL_typerror(L, i, "string or number");
++ return typerror(L, i, "string or number");
+ }
+
+ static gid_t mygetgid(lua_State *L, int i)
+@@ -150,7 +159,7 @@
+ return (g==NULL) ? -1 : g->gr_gid;
+ }
+ else
+- return luaL_typerror(L, i, "string or number");
++ return typerror(L, i, "string or number");
+ }
+
+
+@@ -554,7 +563,7 @@
+ else if (lua_isstring(L, 1))
+ p = getpwnam(lua_tostring(L, 1));
+ else
+- luaL_typerror(L, 1, "string or number");
++ typerror(L, 1, "string or number");
+ if (p==NULL)
+ lua_pushnil(L);
+ else
+@@ -571,7 +580,7 @@
+ else if (lua_isstring(L, 1))
+ g = getgrnam(lua_tostring(L, 1));
+ else
+- luaL_typerror(L, 1, "string or number");
++ typerror(L, 1, "string or number");
+ if (g==NULL)
+ lua_pushnil(L);
+ else
+@@ -690,10 +699,10 @@
+ luaL_buffinit(L, &b);
+ for (s=luaL_optstring(L, 1, "%s %n %r %v %m"); *s; s++)
+ if (*s!='%')
+- luaL_putchar(&b, *s);
++ luaL_addchar(&b, *s);
+ else switch (*++s)
+ {
+- case '%': luaL_putchar(&b, *s); break;
++ case '%': luaL_addchar(&b, *s); break;
+ case 'm': luaL_addstring(&b,u.machine); break;
+ case 'n': luaL_addstring(&b,u.nodename); break;
+ case 'r': luaL_addstring(&b,u.release); break;
+@@ -792,7 +801,7 @@
+ }
+
+
+-static const luaL_reg R[] =
++static const luaL_Reg R[] =
+ {
+ {"access", Paccess},
+ {"chdir", Pchdir},
+--- apt-0.5.15lorg3.95.git522/luaext/lrexlib.c.lua-52 2011-04-07 22:18:59.000000000 +0900
++++ apt-0.5.15lorg3.95.git522/luaext/lrexlib.c 2014-05-16 15:53:51.000000000 +0900
+@@ -161,7 +161,7 @@
+ return 0;
+ }
+
+-static const luaL_reg posixmeta[] = {
++static const luaL_Reg posixmeta[] = {
+ {"match", posix_match},
+ {"gmatch", posix_gmatch},
+ {"__gc", posix_gc},
+@@ -285,7 +285,7 @@
+ return 0;
+ }
+
+-static const luaL_reg pcremeta[] = {
++static const luaL_Reg pcremeta[] = {
+ {"match", pcre_match},
+ {"gmatch", pcre_gmatch},
+ {"__gc", pcre_gc},
+@@ -297,7 +297,7 @@
+
+ /* Open the library */
+
+-static const luaL_reg rexlib[] = {
++static const luaL_Reg rexlib[] = {
+ #ifdef WITH_POSIX
+ {"newPOSIX", posix_comp},
+ #endif
diff --git a/apt-0.5.15lorg3.95-rpm-suggest-fix.patch b/apt-0.5.15lorg3.95-rpm-suggest-fix.patch
new file mode 100644
index 0000000..ef6cbaa
--- /dev/null
+++ b/apt-0.5.15lorg3.95-rpm-suggest-fix.patch
@@ -0,0 +1,12 @@
+diff -up apt-0.5.15lorg3.95.git522/apt-pkg/rpm/rpmhandler.cc.rpm-suggest-fix apt-0.5.15lorg3.95.git522/apt-pkg/rpm/rpmhandler.cc
+--- apt-0.5.15lorg3.95.git522/apt-pkg/rpm/rpmhandler.cc.rpm-suggest-fix 2014-12-10 16:36:41.522839504 -0500
++++ apt-0.5.15lorg3.95.git522/apt-pkg/rpm/rpmhandler.cc 2014-12-10 16:36:47.730798300 -0500
+@@ -206,7 +206,7 @@ bool RPMHdrHandler::PRCO(unsigned int Ty
+ deptype = RPMTAG_PROVIDENAME;
+ break;
+ case pkgCache::Dep::Suggests:
+- deptype = RPMTAG_SUGGESTSNAME;
++ deptype = RPMTAG_SUGGESTNAME;
+ break;
+ #if 0 // Enhances dep type is not even known to apt, sigh..
+ case pkgCache::Dep::Enhances:
diff --git a/apt.spec b/apt.spec
index fe853f2..8139b33 100644
--- a/apt.spec
+++ b/apt.spec
@@ -7,10 +7,15 @@
%define snapver git522
%define srcver %{aptver}.%{snapver}
+# This is disabled because
+# A) it is broken and bitrotten
+# B) fixing it involves swig and ain't no one got time for that
+%global with_python 0
+
Summary: Debian's Advanced Packaging Tool with RPM support
Name: apt
Version: %{aptver}
-Release: 13.%{snapver}%{?dist}
+Release: 14.%{snapver}%{?dist}
Group: System Environment/Base
URL: http://apt-rpm.org/
# SourceLicense: GPLv2+ except lua/ which is MIT
@@ -46,9 +51,11 @@ Patch1: apt-0.5.15lorg3.x-cache-corruption.patch
# fix build with gcc 4.7
Patch2: apt-0.5.15lorg3.95-gcc47.patch
# fix build with lua 5.2
-Patch3: apt-0.5.15lorg3.95-lua-5.2.patch
+Patch3: apt-0.5.15lorg3.95-lua-5.2d.patch
# fix format-security issue
Patch4: apt-0.5.15lorg3.95-format-security.patch
+# Fix to build against modern rpm
+Patch5: apt-0.5.15lorg3.95-rpm-suggest-fix.patch
# TODO: verify the required minimum Python version
BuildRequires: python-devel >= 2.2
@@ -169,6 +176,7 @@ about it in /var/log/apt.log, or in the configured file.
%patch2 -p1 -b .gcc47
%patch3 -p1 -b .lua-52
%patch4 -p1 -b .format-security
+%patch5 -p1 -b .rpm-suggest-fix
install -pm 644 %{SOURCE19} comps2prio.xsl
@@ -180,8 +188,10 @@ find contrib/ -type f | xargs chmod 0644
make %{?_smp_mflags}
+%if 0%{?with_python}
make -C python %{?_smp_mflags} PYTHON="%{__python}"
python -O -c "import py_compile; py_compile.compile('python/apt.py')"
+%endif
cp -p %{SOURCE5} rpmpriorities
%if %{generate_rpmpriorities}
@@ -219,11 +229,13 @@ for script in %{SOURCE51} %{SOURCE52} ; do
install -pm 755 $script %{buildroot}%{_datadir}/apt/scripts
done
+%if 0%{?with_python}
# The python bindings
mkdir -p %{buildroot}%{python_sitearch}/
install -pm 755 python/_apt.so %{buildroot}%{python_sitearch}/
install -pm 644 python/apt.py* %{buildroot}%{python_sitearch}/
touch %{buildroot}%{python_sitearch}/apt.pyo
+%endif
# Nightly updater scripts & default config
mkdir -p %{buildroot}%{_unitdir}
@@ -335,9 +347,11 @@ fi
%{_libdir}/libapt-pkg*.so
%{_libdir}/pkgconfig/libapt-pkg.pc
+%if 0%{?with_python}
%files python
%{python_sitearch}/_apt.so
%{python_sitearch}/apt.py*
+%endif
%if 0%{?_with_groupinstall:1}
%files plugins-groupinstall
@@ -364,6 +378,11 @@ fi
%changelog
+* Wed Dec 10 2014 Tom Callaway <spot at fedoraproject.org> - 0.5.15lorg3.95-14.git522
+- fix lua patch again
+- fix build with modern RPM
+- disable python support (it is bitrotten and broken)
+
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.5.15lorg3.95-13.git522
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
More information about the scm-commits
mailing list