我正在尝试从source-1.4.3-linux.tgz(已下载,因此我不控制名称)构建一个rpm,并将文件解压缩到source-1.4.3-linux目录中。在我的source.spec文件中,我有
Name: source
Version: 1.4.3
所以我得到一个错误可能很合逻辑:
cd: source-1.4.3: No such file or directory.
我尝试将-linux附加到该版本上,但是rpmbuild那里只需要一个数字。我该怎么办才能告诉rpmbuild源文件已解压到source-1.4.3-linux中?
答案 0 :(得分:0)
这是一个simple.spec
文件,可以帮助您了解此问题。源压缩包包含以下内容:
$ tar tzf simple-0.tar.gz
simple-0/
simple-0/simple.txt
规范文件:
Summary: Simple SPEC
Name: simple
Version: 0
Release: 1
License: NONE
Group: NONE
URL: NONE
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
" This is Simple "
%prep
%setup -q
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/tmp/
install -m 0644 simple.txt %{buildroot}/tmp/simple.txt
%clean
rm -rf $RPM_BUILD_ROOT
%post
echo "In the Post section of Simple"
%files
%defattr(-,root,root,-)
%doc
/tmp/simple.txt
%changelog
* Wed Sep 12 2018 <iamauser@localdomain> -
- Initial build.
答案 1 :(得分:0)
只需使用setup macro。
using (System.IO.StreamWriter sw1 = new System.IO.StreamWriter("test.txt"))
{
sw1.WriteLine("hello1");
}
using (System.IO.StreamWriter sw2 = new System.IO.StreamWriter("test.txt"))
{
sw2.WriteLine("hello2");
}
答案 2 :(得分:-1)
好的,我已经开始工作了。也许是hack,但它正在工作。根据问题,我的tarball的命名方式异常。
$ tar tzf source-1.4.3-linux-amd64.tar.gz
source-1.4.3-linux-amd64/
source-1.4.3-linux-amd64/simple.txt
在specfile的%prep部分,而不是使用%setup或%autosetup,我手动解压缩并重命名了未压缩的目录。
Name: source
Version: 1.4.3
Release: 0
Source0: https://example.com/%{name}-%{version}-linux-amd64.tar.bz2
%prep
rm -fr %{name}-%{version}
tar -xjf %{SOURCE0}
mv %{name}-%{version}-linux-amd64 %{name}-%{version}