Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for special system-level %include path #685

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ install-data-local:
@$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp
@$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/macros.d
@$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/lua
@$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/include

# XXX to appease distcheck we need to remove "stuff" here...
uninstall-local:
Expand All @@ -259,6 +260,7 @@ uninstall-local:
@rm -f $(DESTDIR)$(rpmconfigdir)/macros
@rm -rf $(DESTDIR)$(rpmconfigdir)/macros.d
@rm -rf $(DESTDIR)$(rpmconfigdir)/lua
@rm -rf $(DESTDIR)$(rpmconfigdir)/include

MAINTAINERCLEANFILES = ChangeLog

Expand Down
11 changes: 11 additions & 0 deletions build/parseSpec.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ int readLine(rpmSpec spec, int strip)
spec->line[0] = '\0';
} else if (spec->readStack->reading && (lineType->id == LINE_INCLUDE)) {
char *fileName, *endFileName, *p;
char *sysinc = NULL;

fileName = s+8;
SKIPSPACE(fileName);
Expand All @@ -533,7 +534,17 @@ int readLine(rpmSpec spec, int strip)
}
*endFileName = '\0';

/* System includes live in a special path and become buildrequires */
if (*fileName == '<' && *(endFileName-1) == '>') {
*(endFileName-1) = '\0';
sysinc = rpmGetPath("%{_rpmincludedir}/", fileName + 1, NULL);
addReqProv(spec->sourcePackage, RPMTAG_REQUIRENAME,
sysinc, NULL, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this one, because you are technically do not depend on exact /usr/lib/rpm/include/… file, but rather that path will be present...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point is that other tooling knows how to look at buildrequires, but they dont (and should not) try to parse rpmbuild output for missing files.

fileName = sysinc;
}

ofi = pushOFI(spec, fileName, (spec->flags & RPMSPEC_FORCE));
free(sysinc);
goto retry;
}

Expand Down
1 change: 1 addition & 0 deletions macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ package or when debugging this package.\
# %__myattr_exclude_path exclude by path regex
#
%_fileattrsdir %{_rpmconfigdir}/fileattrs
%_rpmincludedir %{_rpmconfigdir}/include

# This macro defines how much space (in bytes) in package should be
# reserved for gpg signatures during building of a package. If this space is
Expand Down
4 changes: 4 additions & 0 deletions tests/rpmbuild.at
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ echo "Describe me" > "${RPMTEST}/${dsc}"
runroot rpmspec -q "/data/SPECS/notthere.spec" 2>&1; echo $?
runroot rpmspec -q --define "incfile /not/there" "/data/SPECS/inctest.spec" 2>&1; echo $?
runroot rpmspec -q --define "incfile ${dsc}" --qf "%{description}\n" "/data/SPECS/inctest.spec" 2>&1; echo $?
runroot rpmspec -q --define "%_rpmincludedir /usr/lib/rpm/include" --define "incfile <system.inc>" --buildrequires "/data/SPECS/inctest.spec" 2>&1; echo $?
rm -f "${RPMTEST}/${dsc}"
],
[0],
Expand All @@ -118,6 +119,9 @@ inctest-1.0-1.noarch
0
Describe me
0
warning: Unable to open /usr/lib/rpm/include/system.inc: No such file or directory
/usr/lib/rpm/include/system.inc
0
],
[])
AT_CLEANUP
Expand Down