Commit Graph

258 Commits

Author SHA1 Message Date
443060d11a Add macro to allow dependencies beginning with a dot character in spec file
After commit f4d876f93 rpm-build may generate dependencies beginning
with a dot character, but spec parser refuses such dependencies.
rpmrebuild fails to rebuild packages with such dependencies because it
builds packages with rpmbuild from generated spec files.
2018-10-03 14:33:17 +03:00
d831a6ed9a Add support for $RPM_ADD_CHANGELOG_{NAME,TEXT,TIME}
If all these environment variables are set, an entry based on their
contents is added to the changelog of source and all binary packages.
2018-09-24 18:07:32 +03:00
Alexey Tourbin
72ad101add 4.0.4-alt113
- Implemented limited support for large files: a 2GB+ file can now be packaged,
  but the total size of uncompressed cpio payload is capped at 4 GB.
- Automatically downgrade LZMA compression levels 7-9 -> 6 on small payloads.
2018-06-26 13:03:42 +03:00
Alexey Tourbin
4d777d01d2 changed a few more vars int -> uint32_t/size_t
This is probably the last change of such kind.  There are many other
instances left, and fixing them all is hopeless.  On the other hand,
the way mod 2^32 arithmetic works, although technically not always
well defined, is to our advantage.  I suggest that only user-visible
discrepancies further be fixed.

The following comparison to st_size looks particularly bad.
The code turns out to be unused!

lib/signature.c:
> verifySizeSignature(const char * datafile, int_32 size, /*@out@*/ char * result)
> [...]
>     if (size != st.st_size) {
>         sprintf(result, "Header+Archive size mismatch.\n"
2018-06-26 12:42:44 +03:00
Alexey Tourbin
d410a87e93 configure.ac: enabled large-file support
This turns out to be a bit easier than I thought yesterday.  When mmap
fails in lib/fsm.c, it falls back to file descriptor IO.  So by simply
enabling AC_SYS_LARGEFILE, I'm already able to package a 3G file, which
can be written like this:

perl -e 'seek STDOUT,3<<30,0 and print 1 or die' >out
2018-06-26 12:42:44 +03:00
Alexey Tourbin
3df35b4d63 build/pack.c: automatically downgrade lzma levels 7-9 on smaller inputs 2018-06-26 12:42:44 +03:00
Alexey Tourbin
d85641818b build/pack.c: pre-calculate cpio archive size, fail gracefully on >= 4G
The nearest goal is to be able to package files up to 4G, on both 32-bit
64-bit architectures, provided that cpio payload size also does not
exceed 4G.  More specifically, the limit is 2^32-2, while 2^32-1 remains
special (this is not my own invention, I adopt it from rpm.org).

If the limit is exceeded, rpmbuild should fail gracefully instead of
writing malformed packages with truncated integer tags.

(Supporting 4G+ files is a distant goal - neither rpm-4.0 nor apt-rpm
can handle them yet.  Besides, it's not clear if producing such big
packages is even a good idea, unless one wishes to package p0rn.)
2018-06-26 12:42:44 +03:00
Ivan Zakharyaschev
4347c5f9d0 turn on running %%__find_{conflicts,obsoletes} if they are defined 2018-05-23 17:00:54 +03:00
f4d876f935 build/interdep.c: add upgradeInterdep function
If RPM_STRICT_INTERDEPS environment variable is set and not empty, this
function replaces every strict requirement on NEVR with
".${RPM_STRICT_INTERDEPS}-NEVR", and adds to every package which
provides NEVR ".${RPM_STRICT_INTERDEPS}-NEVR" provide if some other
package requires this ".${RPM_STRICT_INTERDEPS}-NEVR".

This is needed to able to build a source package to different repo
branches with the same NEVR, and to rebuild the source package as well
with same NEVR within one branch and avoid interdep collisions.
2018-04-18 22:51:40 +03:00
7161802b38
respect device ID when remap inodes
The inode collision probably would never have happened (especially in
chroot environment), but this make the code more correct.
2018-03-27 20:37:22 +03:00
d6fec7f8ea genCpioListAndHeader: remap device and inode numbers (ALT#34398)
Inspired by rpm.org commits rpm-4.10.0-beta1~80 and rpm-4.10.0-beta1~67.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-05 23:20:22 +00:00
a555b44bb5 compare_deps: fix a bug in handling epochs
Fixes: 4.0.4-alt100.63~1
2018-01-05 23:20:22 +00:00
96a5445b98 Drop bzdio support
There is no use in supporting bzip2 compressed payloads in rpmbuild nowadays.
2017-11-20 01:42:20 +00:00
55b07cb0ff Add support for SOURCE_DATE_EPOCH environment variable (ALT#34200)
This allows rpmbuild to override file timestamps.

Based on rpm.org commit 8d84878ee05b2e63858af3a5a49d98e9e2933b1b.
2017-11-15 15:29:28 +00:00
e8c780c2b0 Disable build and install of unpackaged files
These are no longer packaged anyway, so no need to bother.
2017-01-14 13:42:53 +00:00
1ccc182f71 build: rewrite without using nested functions
gcc generates trampolines for pointers to nested functions.
This implies executable stack - the thing we want to avoid.
2015-01-28 17:04:30 +00:00
32171d0cb5 build/reqprov.c (deps_opt_enabled): cleanup 2014-11-19 17:23:34 +00:00
Igor Vlasenko
83f32e64e2 Finer control for %_deps_optimization (ALT#30476)
0: disabled
1: old behaviour with %_deps_optimization=0
2: old behaviour with %_deps_optimization=1
3: old behaviour with %_deps_optimization=2
2014-11-19 17:22:58 +00:00
Gleb Fotengauer-Malinovskiy
4ebe39ba25 Backport Disttag: syntax to spec file parser and header content.
Original commit by jbj@ (10336f1):
- add Disttag: syntax to spec file parser and header
content.
2014-06-24 19:00:52 +04:00
4134fc39ac Fix automake warnings
Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
build/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
lib/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
python/Makefile.am:7: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmdb/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmio/Makefile.am:9: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
tools/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2014-02-15 22:19:47 +00:00
95e1c533d9 build/interdep.c (fix_weak_deps): ignore packages without cpioList 2013-04-03 01:33:38 +00:00
8239befdd2 build/reqprov.c (compare_deps): fix potential use after free
Fix potential use after free introduced in 4.0.4-alt31.
2013-01-29 16:14:54 +00:00
0fc2559b49 build/interdep.c (pruneSrc1): enhance wording 2013-01-28 22:48:10 +00:00
59fa5d7825 build/interdep.c (makeRequires): ignore packages without cpioList 2013-01-28 22:28:42 +00:00
b238cfc321 build/interdep.c (pruneSrc1): avoid adding duplicate deps 2013-01-28 16:22:44 +00:00
c6991af51a build/reqprov.c (compare_deps, compare_sense_flags): fix bugs in comparisons of releases
Before this change, thanks to rpmEVRcmp(), compare_deps() used to treat
EVRs with common EV as equal when one had a release and another hand't.

There were some reasons to use this approach, e.g. to decide that
	Requires: %name = %version
is weaker than
	Requires: %name = %version-%release
it had firstly to consider them as comparable deps.  But, as an
unfortunate consequence of that approach, it was deciding that such deps
are equal, so that addReqProv() was unable to replace former with the
latter.
2013-01-28 00:52:24 +00:00
525389d128 build/reqprov.c (compare_deps): promote Epoch by giving it special treatment
If one of deps has Epoch and another one hasn't,
we first compare them without Epoch, and if it happens
that they are equal, then the dep that has Epoch wins.
2013-01-27 23:51:55 +00:00
7b9d0f53d1 build/reqprov.c (compare_sense_flags): cleanup
This is essentially a noop change that makes the code more readable.
2013-01-27 23:51:47 +00:00
e97eca74be build/reqprov.c (compare_deps, compare_sense_flags): readability improvements
This is a noop change that hopefully makes the code a bit more readable.
2013-01-27 23:22:23 +00:00
cd742a2959 processBinaryFiles: check provides of generated binary packages 2013-01-26 22:32:11 +00:00
cc191758d3 build/interdep.c: use rpmMessage 2013-01-26 22:32:10 +00:00
ed9fc6b550 build/interdep.c (fix_weak_deps): further interdep enhancements
Ignore requirements with RPMSENSE_SENSEMASK containing ~RPMSENSE_EQUAL.
Add strict requirements for requirements on subpackages regardless of
number of alternative providers.
2013-01-26 20:51:10 +00:00
ffaf1f8baf build/reqprov.c (compare_deps): fix Epoch handling for deps with same senses
When comparing deps whose senses are identical, Epoch needs special
treatment: if one of deps has Epoch and another one hasn't, we first
compare them without Epoch, and if it happens that they are equal,
the dep that has Epoch wins.
2013-01-26 18:29:26 +00:00
de77ec4556 build/interdep.c: fix interpackage dependencies automatically
Non-strict interpackage dependencies are now converted to strict when
appropriate.
The %_allowed_nonstrict_interdeps macro support is therefore gone.

This change also downgrades "dependency needs Epoch" error to warning
because it automatically adds strict dependencies.
2013-01-26 18:29:21 +00:00
acb0164adf build/interdep.c: optimize code related to addRequires() 2013-01-25 01:31:40 +00:00
2f8008125d build/interdep.c: upgrade "dependency needs Epoch" warning to error 2013-01-24 07:09:44 +00:00
37a24f69a3 build/interdep.c: implement an interdep error check control
There is a macro now that can list pairs of allowed non-strict deps.
By default, the macro is not defined so the list is empty and therefore
non-strict deps are not allowed.
2013-01-24 05:52:49 +00:00
Igor Vlasenko
8468c6fb06 build/parsePrep.c: add %patch -F<N> support (ALT#27662)
In modern rpms both %patch -F <N> and %patch -F<N> are valid option
calls whereas old -F implementation supported -F <N> syntax only.
This patch adds support for %patch -F<N> syntax.
2012-08-24 08:30:44 +00:00
c4a3fcd4ca Cleanup previous commit 2012-08-16 23:16:57 +00:00
Igor Vlasenko
f1e0f83d55 build/parsePrep.c: %patch -F, -d options and macros (ALT#27627)
Backport from rpm 4.10:
%patch -F <fuzz>
%patch -d <destdir>
support for macros:
%{_default_patch_fuzz}  Default fuzz level for %patch in spec file.
%{_default_patch_flags} Default patch flags
2012-08-16 22:57:17 +00:00
12538e4010 parseSpec: use getline() to fix long line processing
* build/rpmspec.h (OpenFileInfo): Change readBuf to a pointer,
add readBufSize.
(freeOpenFileInfo): New prototype.
* build/spec.c (freeSpec): Initialize readBuf and readBufSize.
(freeOpenFileInfo): New function.
* build/parseSpec.c (readLine): Use getline and freeOpenFileInfo.
(closeSpec): Use freeOpenFileInfo.
2012-03-19 19:02:25 +00:00
e870902a7b build: make size of line buffer for .spec parsing configurable via %_spec_line_buffer_size
Based on http://rpm5.org/cvs/chngview?cn=9215

In the meantime, decrease this default line buffer size from 80K to 64K.
2012-03-19 01:29:03 +00:00
a470a11bac parseSpec: enhance line buffer overflow diagnostics 2012-03-19 18:18:03 +00:00
060fd2e340 parseSpec: implement line buffer overflow protection
* build/parseSpec.c (copyNextLine): Protect spec->lbuf line buffer
from overflow.
2012-03-19 01:13:13 +00:00
2aa342e60b rpmbuild: add "-bt" %check-only option 2011-12-06 16:25:14 +00:00
Alexey Tourbin
f491d6e6c4 build/files.c: fixed SIGPIPE to avoid "broken pipe" messages in scripts
SIGPIPE SIG_IGN handler was installed before the fork, which means that,
in autodep scripts, SIGPIPE was ignored as well.  This is why in
commands like

	cmd1 | cmd2

cmd1 was not killed graceully with SIGPIPE, but instead writing to cmd2
resulted in EPIPE.  For which some commands apparently were not ready.

This fixes messages like
/usr/lib/rpm/files.req: line 33: echo: write error: Broken pipe
2011-10-03 06:11:54 +04:00
Igor Vlasenko
c9505d67b9 build.c,parsePrep.c: quoted buildSubdir, to allow spaces. 2011-08-06 18:38:30 +03:00
0358825884 pruneRDeps1: fix check for cycles
The check for cycles introduced in 4.0.4-alt100.17-6-ga71e004 appeared
to be incomplete.  For example, it fails to recognize a cycle in the
following example:

%package -n test
Requires: libtest = %version-%release

%package -n libtest
Requires: libtest-common = %version-%release

%package -n libtest-common
Requires: libtest = %version-%release
2011-03-14 02:27:17 +00:00
37ca0532c0 addReqProv: fix optimization of subpackage self-requirements
Optimization of subpackage self-requirements never worked before because
version-release is normally not defined for subpackages at parse time.
2011-03-14 01:49:42 +00:00
Alexey Tourbin
57ecc37f6f build/files.c: fixed RPMTAG_SIZE for src.rpm packages 2011-02-09 14:15:54 +03:00