summaryrefslogtreecommitdiff
path: root/generate-obs-repos
blob: 3078e81a7861db0df437cd857407f8169a1f8011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash

export REPOSDIR=${BUILD_ROOT}/obs_repo

if [ -d ${BUILD_ROOT}/.pkgs ]; then
	# This step is used when worker is called from obs remote
    
	mkdir -p ${REPOSDIR}/standard/${DEBOOT_ARCH}
    for ORIG in `ls ${BUILD_ROOT}/.pkgs`; do
        DEST=`echo $ORIG | sed -e "s,.deb,-1obs1_${DEBOOT_ARCH}.deb,g"`
        cp ${BUILD_ROOT}/.pkgs/${ORIG} ${REPOSDIR}/standard/${DEBOOT_ARCH}/$DEST
    done
else
	# This step is used on local builds by osc

	mkdir -p ${BUILD_ROOT}/obs_repo/standard/all
	find ${PKG_CACHE_DIR}/*/*/all -type f -name \*.deb -exec ln -sf {} ${BUILD_ROOT}/obs_repo/standard/all \;
	mkdir -p ${BUILD_ROOT}/obs_repo/standard/${DEBOOT_ARCH}
	find ${PKG_CACHE_DIR}/*/*/${DEBOOT_ARCH} -type f -name \*.deb -exec ln -sf {} ${BUILD_ROOT}/obs_repo/standard/${DEBOOT_ARCH} \;
fi

mkdir -p ${REPOSDIR}/dists/obs/main/binary-${DEBOOT_ARCH}
mkdir -p ${REPOSDIR}/cache

# Create apt-ftparchive files
cat > ${REPOSDIR}/apt-ftparchive-obs.conf << EOF
Dir {
  ArchiveDir "${REPOSDIR}";
  CacheDir "${REPOSDIR}/cache";
};

Default {
  Packages::Compress ".";
  Sources::Compress ".";
  Contents::Compress ".";
};

TreeDefault {
  BinCacheDB "packages-\$(SECTION)-\$(ARCH).db";
  Directory "standard";
  Packages "\$(DIST)/\$(SECTION)/binary-\$(ARCH)/Packages";
  SrcDirectory "pool/\$(SECTION)";
  Sources "\$(DIST)/\$(SECTION)/source/Sources";
  Contents "\$(DIST)/Contents-\$(ARCH)";
  };

Tree "dists/obs" {
    Sections "main";
    Architectures "${DEBOOT_ARCH}";
}
EOF

cat > ${REPOSDIR}/obs-release.conf << EOF
APT::FTPArchive::Release::Origin "OBS";
APT::FTPArchive::Release::Label "OBS";
APT::FTPArchive::Release::Suite "obs";
APT::FTPArchive::Release::Codename "obs";
APT::FTPArchive::Release::Architectures "${DEBOOT_ARCH}";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Description "Open Build Server local deb repos";
EOF

apt-ftparchive generate ${REPOSDIR}/apt-ftparchive-obs.conf
apt-ftparchive -c ${REPOSDIR}/obs-release.conf release ${REPOSDIR}/dists/obs/ > ${REPOSDIR}/dists/obs/Release

echo "Done generate repos ..."