Howto Create Custom Directory in a Package? (Python3)

All:

I have my new package Makefile successfully building, but I am still unable to figure out how to add a custom directory to my package.

Per the Creating packages documentation, I should be able to place it in the {packageroot}.

{packageroot} = ~/openwrt/feeds/packages/lang/python3-onionbalance

{packageroot}/files/etc/onionbalance

However, any new packages that I build don't seem to include the custom directory.

Is the custom files documentation only for files and not directories?

Your assistance is greatly appreciated.

Respectfully,

Gary

Search for $(INSTALL_DIR).

Iirc empty directories are not packaged due to the way the ipkg bundler works, but not entirely sure if this is still the case.

In any case try placing an empty placeholder file in the onionbalance directory and see if it gets packaged then.

@slh

I'm building a python3 package that uses PYPI for configuration.

When I try to use $(INSTALL_DIR) it overrides the PYPI configuration and the package is built empty.

Any other ideas?

Thanks.

Gary

@jow

I tried including a placeholder file in the files directory, but it doesn't get packaged either.

{packageroot} = ~/openwrt/feeds/packages/lang/python3-onionbalance

{packageroot}/files/etc/onionbalance/config.txt

Do custom files/directories require certain permissions?

I don't get it.

Thanks.

Gary

can you post you (full) Makefile ?

You might need help from python specialists like @commodo , as python package Makefiles may behave differently than normal packages.

@erdoukki et al:

New python3-onionbalance Makefile

$ cat python3-onionbalance/Makefile
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=python3-onionbalance
PKG_VERSION:=0.2.1
PKG_RELEASE:=1

PYPI_NAME:=OnionBalance
PKG_HASH:=3421e5fdef24674432021c605164c790ff7f66ec2c111f3e610b212c058b33ea

PKG_MAINTAINER:=Donncha O'Cearbhaill <donncha@donncha.is>
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk

define Package/python3-onionbalance
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=onionbalance
URL:=https://onionbalance.readthedocs.io
DEPENDS:=+python3 +python3-setuptools +python3-stem +python3-yaml +python3-cryptography +python3-cryptodomex +python3-future +python3-setproctitle +tor
endef

define Package/python3-onionbalance/description
OnionBalance provides load-balancing and redundancy for Tor onion services by distributing requests to multiple back-end Tor instances.
endef

$(eval $(call Py3Package,python3-onionbalance))
$(eval $(call BuildPackage,python3-onionbalance))
$(eval $(call BuildPackage,python3-onionbalance-src))

It builds and installed successfully with dependencies.

I just can't add the /etc/onionbalance directory to the package.

I appreciate all the replies.

Respectfully,

Gary

Looking at https://github.com/openwrt/packages/tree/master/lang/python
may be the filespec will help !?

The Py3Package/<package>/filespec rule contains one or more lines of the following format (whitespace added for clarity):

<one of: +-=> | <file/directory path> | <file permissions>

Never tested myself but I have a lot of trouble building python-pip packages myself...

or you may include in your makefile the default python3 package install and customize it :

will give womething like this :

define Package/python3-onionbalance/install
		$(INSTALL_DIR) $$(1)/usr/bin
		$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/
# PUT CUSTOM HERE...
endef