uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,76 @@
{lib, stdenv, fetchurl, gettext }:
stdenv.mkDerivation rec {
pname = "checkinstall";
version = "1.6.2";
src = fetchurl {
url = "https://www.asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-${version}.tar.gz";
sha256 = "1x4kslyvfd6lm6zd1ylbq2pjxrafb77ydfjaqi16sa5qywn1jqfw";
};
patches = [
# Include empty directories created by the installation script in
# generated packages. (E.g., if a `make install' does `mkdir
# /var/lib/mystuff', then /var/lib/mystuff should be included in
# the package.)
./empty-dirs.patch
# Implement the getxattr(), lgetxattr(), __open_2() and
# __open64_2() functions. Needed for doing builds on Ubuntu 8.10.
./missing-functions.patch
# Don't include directories in the Debian `conffiles' file.
./etc-dirs.patch
# Support Glibc >= 2.8.
./glibc-check.patch
# Fix a `conflicting types for 'scandir'' error on Glibc 2.11.
./scandir.patch
# Fix a `conflicting types for 'readlink'' error since Glibc 2.19
./readlink-types.patch
# Fix BuildRoot handling in RPM builds.
./set-buildroot.patch
]
++ lib.optional (stdenv.hostPlatform.system == "x86_64-linux")
# Force use of old memcpy so that installwatch works on Glibc <
# 2.14.
./use-old-memcpy.patch;
buildInputs = [gettext];
hardeningDisable = [ "fortify" ];
preBuild = ''
makeFlagsArray=(PREFIX=$out)
substituteInPlace checkinstall --replace /usr/local/lib/checkinstall $out/lib/checkinstall
substituteInPlace checkinstallrc-dist --replace /usr/local $out
substituteInPlace installwatch/create-localdecls \
--replace /usr/include/unistd.h ${stdenv.cc.libc.dev}/include/unistd.h
'';
postInstall =
# Clear the RPATH, otherwise installwatch.so won't work properly
# as an LD_PRELOADed library on applications that load against a
# different Glibc.
''
patchelf --set-rpath "" $out/lib/installwatch.so
'';
meta = {
homepage = "http://checkinstall.izto.org/";
description = "A tool for automatically generating Slackware, RPM or Debian packages when doing `make install'";
maintainers = [ lib.maintainers.eelco ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl2;
knownVulnerabilities = [
"CVE-2020-25031"
];
};
}

View file

@ -0,0 +1,49 @@
diff -rc checkinstall-orig/checkinstall checkinstall/checkinstall
*** checkinstall-orig/checkinstall 2009-03-12 13:40:24.000000000 +0100
--- checkinstall/checkinstall 2009-03-27 14:51:55.000000000 +0100
***************
*** 1635,1644 ****
# Find regular files first
[ $DEBUG -gt 0 ] && echo "debug: BASE_TMP_DIR: $BASE_TMP_DIR"
! cat /${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access)' | cut -f 3 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | sort -u > /${TMP_DIR}/newfiles
# symlinks are next
! cat /${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access)' | cut -f 4 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | grep -v "#success" | sort -u >> /${TMP_DIR}/newfiles
# Create another list of modified files that exclude all files the
# install script wanted to create but did not, e.g because they already
# existed.
--- 1635,1648 ----
# Find regular files first
[ $DEBUG -gt 0 ] && echo "debug: BASE_TMP_DIR: $BASE_TMP_DIR"
! cat /${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access|mkdir)' | cut -f 3 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | sort -u > /${TMP_DIR}/newfiles
# symlinks are next
! cat /${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access|mkdir)' | cut -f 4 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | grep -v "#success" | sort -u >> /${TMP_DIR}/newfiles
!
! # And finally newly created directories.
! cat /${TMP_DIR}/newfiles.tmp | egrep '^0[[:space:]]+mkdir[[:space:]]+' | cut -f 3 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | sort -u >> /${TMP_DIR}/newfiles
!
# Create another list of modified files that exclude all files the
# install script wanted to create but did not, e.g because they already
# existed.
***************
*** 1738,1746 ****
cd /
( cat /${TMP_DIR}/newfiles | while read i; do
! if [ ! -d "${TRANSLROOT}${i}" -o -L "${TRANSLROOT}${i}" ]; then
! echo ".${i}"
! fi
done ) > /${TMP_DIR}/newfiles-tar
# Here it gets tricky: we need to copy all new files to our build dir,
--- 1742,1748 ----
cd /
( cat /${TMP_DIR}/newfiles | while read i; do
! echo ".${i}"
done ) > /${TMP_DIR}/newfiles-tar
# Here it gets tricky: we need to copy all new files to our build dir,

View file

@ -0,0 +1,25 @@
diff -rc checkinstall-orig/checkinstall checkinstall/checkinstall
*** checkinstall-orig/checkinstall 2009-03-27 17:07:26.000000000 +0100
--- checkinstall/checkinstall 2009-04-14 16:34:08.000000000 +0200
***************
*** 2607,2615 ****
chmod 755 $BUILD_DIR/DEBIAN/postrm
fi
! # Tag files in /etc to be conffiles
find $BUILD_DIR/etc 2> /dev/null | sed -e "s,$BUILD_DIR,," | \
! grep -v '^/etc$' > $BUILD_DIR/DEBIAN/conffiles
# The package will be saved here (ignores <epoch>: prefix):
DEBPKG="${DIRECTORIO_FUENTE}/${NAME}_`echo ${VERSION} | sed -e 's/^[0123456789]*://'`-${RELEASE}_${ARCHITECTURE}.deb"
--- 2607,2616 ----
chmod 755 $BUILD_DIR/DEBIAN/postrm
fi
! # Tag non-directory files in /etc to be conffiles
find $BUILD_DIR/etc 2> /dev/null | sed -e "s,$BUILD_DIR,," | \
! (while read fn; do test ! -d "$BUILD_DIR/$fn" && echo "$fn"; done) \
! > $BUILD_DIR/DEBIAN/conffiles
# The package will be saved here (ignores <epoch>: prefix):
DEBPKG="${DIRECTORIO_FUENTE}/${NAME}_`echo ${VERSION} | sed -e 's/^[0123456789]*://'`-${RELEASE}_${ARCHITECTURE}.deb"

View file

@ -0,0 +1,71 @@
diff -x '*~' -rc checkinstall-1.6.2pre20081116-orig/installwatch/create-localdecls checkinstall-1.6.2pre20081116/installwatch/create-localdecls
*** checkinstall-1.6.2pre20081116-orig/installwatch/create-localdecls 2008-11-16 17:18:58.000000000 +0100
--- checkinstall-1.6.2pre20081116/installwatch/create-localdecls 2009-09-18 17:01:13.000000000 +0200
***************
*** 46,52 ****
echo -n 'Checking libc version... '
gcc -Wall -o libctest libctest.c
VERSION=`ldd libctest | grep libc\\.so | awk '{print $1}'`
- rm libctest
echo $VERSION
echo "#define LIBC_VERSION \"$VERSION\"" >> $OUTFILE
if test "$VERSION" = 'libc.so.5' ; then
--- 46,51 ----
***************
*** 56,62 ****
if test "$VERSION" = 'libc.so.6' ; then
echo -n 'Checking glibc subversion... '
! tmp="`ldd /bin/sh | grep libc.so 2> /dev/null`"
LibcPath=`expr "$tmp" : '[^/]*\(/[^ ]*\)'`
tmp="`strings $LibcPath | grep -i 'c library'`"
OsLibcMajor=`expr "$tmp" : '.* \([0-9][0-9]*\)'`
--- 55,61 ----
if test "$VERSION" = 'libc.so.6' ; then
echo -n 'Checking glibc subversion... '
! tmp="`ldd libctest | grep libc.so 2> /dev/null`"
LibcPath=`expr "$tmp" : '[^/]*\(/[^ ]*\)'`
tmp="`strings $LibcPath | grep -i 'c library'`"
OsLibcMajor=`expr "$tmp" : '.* \([0-9][0-9]*\)'`
***************
*** 86,103 ****
6)
echo '#define GLIBC_MINOR 6' >> $OUTFILE
SUBVERSION='glibc-2.6' ;;
! 7)
echo '#define GLIBC_MINOR 7' >> $OUTFILE
SUBVERSION='glibc-2.7' ;;
*)
- echo 'Treated as glibc >= 2.1 (finger crossed)'
echo '#define GLIBC_MINOR 1' >> $OUTFILE
SUBVERSION='glibc-2.1' ;;
esac
;;
esac
fi
echo >> $OUTFILE
echo '#endif' >> $OUTFILE
--- 85,104 ----
6)
echo '#define GLIBC_MINOR 6' >> $OUTFILE
SUBVERSION='glibc-2.6' ;;
! 7|8|9|10|11|12|13|14|15|16|17|18)
echo '#define GLIBC_MINOR 7' >> $OUTFILE
SUBVERSION='glibc-2.7' ;;
*)
echo '#define GLIBC_MINOR 1' >> $OUTFILE
SUBVERSION='glibc-2.1' ;;
esac
;;
esac
+ echo $SUBVERSION
fi
+ rm libctest
+
echo >> $OUTFILE
echo '#endif' >> $OUTFILE

View file

@ -0,0 +1,162 @@
diff -rc checkinstall-orig/installwatch/installwatch.c checkinstall/installwatch/installwatch.c
*** checkinstall-orig/installwatch/installwatch.c 2009-03-12 13:40:24.000000000 +0100
--- checkinstall/installwatch/installwatch.c 2009-03-27 22:42:19.000000000 +0100
***************
*** 110,115 ****
--- 110,117 ----
static int (*true_setxattr)(const char *,const char *,const void *,
size_t, int);
static int (*true_removexattr)(const char *,const char *);
+ static ssize_t (*true_getxattr)(const char *,const char *,const void *,size_t);
+ static ssize_t (*true_lgetxattr)(const char *,const char *,const void *,size_t);
#if(GLIBC_MINOR >= 1)
***************
*** 369,374 ****
--- 371,378 ----
true_unlink = dlsym(libc_handle, "unlink");
true_utime = dlsym(libc_handle, "utime");
true_setxattr = dlsym(libc_handle, "setxattr");
+ true_getxattr = dlsym(libc_handle, "getxattr");
+ true_lgetxattr = dlsym(libc_handle, "lgetxattr");
true_utimes = dlsym(libc_handle, "utimes");
true_access = dlsym(libc_handle, "access");
***************
*** 3494,3499 ****
--- 3498,3587 ----
return result;
}
+ int getxattr (const char *pathname, const char *name,
+ const void *value, size_t size)
+ {
+ int result;
+ instw_t instw;
+ int status;
+
+ REFCOUNT;
+
+ if (!libc_handle)
+ initialize();
+
+ #if DEBUG
+ debug(2,"getxattr(%s,%s)\n",pathname,name);
+ #endif
+
+ /* We were asked to work in "real" mode */
+ if( !(__instw.gstatus & INSTW_INITIALIZED) ||
+ !(__instw.gstatus & INSTW_OKWRAP) ) {
+ result=true_getxattr(pathname,name,value,size);
+ return result;
+ }
+
+ instw_new(&instw);
+ instw_setpath(&instw,pathname);
+ instw_getstatus(&instw,&status);
+
+ #if DEBUG
+ instw_print(&instw);
+ #endif
+
+ if(status&INSTW_TRANSLATED) {
+ result=true_getxattr(instw.translpath,name,value,size);
+ } else {
+ result=true_getxattr(instw.path,name,value,size);
+ }
+
+ instw_delete(&instw);
+
+ return result;
+ }
+
+ int lgetxattr (const char *pathname, const char *name,
+ const void *value, size_t size)
+ {
+ int result;
+ instw_t instw;
+ int status;
+
+ REFCOUNT;
+
+ if (!libc_handle)
+ initialize();
+
+ #if DEBUG
+ debug(2,"lgetxattr(%s,%s)\n",pathname,name);
+ #endif
+
+ /* We were asked to work in "real" mode */
+ if( !(__instw.gstatus & INSTW_INITIALIZED) ||
+ !(__instw.gstatus & INSTW_OKWRAP) ) {
+ result=true_lgetxattr(pathname,name,value,size);
+ return result;
+ }
+
+ instw_new(&instw);
+ instw_setpath(&instw,pathname);
+ instw_getstatus(&instw,&status);
+
+ #if DEBUG
+ instw_print(&instw);
+ #endif
+
+ if(status&INSTW_TRANSLATED) {
+ result=true_lgetxattr(instw.translpath,name,value,size);
+ } else {
+ result=true_lgetxattr(instw.path,name,value,size);
+ }
+
+ instw_delete(&instw);
+
+ return result;
+ }
+
#if(GLIBC_MINOR >= 1)
int creat64(const char *pathname, __mode_t mode) {
***************
*** 3663,3668 ****
--- 3751,3791 ----
return result;
}
+ int __open_2(const char *pathname, int flags, ...) {
+ va_list ap;
+ mode_t mode;
+
+ #if DEBUG
+ debug(2,"__open_2(%s,%d,mode)\n",pathname,flags);
+ #endif
+
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+
+ /* The open() function in Glibc 2.9 is an always-inline
+ function that may call __open_2(), so it's important that
+ we handle it. I don't know what __open_2() is supposed to
+ do, but redirecting it to open() seems to work fine. */
+
+ return open(pathname,flags,mode);
+ }
+
+ int __open64_2(const char *pathname, int flags, ...) {
+ va_list ap;
+ mode_t mode;
+
+ #if DEBUG
+ debug(2,"__open64_2(%s,%d,mode)\n",pathname,flags);
+ #endif
+
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+
+ return open64(pathname,flags,mode);
+ }
+
struct dirent64 *readdir64(DIR *dir) {
struct dirent64 *result;

View file

@ -0,0 +1,19 @@
Extracted from Arch's patch
https://projects.archlinux.org/svntogit/community.git/tree/trunk/build-fix.patch?h=packages/checkinstall
diff -wbBur checkinstall-1.6.2/installwatch/installwatch.c checkinstall-1.6.2.my/installwatch/installwatch.c
--- checkinstall-1.6.2/installwatch/installwatch.c 2008-11-16 19:20:53.000000000 +0300
+++ checkinstall-1.6.2.my/installwatch/installwatch.c 2010-01-15 18:55:50.112716628 +0300
@@ -2938,13 +2938,8 @@
return result;
}
-#if (GLIBC_MINOR <= 4)
-int readlink(const char *path,char *buf,size_t bufsiz) {
- int result;
-#else
ssize_t readlink(const char *path,char *buf,size_t bufsiz) {
ssize_t result;
-#endif
instw_t instw;
int status;

View file

@ -0,0 +1,75 @@
diff -rc -x '*~' checkinstall-1.6.2-orig/installwatch/installwatch.c checkinstall-1.6.2/installwatch/installwatch.c
*** checkinstall-1.6.2-orig/installwatch/installwatch.c 2008-11-16 17:20:53.000000000 +0100
--- checkinstall-1.6.2/installwatch/installwatch.c 2010-02-08 16:35:17.000000000 +0100
***************
*** 100,106 ****
static int (*true_lxstat)(int,const char *,struct stat *);
static int (*true_scandir)( const char *,struct dirent ***,
int (*)(const struct dirent *),
! int (*)(const void *,const void *));
static int (*true_symlink)(const char *, const char *);
static int (*true_truncate)(const char *, TRUNCATE_T);
static int (*true_unlink)(const char *);
--- 100,106 ----
static int (*true_lxstat)(int,const char *,struct stat *);
static int (*true_scandir)( const char *,struct dirent ***,
int (*)(const struct dirent *),
! int (*)(const struct dirent **,const struct dirent **));
static int (*true_symlink)(const char *, const char *);
static int (*true_truncate)(const char *, TRUNCATE_T);
static int (*true_unlink)(const char *);
***************
*** 120,126 ****
static struct dirent64 *(*true_readdir64)(DIR *dir);
static int (*true_scandir64)( const char *,struct dirent64 ***,
int (*)(const struct dirent64 *),
! int (*)(const void *,const void *));
static int (*true_xstat64)(int,const char *, struct stat64 *);
static int (*true_lxstat64)(int,const char *, struct stat64 *);
static int (*true_truncate64)(const char *, __off64_t);
--- 120,126 ----
static struct dirent64 *(*true_readdir64)(DIR *dir);
static int (*true_scandir64)( const char *,struct dirent64 ***,
int (*)(const struct dirent64 *),
! int (*)(const struct dirent64 **,const struct dirent64 **));
static int (*true_xstat64)(int,const char *, struct stat64 *);
static int (*true_lxstat64)(int,const char *, struct stat64 *);
static int (*true_truncate64)(const char *, __off64_t);
***************
*** 3077,3085 ****
return result;
}
! int scandir( const char *dir,struct dirent ***namelist,
int (*select)(const struct dirent *),
! int (*compar)(const void *,const void *) ) {
int result;
if (!libc_handle)
--- 3077,3085 ----
return result;
}
! int scandir( const char * dir,struct dirent ***namelist,
int (*select)(const struct dirent *),
! int (*compar)(const struct dirent **,const struct dirent **) ) {
int result;
if (!libc_handle)
***************
*** 3691,3697 ****
int scandir64( const char *dir,struct dirent64 ***namelist,
int (*select)(const struct dirent64 *),
! int (*compar)(const void *,const void *) ) {
int result;
if (!libc_handle)
--- 3691,3697 ----
int scandir64( const char *dir,struct dirent64 ***namelist,
int (*select)(const struct dirent64 *),
! int (*compar)(const struct dirent64 **,const struct dirent64 **) ) {
int result;
if (!libc_handle)

View file

@ -0,0 +1,15 @@
https://build.opensuse.org/package/view_file/openSUSE:13.1/checkinstall/checkinstall-set_buildroot.patch
Index: checkinstall
===================================================================
--- a/checkinstall 2009-12-26 20:17:24.000000000 +0100
+++ b/checkinstall 2011-01-31 18:17:56.171593541 +0100
@@ -2463,7 +2463,7 @@ cd "$DIRECTORIO_FUENTE"
echo
echogn "Building RPM package..."
-$RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log
+$RPMBUILD --buildroot ${BUILDROOT} -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log
okfail
if [ $? -gt 0 ]; then

View file

@ -0,0 +1,12 @@
diff -ru -x '*~' checkinstall-1.6.2-orig/installwatch/installwatch.c checkinstall-1.6.2/installwatch/installwatch.c
--- checkinstall-1.6.2-orig/installwatch/installwatch.c 2008-11-16 17:20:53.000000000 +0100
+++ checkinstall-1.6.2/installwatch/installwatch.c 2013-03-15 13:50:12.717646381 +0100
@@ -28,6 +28,8 @@
* <mail@fredemmott.co.uk>
*/
+asm (".symver memcpy, memcpy@GLIBC_2.2.5");
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>