-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Packages created with the command termux-create-package cannot be added to a repo using termux-apt-repo.
Steps to repoduce:
git clone 'https://github.com/termux/termux-apt-repo.git'
cd termux-apt-repo
python3 setup.py install --user
cd ..
git clone 'https://github.com/termux/termux-create-package.git'
cd termux-create-package
python3 setup.py install --user
cd ..
cat > helloworld << 'EOF'
#!/bin/bash
echo 'hello world!'
EOF
chmod +x helloworld
cat > helloworld_1.0_all.json << 'EOF'
{
"name": "helloworld",
"version": "1.0",
"arch": "all",
"description": "Hello World",
"homepage": "http://localhost",
"files": {
"helloworld": "bin/helloworld"
}
}
EOF
# build package and create repo
termux-create-package helloworld_1.0_all.json
mkdir pkg
cp helloworld_1.0_all.deb pkg/
mkdir repo
termux-apt-repo pkg/ repo/
Traceback (most recent call last):
File "/bin/termux-apt-repo", line 86, in
add_deb(deb_path, component, use_hard_links)
File "/bin/termux-apt-repo", line 23, in add_deb
deb_to_add_control_file = control_file_contents(deb_to_add_path)
File "/bin/termux-apt-repo", line 19, in control_file_contents
stderr=subprocess.DEVNULL
File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
**kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ar p pkg/helloworld_1.0_all.deb control.tar.xz | tar --to-stdout -xJf - ./control']' returned non-zero exit status 2
In my opinion, the problem is in line 59:
info = tarfile.TarInfo(name="control")
should be
info = tarfile.TarInfo(name="./control")
so that the control.tar file has the same structure as the packages compiled using build-package.sh.
# patch
cd termux-create-package
sed -i 's|info = tarfile.TarInfo(name="control")|info = tarfile.TarInfo(name="./control")|g' termux-create-package
python3 setup.py install --user
cd ..
# rebuild
rm helloworld_1.0_all.deb
rm -Rf pkg/ repo/
termux-create-package helloworld_1.0_all.json
mkdir pkg
cp helloworld_1.0_all.deb pkg/
mkdir repo
termux-apt-repo pkg/ repo/
Adding deb file: helloworld_1.0_all.deb...
Creating package file for extras and all...
Done!Make the repo/ directory accessible at $REPO_URL
Users can then access the repo by adding a file at
$PREFIX/etc/apt/sources.list.d
containing:
deb [trusted=yes] $REPO_URL termux extras[trusted=yes] is not needed if the repo has been signed with a gpg key
The problem occurs on Debian [GNU ar (GNU Binutils for Debian) 2.28] and Termux itself [GNU ar (GNU Binutils) 2.31.1].